mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Fix LagTrackerRead() for timeline increments
Bug was masked by error in running 004_timeline_switch.pl that was
fixed recently in 7d68f2281a.
Detective work by Alvaro Herrera and Tom Lane
Author: Thomas Munro
This commit is contained in:
parent
0874d4f3e1
commit
8463880872
1 changed files with 10 additions and 1 deletions
|
|
@ -3328,7 +3328,16 @@ LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now)
|
|||
WalTimeSample prev = LagTracker.last_read[head];
|
||||
WalTimeSample next = LagTracker.buffer[LagTracker.read_heads[head]];
|
||||
|
||||
Assert(lsn >= prev.lsn);
|
||||
if (lsn < prev.lsn)
|
||||
{
|
||||
/*
|
||||
* Reported LSNs shouldn't normally go backwards, but it's
|
||||
* possible when there is a timeline change. Treat as not
|
||||
* found.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
Assert(prev.lsn < next.lsn);
|
||||
|
||||
if (prev.time > next.time)
|
||||
|
|
|
|||
Loading…
Reference in a new issue