Re: Transaction Snapshots and Hot Standby

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Transaction Snapshots and Hot Standby
Date: 2008-09-15 11:04:01
Message-ID: 1221476641.3913.1280.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Sat, 2008-09-13 at 10:48 +0100, Florian G. Pflug wrote:

> The current read-only snapshot (which "current" meaning the
> corresponding state on the master at the time the last replayed wal
> record was generated) was maintained in shared memory. It' xmin field
> was continually updated with the (newly added) XLogRecord.xl_xmin
> field, which contained the xid of the oldest running query on the
> master, with a pruning step after each ReadOnlySnapshot.xmin update to
> remove all entries < xmin from the xid array. If a commit was seen for
> an xid, that xid was added to the ReadOnlySnapshot.xid array.
>
> The advantage of this concept is that it handles snapshotting on the
> slave without too much additional work for the master (The only change
> is the addition of the xl_xmin field to XLogRecord). It especially
> removes that need to track ShmemVariableCache->nextXid.

Snapshots only need to know which transactions are currently "running"
during WAL apply. The standby can't remove any tuples itself, so it
doesn't need to know what the master's OldestXmin is.

So passing xl_xmin from master to standby seems not necessary to me. The
standby's OldestXmin needs to be passed through to the master, not the
other way around so that WAL records for tuple removal are not
generated.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2008-09-15 11:52:11 Re: Review Report: propose to include 3 new functions into intarray and intagg
Previous Message Simon Riggs 2008-09-15 10:59:40 Re: no XLOG during COPY?