Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPvjy-0001af-TS for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 17:57:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPvjy-0006b7-BR for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 17:57:02 +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 1bPvjq-0006S2-8k for pgsql-hackers@postgresql.org; Wed, 20 Jul 2016 17:56:54 +0000 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bPvjm-0001Di-R7 for pgsql-hackers@postgresql.org; Wed, 20 Jul 2016 17:56:53 +0000 Received: by mail-qk0-x236.google.com with SMTP id p74so52394425qka.0 for ; Wed, 20 Jul 2016 10:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=t6NrK7rJoYlmh2s8JxbpNeq6ToxFfRkPDQ5StAMOLQw=; b=M9YjO44+jHIMXcoN886XQ5wYTm/ZXp5odyPcLLJc+lXT7bc51pr/DPVkD1Dc7NA65O JfutGNiriht6mKhjDTWUXZGXnKU57fdqSqXhTacVAmmHiHm6aG7JMAPiA+rLgLCgedrc gnjHRN4p0Jy8YAEnA9umfHbuc2A8p8iLm6MIEToVAJOgClUJ/RqI2ZtcO0xHYZOu+RdU U5aVoDRjxSrzoSztNu9IEBg3yjoOkoulZmQnHVClURAVM4yAM9rRNnH46CiYa+9N9lTt Jr6LQ9AEN+j24upwSw9SKK6+s+QXqEYudJcadNyjaqUOH7pO7XkMn+tKdy5I43VTifEn xe0g== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=t6NrK7rJoYlmh2s8JxbpNeq6ToxFfRkPDQ5StAMOLQw=; b=CE56cqA8izeBeneRrpDeQ/fjGELqXcW2/F3hIhwZjp9D7gtHQN+ns/bhkXupqEalfo mkX4tSSiq5/YOLHSQMC8DR8zpyN62n0pihUThld/FbU3MVyvyDTD3uP2MaGrBkoZA9HZ OUd4iqsyHC7RZ++Wa89XBajln5rT4gXZSlzrdoEPnxu73o8wnMklNvRG5EyOpau1TC2E uGqia6LHYYWDI1SvybN+n2UmsTrTZr/Xtmn8iE5qN42Vjv35jYwYSg3piO7LMnBrX8Rc fSYxcM438+RIcQOPzB97auOGhmwE9rLXp9VJa+qCv7VqjSTvMv+jp8vpZGLQGeilTbYU YuAg== X-Gm-Message-State: ALyK8tK39JLCOl+pzskPAWLJI85UC1lyhwL8J+zQghn5J9GcomKpoLOU4C6+yR30GJNLrV4R X-Received: by 10.55.8.2 with SMTP id 2mr63290583qki.122.1469037407925; Wed, 20 Jul 2016 10:56:47 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([186.37.75.110]) by smtp.gmail.com with ESMTPSA id i65sm2009723qtb.18.2016.07.20.10.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 10:56:47 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 566B74CC; Wed, 20 Jul 2016 13:56:19 -0400 (CLT) Date: Wed, 20 Jul 2016 13:56:19 -0400 From: Alvaro Herrera To: Andres Freund Cc: Robert Haas , Amit Kapila , Kevin Grittner , Noah Misch , Ants Aasma , Kevin Grittner , "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160720175619.GA662410@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160720163033.4c4ku7orkzl7r4an@alap3.anarazel.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) 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 Andres Freund wrote: > 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. Hmm. Why is the active snapshot not sufficient? Perhaps we need some kind of redesign or minor tweak to snapmgr to keep track of the oldest snapshot of a resowner or something like that? -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers