diff options
| author | Simon Riggs | 2017-04-23 20:35:41 +0000 |
|---|---|---|
| committer | Simon Riggs | 2017-04-23 20:35:41 +0000 |
| commit | 8463880872cf8a6fc6bb9a4ad34b84aded7a33e2 (patch) | |
| tree | d6ed1cc2f4ea9a1728004d9167b52f0bb33619e7 /src | |
| parent | 0874d4f3e183757ba15a4b3f3bf563e0393dd9c2 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/replication/walsender.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 26090738fc3..064cf5ee28b 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -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) |
