Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUSZy-0000MK-15 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Aug 2016 05:49:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bUSZx-00081P-Ey for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Aug 2016 05:49:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUSZw-00080e-7m for pgsql-hackers@postgresql.org; Tue, 02 Aug 2016 05:49:24 +0000 Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bUSZo-0002Yf-E9 for pgsql-hackers@postgresql.org; Tue, 02 Aug 2016 05:49:23 +0000 Received: by mail-pf0-x22a.google.com with SMTP id h186so62597170pfg.3 for ; Mon, 01 Aug 2016 22:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MaqCZdIf0+8/bCqOiS187bYGO2QhnFnvMkuwE6myaEc=; b=cMzRRkxL3tODmasnOWl49IseGh2TESnAob0kNzCplFy9zP7zNZnihBGfqxu4lawcDf pBK9twncC0hUdpQIik4DDGQyHCCCJ+iOv4sh3uIfd7AdHm23EB3zIrHU/8MGQrNy/OYy HPtd7lxRvzWb5O5FJEwDH5y/gyTjXqkLv9s30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=MaqCZdIf0+8/bCqOiS187bYGO2QhnFnvMkuwE6myaEc=; b=hBYqe/BtpAjlD5d7ZaZl5LAgKz/M/fsgdP1wIZXlMewGu09csLyaaHSWerECml9evo IM1er6C2nu/9thsNmfOyV73IJpub8aV6x8y84Dm5yaBrLVgjeKaaXAjvblMOCNqPvXVI 3sBLiRP4X/QROezU5CJBS8lmmm9qG6Csfjot7CkQbbWe1HBAy81regrBZXHNKxdA+XLd v5FmsBNTWT5kSivmA/kS29QIF3ZugiOymLqSr6gOvsHJezmtKt1zxvQdeGfh98bL0c9D ab2nBKzXFwl38ACI6HPrBG4qF9lyduroVIA2PkuEzu7CkJThxH6EKHdOStwer3sOmZhm EIsg== X-Gm-Message-State: AEkooutJXGWPgInTJo2V6EsmOhiPpzDHvRI58gp6bktyehvYOCrlo9/Q+gFKPx/pXQzNBg== X-Received: by 10.98.93.25 with SMTP id r25mr102443624pfb.122.1470116953616; Mon, 01 Aug 2016 22:49:13 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id ya6sm1344108pab.22.2016.08.01.22.49.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 01 Aug 2016 22:49:12 -0700 (PDT) Date: Tue, 2 Aug 2016 01:49:09 -0400 From: Noah Misch To: Amit Kapila Cc: Andres Freund , Tom Lane , Masahiko Sawada , Alvaro Herrera , Robert Haas , Thomas Munro , Stephen Frost , Michael Paquier , "pgsql-hackers@postgresql.org" Subject: Re: Reviewing freeze map code Message-ID: <20160802054909.GA2308967@tornado.leadboat.com> References: <20160716013203.gni5x6jjnmjajvc6@alap3.anarazel.de> <25549.1468684146@sss.pgh.pa.us> <2E9AE050-767F-40E8-8F09-66BA64E67DE3@anarazel.de> <20160718024829.s3mucbxipk2r4jvp@alap3.anarazel.de> <20160718034352.ddzljwmmsicprknj@alap3.anarazel.de> <20160718083310.jyshh2s4t2xnurka@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Sat, Jul 23, 2016 at 01:25:55PM +0530, Amit Kapila wrote: > On Mon, Jul 18, 2016 at 2:03 PM, Andres Freund wrote: > > On 2016-07-18 10:02:52 +0530, Amit Kapila wrote: > >> Consider the below scenario. > >> > >> Vacuum > >> a. acquires a cleanup lock for page - 10 > >> b. busy in checking visibility of tuples > >> --assume, here it takes some time and in the meantime Session-1 > >> performs step (a) and (b) and start waiting in step- (c) > >> c. marks the page as all-visible (PageSetAllVisible) > >> d. unlockandrelease the buffer > >> > >> Session-1 > >> a. In heap_lock_tuple(), readbuffer for page-10 > >> b. check PageIsAllVisible(), found page is not all-visible, so didn't > >> acquire the visbilitymap_pin > >> c. LockBuffer in ExlusiveMode - here it will wait for vacuum to > >> release the lock > >> d. Got the lock, but now the page is marked as all-visible, so ideally > >> need to recheck the page and acquire the visibilitymap_pin > > > > So, I've tried pretty hard to reproduce that. While the theory above is > > sound, I believe the relevant code-path is essentially dead for SQL > > callable code, because we'll always hold a buffer pin before even > > entering heap_update/heap_lock_tuple. > > > > It is possible that we don't hold any buffer pin before entering > heap_update() and or heap_lock_tuple(). For heap_update(), it is > possible when it enters via simple_heap_update() path. For > heap_lock_tuple(), it is possible for ON CONFLICT DO Update statement > and may be others as well. This is currently listed as a 9.6 open item. Is it indeed a regression in 9.6, or do released versions have the same defect? If it is a 9.6 regression, do you happen to know which commit, or at least which feature, caused it? Thanks, nm -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers