pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stas Kelvich <s.kelvich@postgrespro.ru>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Global snapshots
Date: Sun, 6 May 2018 13:22:57 +0300
Message-ID: <D963AFAB-1FA5-4FE7-A5A2-AC37D728564C@postgrespro.ru> (raw)
In-Reply-To: <CA+Tgmob=fJo-pwGsnQT+PBoHyhNM4Giw3y5LXBm0YLhWvKEm1g@mail.gmail.com>
References: <21BC916B-80A1-43BF-8650-3363CCDAE09C@postgrespro.ru>
	<CA+TgmoazjBL1D-hSV-pMYK=g9L-Zc3v0Gh7TiAhMYRzo6nXdSg@mail.gmail.com>
	<5A30884C-F446-40FD-9D86-F4046F29F9F6@postgrespro.ru>
	<CA+Tgmob=fJo-pwGsnQT+PBoHyhNM4Giw3y5LXBm0YLhWvKEm1g@mail.gmail.com>



> On 4 May 2018, at 22:09, Robert Haas <robertmhaas@gmail.com> wrote:
> 
> So, is the idea that we'll definitely find out about any remote
> transactions within 30 seconds, and then after we know about remote
> transactions, we'll hold back OldestXmin some other way?

Yes, kind of. There is a procArray->global_snapshot_xmin variable which
acts as a barrier to xmin calculations in GetOldestXmin and
GetSnapshotData, when set.

Also each second GetSnapshotData writes globalxmin (as it was before
procArray->global_snapshot_xmin was taken into account) into a circle
buffer with a size equal to global_snapshot_defer_time value. That more
or less the same thing as with Snapshot Too Old feature, but with a
bucket size of 1 second instead of 1 minute.
procArray->global_snapshot_xmin is always set to oldest
value in circle buffer.

This way xmin calculation is always gives a value that were
global_snapshot_xmin seconds ago and we have mapping from time (or
GlobalCSN) to globalxmin for each second in this range. So when
some backends imports global snapshot with some GlobalCSN, that
GlobalCSN is mapped to a xmin and this xmin is set as a Proc->xmin.

--
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company






view thread (77+ messages)  latest in thread

Message-ID: <D963AFAB-1FA5-4FE7-A5A2-AC37D728564C@postgrespro.ru>
Permalink:  ../D963AFAB-1FA5-4FE7-A5A2-AC37D728564C@postgrespro.ru/
Also on:    postgresql.org/message-id/D963AFAB-1FA5-4FE7-A5A2-AC37D728564C@postgrespro.ru

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: s.kelvich@postgrespro.ru, robertmhaas@gmail.com
  Subject: Re: Global snapshots
  In-Reply-To: <D963AFAB-1FA5-4FE7-A5A2-AC37D728564C@postgrespro.ru>

* 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