From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Kevin Grittner <kgrittn@gmail.com>
Cc: Kevin Grittner <kgrittn@postgresql.org>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Date: Wed, 13 Apr 2016 08:08:39 -0700
Message-ID: <20160413150839.mevdlgekizxyjhc5@alap3.anarazel.de> (raw)
In-Reply-To: <20160413140821.GA6568@alvherre.pgsql>
References: <CA+TgmoZqN0xevR+1pZ6j-99-ZCBoOphr-23tiREb+QW1Eu=KOA@mail.gmail.com>
<20160413140821.GA6568@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 2016-04-13 11:08:21 -0300, Alvaro Herrera wrote:
> The patch being proposed for commit is fiddly architecture-specific
> stuff which is likely to destabilize the tree for quite some time, and
> cause lots of additional work to Andres and anyone else likely to work
> on such low-level details, such as Robert, both of which already have
> plenty to do.
Personally I think this is an 9.6 open-item, and primarily Kevin has to
work on it.
Note that there really shouldn't be too much fiddly bits, we've already
had 64bit atomics, just no fallback. This is just copying the fallback
code from 32bit atomics to 64bit atomics.
But what I'm actually proposing isn't even using the 64bit atomics from
that patch, just to add
inline patch 1: src/include/port/atomics/arch-ppc.h (+3/-0 lines) download inline-1.patch--- a/src/include/port/atomics/arch-ppc.h+++ b/src/include/port/atomics/arch-ppc.h@@ -24,3 +24,6 @@
#define pg_read_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory")
#define pg_write_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory")
#endif
++/* per architecture manual doubleword accesses have single copy atomicity */+#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY
to the appropriate files (ia64, ppc, x86) and then add an #ifndef
PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY to GetXLogInsertRecPtr's acquisition
of the spinlock. I.e.
#ifndef PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY
SpinLockAcquire(&Insert->insertpos_lck);
#endif
current_bytepos = Insert->CurrBytePos;
#ifndef PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY
SpinLockRelease(&Insert->insertpos_lck);
#endif
not because I think it's perfectly pretty that way, but because it's
very easy to demonstrate that there's no regressions for anybody.
> The regression only seems to show up if you turn it on and have a
> crazily high rate of read-only transactions. I think this can wait
> for 9.7.
I don't think 120k read tps is all that high anymore these days. And you
can easily create scenarios that are *much* worse than pgbench. E.g. a
loop in a volatile plpgsql function will acquire
Greetings,
Andres Freund
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, alvherre@2ndquadrant.com, robertmhaas@gmail.com, noah@leadboat.com, kgrittn@gmail.com, kgrittn@postgresql.org, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
In-Reply-To: <20160413150839.mevdlgekizxyjhc5@alap3.anarazel.de>
References: <CA+TgmoZqN0xevR+1pZ6j-99-ZCBoOphr-23tiREb+QW1Eu=KOA@mail.gmail.com> <20160413140821.GA6568@alvherre.pgsql> <20160413150839.mevdlgekizxyjhc5@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox