Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop
Date
Msg-id 1271688445.8305.18966.camel@ebony
Whole thread Raw
In response to Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop
List pgsql-hackers
On Mon, 2010-04-19 at 17:44 +0300, Heikki Linnakangas wrote:

> > Choices are
> > 
> > 1. Check RecoveryInProgress() once outside of lock, plus wild rumour of
> > Murphy
> > 
> > 2. Check RecoveryInProgress() before and after holding lock
> > 
> > 3. Check RecoveryInProgress() while holding lock
> 
> 4. Check RecoveryInProgress() once outside of lock, and scan the
> ProcArray anyway, just in case. That's what we did before this patch.
> Document that takenDuringRecovery == true means that the snapshot was
> most likely taken during recovery, but there is some race conditions
> where takenDuringRecovery is true even though the snapshot was taken
> just after recovery finished. AFAICS all of the other current uses of
> takenDuringRecovery work fine with that.

Checking RecoveryInProgress() is much cheaper than scanning the whole
ProcArray, so (4) is definitely worse than 1-3.

-- Simon Riggs           www.2ndQuadrant.com



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop
Next
From: Robert Haas
Date:
Subject: Re: Thread safety and libxml2