Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPm6r-00047h-7y for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 07:40:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPm6q-0004qC-8F for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 07:40:00 +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 1bPm6p-0004py-G2 for pgsql-hackers@postgresql.org; Wed, 20 Jul 2016 07:39:59 +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 1bPm6l-0007Py-TS; Wed, 20 Jul 2016 07:39:59 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id ED0D920297; Wed, 20 Jul 2016 03:39:53 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 20 Jul 2016 03:39:54 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=+4uCTKlK9jxeyvQ zwTmzgsI9EK0=; b=YR2OwhwlFqblMtSCvDcVZrSSy3JclMxnKC6mOJUMIDHRzNK dF4CIJTTfH//x/vt3dkvYT7HTF+UYUov+b2VzFi1FqSEaPgaIqGlJM1T37aL6Qn7 p3H6/R37VeG37q5dXBjQyStuHzmAhN5mjmWF1atKvBfXi97GqQh466nsxBYA= X-Sasl-enc: fJ38ntDRz6Al7HyufS0wrCZ2t2iyLGscZzkpI4YmiR5V 1469000393 Received: from android-ae68c67b940fd203.lan (unknown [192.77.237.104]) by mail.messagingengine.com (Postfix) with ESMTPA id 7ECD8CCDA6; Wed, 20 Jul 2016 03:39:52 -0400 (EDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <20160708185221.ez2hnj4yalxaoqnm@alap3.anarazel.de> <20160713174838.oh53exchsuyxxply@alap3.anarazel.de> <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-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < From: Andres Freund Date: Wed, 20 Jul 2016 00:39:50 -0700 To: Amit Kapila CC: Kevin Grittner ,Noah Misch ,Robert Haas ,Alvaro Herrera ,Ants Aasma ,Kevin Grittner ,"pgsql-hackers@postgresql.org" Message-ID: 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 July 19, 2016 7:43:05 PM PDT, Amit Kapila wrote: >On Wed, Jul 20, 2016 at 7:57 AM, Andres Freund >wrote: >> >> >> On July 19, 2016 7:14:42 PM PDT, Amit Kapila > wrote: >>>On Wed, Jul 20, 2016 at 5:02 AM, Andres Freund >>>wrote: >>>> On 2016-07-19 18:09:59 -0500, Kevin Grittner wrote: >>>>> As far as I can see, to do this the way that Andres and Amit >>>>> suggest involves tying in to indexam.c and other code in >incredibly >>>>> ugly ways. >>>> >>>> Could you explain the problem you're seing? >>>> >>>> Isn't pretty much all all that we need to do: >>>> 1) add a InitSnapshotToast(Snapshot originMVCCSnap), which sets >>>SnapshotData->lsn >>>> to the the origin snapshot's lsn >>>> 2) adapt TestForOldSnapshot() to accept both HeapTupleSatisfiesMVCC >>>and >>>> HeapTupleSatisfiesToast? >>>> >>> >>>I also think so. However, it is not clear what is the best place to >>>initialize toast snapshot. One idea could be to do it in >>>GetSnapshotData() after capturing the required information for the >>>valid value of old_snapshot_threshold. Do you have something else in >>>mind? >> >> There's very few callsites using toast snapshots. I'd just do it >there. Don't think we ever use GetSnapshotData for them. >> > >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. Andres -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers