Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPuOR-0005qX-0k for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 16:30:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPuOP-0003NR-7z for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 16:30:41 +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 1bPuOO-0003Lz-9P for pgsql-hackers@postgresql.org; Wed, 20 Jul 2016 16:30:40 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bPuOK-00089p-SZ; Wed, 20 Jul 2016 16:30:39 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2340120301; Wed, 20 Jul 2016 12:30:35 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Wed, 20 Jul 2016 12:30:35 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=TT8IQIT1whAXshRgt0pCiHXb1F0=; b=Hy+Sj nAzBL6bSBqOivyqgKR9btiR2f0efGXtuke0YBFm5WoWKCkxOWz9UhL74MqEPyWx5 lrLrrs/Yv97tgSgC8Mfb76kA7aDJfk5ao2reN1WyuReC5n0KqY+yd7nYVxtKPImT uv+KFneJz+L44kIrOWA5lQaFKmmrhaAN2V3LQU= X-Sasl-enc: wGNEqgVVh7ZxviV//94sDtyCB2jow1QeMJmH/tm2FN09 1469032234 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id B484ACC07A; Wed, 20 Jul 2016 12:30:34 -0400 (EDT) Date: Wed, 20 Jul 2016 09:30:33 -0700 From: Andres Freund To: Robert Haas Cc: Amit Kapila , Kevin Grittner , Noah Misch , Alvaro Herrera , Ants Aasma , Kevin Grittner , "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160720163033.4c4ku7orkzl7r4an@alap3.anarazel.de> References: <20160716224808.GB1908970@tornado.leadboat.com> <20160719021047.GB2027798@tornado.leadboat.com> <20160719233250.nir5vyvzef7m4e7z@alap3.anarazel.de> <1AB8F80A-D16E-4154-9497-98FBB164253D@anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) 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 2016-07-20 11:26:11 -0400, Robert Haas wrote: > On Wed, Jul 20, 2016 at 3:39 AM, Andres Freund wrote: > >>I think Snapshot's members whenTaken and lsn are updated/initialized > >>only in GetSnapshotData(). So if GetSnapshotData() is not used, how > >>will you expect those fields to be updated. We need those fields to > >>be updated for TestForOldSnapshot(). > > > > That's why I suggested copying them from the current mvcc snapshot. > > And how do you obtain that? The functions that reference > SnapshotToast are toast_delete_datum, toastrel_value_exists, and > toast_fetch_datum, toast_fetch_datum_slice, but none of those take a > snapshot as an argument, nor is there any reasonable way to make them > do so. Those are indirectly called by things like bttextcmp, which > don't know what snapshot was used to fetch the datum that they are > detoasting and can't reasonably be made to know. > > I mean, you could do something *approximately* correct by calling > GetActiveSnapshot() but that doesn't seem likely to be correct in > detail. GetActiveSnapshot() seems like it should work well enough in this case, or we could use pairingheap_first() to get the actual oldest registered one. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers