Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f1g4K-0000b6-KW for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Mar 2018 22:30:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f1g4J-0008B2-AJ for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Mar 2018 22:30:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f1g4I-0008As-Vs for pgsql-hackers@lists.postgresql.org; Thu, 29 Mar 2018 22:30:51 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f1g4B-0001si-RE for pgsql-hackers@postgresql.org; Thu, 29 Mar 2018 22:30:49 +0000 Received: by mail-wm0-x241.google.com with SMTP id h76so13176551wme.4 for ; Thu, 29 Mar 2018 15:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MBtCiJCmHkcS9xZ3P9pTI+MbYM5xtHRqS9opgCTsfs4=; b=RS1NENIv3CwIj3qeN/CM7BcQajLvhwEV/uU0Mtb1ref8g5ok3gfsqBj6m/j3XfjRo+ iGQppszinxU5E/y5Tx/fhmMIYnj+dRDjPOTTEc0yAGm5NTfKodMhhri4vfaUBMRqB1jr fW9O0Saf3Aa4k+XhLpst6U16ipQWManjPjMGD1GhMIu2crkHj+OnsB1bE9hqSR/6a/iR vqy7tLCE8Og1JHsQXSWdwv59r6n9DGqTGnWrEfO1bDokOYkdVMNIyx8MMyvW4fxP+i0z gDT4owpCbgEzz+wgJ7f22PqRKReos57VwFkGHOAfWgRlirM97MFLxb6Xrm/uE7uz8USA y/0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=MBtCiJCmHkcS9xZ3P9pTI+MbYM5xtHRqS9opgCTsfs4=; b=jDwVPm869HF/TYbgOzUWi75Ccv3RmkUOkPEsR9J/d9ND8udoQ0SdWHwfXHxRAiJ9H1 RRlSVmJ/p0SfkmHuA95Z/KU0rW9Qh0yphyzA5UoJ9dKIuICxypkUVQkVlgG6keMJkAvF 1xlHHDEHGCjNX4AbcAshSWMufM77APDAJoIRSTO4pgA1exSq4lC6HVJpiCGDq9l5AZNY xSs+nYhWcv9PPvXbT6Fo59dMbDuJyBVIXEWO5kMH7F1Xz9JvpJel1ew3qpa85dOF35VI r1TMoVwS6Ypz/jxFgmF3sluM57rmTl0t/ZSRTr8rleVPw+G7c5W6wgyeo8umtIjld2qz hPuQ== X-Gm-Message-State: AElRT7Fr6/JX9A57IIie+RO5XFcFxSgqUb9w7eLJGpgJ3mHX6TklxESN 2cFx9zuz8ZiLjN7+yQ+xU60Z2w== X-Google-Smtp-Source: AIpwx4/N73eY4pEQk+JQv0yQ9alNdnbxMQ0842+B2EPRL9wS7jZjv+QmF/e95O+i5UK7lo0DDfaYzQ== X-Received: by 10.28.191.20 with SMTP id p20mr506628wmf.100.1522362642115; Thu, 29 Mar 2018 15:30:42 -0700 (PDT) Received: from [192.168.0.106] (150.123.broadband11.iol.cz. [90.178.123.150]) by smtp.gmail.com with ESMTPSA id p137sm4351699wmd.41.2018.03.29.15.30.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 15:30:41 -0700 (PDT) Subject: Re: [HACKERS] logical decoding of two-phase transactions To: Andres Freund , Tomas Vondra Cc: Nikhil Sontakke , Craig Ringer , Peter Eisentraut , Simon Riggs , Sokolov Yura , Stas Kelvich , Dmitry Dolgov <9erthalion6@gmail.com>, Tom Lane , Masahiko Sawada , PostgreSQL Hackers , Robert Haas References: <20180212162040.rsnlnysmf7n4yo7i@alap3.anarazel.de> <20180302005343.zv6nsqimcujzjrcd@alap3.anarazel.de> <20180329215815.36xxakgujx4luo4m@alap3.anarazel.de> From: Petr Jelinek Openpgp: preference=signencrypt Autocrypt: addr=petr.jelinek@2ndquadrant.com; keydata= xsFNBFawwSABEAC45Vua8rSggpM2kkMMmoOHz51a+fi3OXFfnrStVh80pM2/J9nSzjrIKQKf H5PtRnoYzSKnoUDoLOkLwDYitK3HzUUWXma+AWAqef2Y0GSZ7A3jJkD+JHOfkpS1CIpkEB/e WjA8Wqegwzc/OEE5111/l0Q1e6jxgZI86h8MMnm35Of1Y6Lz4kqWCyxHhaTJKTCkq66ICQ2C VJkbvuUoEE+Hr/I38dPHTAqIlCnycVnJPLHBQ/UYGHR/USF8qI/qJJx6tJcNAEqz69QZ/VlY 31UyJHdYe5NtBVz+rYZCOVWfpe3crbHuq9FjAPT+xcZefdxridmMKuW8eBmmXI9iZ3EG+X8J IsdLWL8QoqW0lnO1otYz1QDjdOvbEpq+u5/TAU8pgtaYH2J+6/GaQ6hMLyLBkaIAtnqlLCzq pxXcxMsFT14P5/rZA7EbBI8RS1ZIWJBlS2oO+dtVuENLJUC0SpptaRyn/uyOIopt7hSmBekL SzFnet7P9qofFJY+fQEz84v0G1gvwonHGHiCGgLpbMdPtnfPzda1aiTURvvOD7w/RmX1/ogk TqSGO4ejVNO/28QYouxmxzy8jbbIEiLCbHpLR/M/TvYHHPURxcx+MxVl3G+d/4Ihy4abxOdW pe9zLIcVMvqiUFQO28/79Gfhb7G4K+L21ORB82QYkzm3M7ebXQARAQABz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5a RQQCRMXKbGaYhKkYEYiYOGqtTxN+PmyvNUBmFEcagBX2TXqEkgnI6zOnN13mB4SihJ2lne2r 9RNiPYs/hmRxYg== Message-ID: Date: Fri, 30 Mar 2018 00:30:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180329215815.36xxakgujx4luo4m@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 29/03/18 23:58, Andres Freund wrote: > On 2018-03-29 23:52:18 +0200, Tomas Vondra wrote: >>> I have added details about this in src/backend/storage/lmgr/README as >>> suggested by you. >>> >> >> Thanks. I think the README is a good start, but I think we also need to >> improve the comments, which is usually more detailed than the README. >> For example, it's not quite acceptable that LogicalLockTransaction and >> LogicalUnlockTransaction have about no comments, especially when it's >> meant to be public API for decoding plugins. > > FWIW, for me that's ground to not accept the feature. Burdening output > plugins with this will make their development painful (because they'll > have to adapt regularly) and correctness doubful (there's nothing > checking for the lock being skipped). Another way needs to be found. > I have to agree with Andres here. It's also visible in the latter patches. The pgoutput patch forgets to call these new APIs completely. The test_decoding calls them, but it does so even when it's processing changes for committed transaction.. I think that should be avoided as it means potentially doing SLRU lookup for every change. So doing it right is indeed not easy. I as wondering how to hide this. Best idea I had so far would be to put it in heap_beginscan (and index_beginscan given that catalog scans use is as well) behind some condition. That would also improve performance because locking would not need to happen for syscache hits. The problem is however how to inform the heap_beginscan about the fact that we are in 2PC decoding. We definitely don't want to change all the scan apis for this. I wonder if we could add some kind of property to Snapshot which would indicate this fact - logical decoding is using it's own snapshots it could inject the information about being inside the 2PC decoding. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services