Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axFZj-0007iJ-CE for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2016 15:15:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1axFZi-0005u8-Us for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2016 15:15:54 +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 1axFZh-0005sY-AC for pgsql-hackers@postgresql.org; Mon, 02 May 2016 15:15:53 +0000 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1axFZV-0004lR-LJ for pgsql-hackers@postgresql.org; Mon, 02 May 2016 15:15:52 +0000 Received: by mail-lf0-x230.google.com with SMTP id u64so191274202lff.3 for ; Mon, 02 May 2016 08:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=kv7mzh7Q8JJ3Ru4sZUaYB3Wwsq3ZXX9lwl/J8BHUOzM=; b=JOCTd5r14vO+smWvvmlWKT1SfFSqjWWn7CFde83cdRL9xV+WNS0wOiEbOLg2rKdHeK oSKh7RZ6nFuZMMVeA3kNzzBm8PX1/v7MLTM4c85PXw5OY78dp0KkJqPXgezka2lUNH0Q Cr58vGx/Fqju1Y15GZ03wqavNfBl3Ln7isLxRRHTNhZ34Gswg546Qy8hgVuDqUQo8KzX QKnZPTKxqFHM6MP96zaNu13LOOhKu3fb3pQ0rXgibZV/whkCDYYwb0iz4G3BlgztLx6P 2xfXJ9ygfyU6gHwIDo54H/NKBgNMayT3a0z+1R6aaV5ltdRIFqkDfXH0087o5L3sDeR0 qG1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=kv7mzh7Q8JJ3Ru4sZUaYB3Wwsq3ZXX9lwl/J8BHUOzM=; b=lP+KdFnNdanKna6G79dtjF0HCBfDT8vXpGlJyfxdN/tQxqvIkl2SciLfkMgUENzLgu K0nid1JFvEAn6F6dwebCMpm+y6AqZgMZtJZCCOndcxuVNfDhO3cLJCxYH81yOIiAqaWs FHwzqF1e3HQLCd3NZH8hphyJUymEpHeJWGuFVKOB/0qQP6gVbBLgBwQtXL9wlYoKWjDr 3QB3V6CWV1Jrdwio5pRS3or/u+Y5Oib0PuZZAs1gBVSHHvxzGWCwLZqXvV64IQO1JRHH 5o8K9x22zlz1Ub4nm6o4acHD8aH/QavTpVCHNTwBrpPbEVJAHnDvN1e6Z0f42qsnS4KN vyUQ== X-Gm-Message-State: AOPr4FUu9Jwrp/OVfbDK30eaJbPnVLK36koUBephm2XbpJ0ouZ1gCPCcVUXwTyufs6P8iafVlfnrBBgXDfuKhQ== MIME-Version: 1.0 X-Received: by 10.112.30.131 with SMTP id s3mr12526683lbh.124.1462202140793; Mon, 02 May 2016 08:15:40 -0700 (PDT) Received: by 10.25.209.8 with HTTP; Mon, 2 May 2016 08:15:40 -0700 (PDT) In-Reply-To: <500986603.206741.1462198885924@RIA> References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de> <171569342.34745.1461078735421@RIA> <1837416819.81786.1461248181440@RIA> <500986603.206741.1462198885924@RIA> Date: Mon, 2 May 2016 18:15:40 +0300 X-Google-Sender-Auth: ATuGU51L-7Efqli6SWfcOCd2H94 Message-ID: Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < From: Ants Aasma To: Andres Freund Cc: Robert Haas , Kevin Grittner , Amit Kapila , Noah Misch , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.4 (--) 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 Mon, May 2, 2016 at 5:21 PM, Andres Freund wrote: > On 2016-05-02 09:03:19 -0400, Robert Haas wrote: >> On Fri, Apr 29, 2016 at 6:08 PM, Kevin Grittner wrote: >> > Now to continue with the performance benchmarks. I'm pretty sure >> > we've fixed the problems when the feature is disabled >> > (old_snapshot_threshold = -1), and there are several suggestions >> > for improving performance while it is on that need to be compared >> > and benchmarked. >> >> If anyone thinks that the issue with the feature disabled is NOT >> fixed, please speak up! I'm moving the corresponding open item to >> CLOSE_WAIT status, meaning that it will be closed if nobody shows up >> to say that there is still an issue. > > Well, I don't agree that the feature is in a releaseable state. The > datastructure is pretty much non-scalable, and maintained on the wrong > side (every read, instead of once in writing writing xacts). There's no > proposal actually addressing the scalability issues. Unless I'm missing something fundamental the feature only requires tracking an upper bound on xmin observed by snapshots between clock ticks. The simplest way to do this would be a periodic process that increments a clock counter (32bit counter would be plenty) and then calculates xmin for the preceding range. With this scheme GetSnapshotData would need two atomic fetches to get current LSN and the timestamp. Test for old snapshot can also run completely lock free with a single atomic fetch of threshold timestamp. The negative side is that we need to have a process running that runs the clock ticks and the ticks may sometimes be late. Giving something like autovacuum launcher this task doesn't seem too bad and the consequence of falling behind is just delayed timing out of old snapshots. As far as I can see this approach would get rid of any scalability issues, but it is a pretty significant change and requires 64bit atomic reads to get rid of contention on xlog insert lock. Regards, Ants Aasma -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers