Re: Transaction Snapshots and Hot Standby

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Simon Riggs <simon(at)2ndQuadrant(dot)com>, Richard Huxton <dev(at)archonet(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Transaction Snapshots and Hot Standby
Date: 2008-09-11 13:19:44
Message-ID: 48C91AF0.7010804@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Csaba Nagy wrote:
> On Thu, 2008-09-11 at 15:42 +0300, Heikki Linnakangas wrote:
>> One problem with this, BTW, is that if there's a continuous stream of
>> medium-length transaction in the slave, each new snapshot taken will
>> prevent progress in the WAL replay, so the WAL replay will advance in
>> "baby steps", and can fall behind indefinitely.
>
> Why would it fall behind indefinitely ? It only should fall behind to
> the "blocking horizon", which should be the start of the longest
> currently running transaction... which should be continually advancing
> and not too far in the past if there are only medium length transactions
> involved.

Well, yes, but you can fall behind indefinitely that way. Imagine that
each transaction on the slave lasts, say 10 minutes, with a new
transaction starting every 5 minutes. On the master, there's a table
that's being vacuumed (or HOT-updated) frequently, say after each
transaction for simplicity. What can happen is that every transaction
that finishes on the slave will only let the WAL replay advance by one
XID before blocking on the snapshot of the next slave transaction. The
WAL replay will advance at a rate of 0.2 TPM, while the master is
generating 1.0 TPM.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2008-09-11 13:26:48 Re: Transaction Snapshots and Hot Standby
Previous Message Jochem van Dieten 2008-09-11 13:17:07 Re: Transaction Snapshots and Hot Standby