Assert "target_wal_endrec == divergerec" in pg_rewind
Assert "target_wal_endrec == divergerec" in pg_rewind
Hi,
pg_rewind still trips this when the target is a direct ancestor of the
source and stopped earlier on the common timeline.
Assert(target_wal_endrec == divergerec)
An older base backup of the primary is enough to get there.
Assertion builds crash. Otherwise we already say "no rewind
required", which is correct.
Heikki called the Assert bogus in BUG #18575 and posted a remove-it
patch [1], but it never landed. Maxim bumped that thread later [2].
Srinath's recent file-sync / findLastCheckpoint report [3] quotes the
same Assert, though that thread is about the "== divergerec" early
exit, not this "< divergerec" crash.
Attached is a small rebase on current master, with the TAP coverage
folded into "005_same_timeline.pl". No behaviour change outside
assertion builds.
Does this still seem worth committing?
[1] https://www.postgresql.org/message-id/fe7af87d-b9bf-481a-902c-089c49aa911d@iki.fi
[2] https://www.postgresql.org/message-id/a4896a62ceab7167824d48b8f0afe01aef6140aa.camel@arenadata.io
[3] https://www.postgresql.org/message-id/CAFC+b6qpqH4E22-PAemSby8Yv_2Z_8PUy8XrUmpW9Ot_efKdug@mail.gmail.com
Regards,
Stepan Neretin
pg_rewind still trips this when the target is a direct ancestor of the
source and stopped earlier on the common timeline.
Assert(target_wal_endrec == divergerec)
An older base backup of the primary is enough to get there.
Assertion builds crash. Otherwise we already say "no rewind
required", which is correct.
Heikki called the Assert bogus in BUG #18575 and posted a remove-it
patch [1], but it never landed. Maxim bumped that thread later [2].
Srinath's recent file-sync / findLastCheckpoint report [3] quotes the
same Assert, though that thread is about the "== divergerec" early
exit, not this "< divergerec" crash.
Attached is a small rebase on current master, with the TAP coverage
folded into "005_same_timeline.pl". No behaviour change outside
assertion builds.
Does this still seem worth committing?
[1] https://www.postgresql.org/message-id/fe7af87d-b9bf-481a-902c-089c49aa911d@iki.fi
[2] https://www.postgresql.org/message-id/a4896a62ceab7167824d48b8f0afe01aef6140aa.camel@arenadata.io
[3] https://www.postgresql.org/message-id/CAFC+b6qpqH4E22-PAemSby8Yv_2Z_8PUy8XrUmpW9Ot_efKdug@mail.gmail.com
Regards,
Stepan Neretin
Re: Assert "target_wal_endrec == divergerec" in pg_rewind
От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 16 Nov 2026, at 20:13, Stepan Neretin wrote: > Attached is a small rebase on current master, with the TAP coverage > folded into "005_same_timeline.pl". No behaviour change outside > assertion builds. use warnings FATAL => 'all'; +use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; The proposed TAP test breaks the current model where tests use the infrastructure in the RewindTest module. Is there a reason why this test should be different? > Does this still seem worth committing? From reading over the thread in which Heikki concluded it was a bogus Assert, I'd say it's still worth committing. I do think the TAP test should be in line with the other pg_rewind tests though. -- Daniel Gustafsson
Re: Assert "target_wal_endrec == divergerec" in pg_rewind
От:
Stepan Neretin <slpmcf@gmail.com>
Дата:
On Fri, Nov 20, 2026 at 2:48 AM Daniel Gustafsson <daniel@yesql.se> wrote:
> On 16 Nov 2026, at 20:13, Stepan Neretin <slpmcf@gmail.com> wrote:
> Attached is a small rebase on current master, with the TAP coverage
> folded into "005_same_timeline.pl". No behaviour change outside
> assertion builds.
use warnings FATAL => 'all';
+use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
The proposed TAP test breaks the current model where tests use the
infrastructure in the RewindTest module. Is there a reason why this test
should be different?
> Does this still seem worth committing?
From reading over the thread in which Heikki concluded it was a bogus Assert,
I'd say it's still worth committing. I do think the TAP test should be in line
with the other pg_rewind tests though.
--
Daniel Gustafsson
Hi Daniel,
Thanks for looking. Folding this into 005 was a mistake.
RewindTest is the usual primary/standby/promote/rewind cycle, and this
needs an older base backup as the target. Same reason 008 skips it. v2
leaves 005 alone and puts the coverage in 012_target_is_ancestor.pl,
along the lines of Heikki's earlier test.
Assert fix itself is unchanged.
Attached.
Thanks for looking. Folding this into 005 was a mistake.
RewindTest is the usual primary/standby/promote/rewind cycle, and this
needs an older base backup as the target. Same reason 008 skips it. v2
leaves 005 alone and puts the coverage in 012_target_is_ancestor.pl,
along the lines of Heikki's earlier test.
Assert fix itself is unchanged.
Attached.
Re: Assert "target_wal_endrec == divergerec" in pg_rewind
On Fri, Nov 20, 2026 at 2:48 AM Daniel Gustafsson <daniel@yesql.se> wrote:
> On 16 Nov 2026, at 20:13, Stepan Neretin <slpmcf@gmail.com> wrote:
> Attached is a small rebase on current master, with the TAP coverage
> folded into "005_same_timeline.pl". No behaviour change outside
> assertion builds.
use warnings FATAL => 'all';
+use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
The proposed TAP test breaks the current model where tests use the
infrastructure in the RewindTest module. Is there a reason why this test
should be different?
> Does this still seem worth committing?
From reading over the thread in which Heikki concluded it was a bogus Assert,
I'd say it's still worth committing. I do think the TAP test should be in line
with the other pg_rewind tests though.
--
Daniel Gustafsson
Hi Daniel,
Thanks for looking. Folding this into 005 was a mistake.
RewindTest is the usual primary/standby/promote/rewind cycle, and this
needs an older base backup as the target. Same reason 008 skips it. v2
leaves 005 alone and puts the coverage in 012_target_is_ancestor.pl,
along the lines of Heikki's earlier test.
Assert fix itself is unchanged.
Attached.
Regards,
Stepan Neretin
Thanks for looking. Folding this into 005 was a mistake.
RewindTest is the usual primary/standby/promote/rewind cycle, and this
needs an older base backup as the target. Same reason 008 skips it. v2
leaves 005 alone and puts the coverage in 012_target_is_ancestor.pl,
along the lines of Heikki's earlier test.
Assert fix itself is unchanged.
Attached.
Regards,
Stepan Neretin
Re: Assert "target_wal_endrec == divergerec" in pg_rewind
On Thu, Nov 19, 2026 at 08:47:51PM +0100, Daniel Gustafsson wrote: > From reading over the thread in which Heikki concluded it was a bogus Assert, > I'd say it's still worth committing. I do think the TAP test should be in line > with the other pg_rewind tests though. Dropping the assertion sounds good. My first impression about the test was that it did not seem like it was worth the cycles, but I'm convinced by its coverage on closer read: cases for direct ancestors based on backups are interesting to have. -- Michael
Re: Assert "target_wal_endrec == divergerec" in pg_rewind
От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 20 Nov 2026, at 08:56, Michael Paquier wrote: > > On Thu, Nov 19, 2026 at 08:47:51PM +0100, Daniel Gustafsson wrote: >> From reading over the thread in which Heikki concluded it was a bogus Assert, >> I'd say it's still worth committing. I do think the TAP test should be in line >> with the other pg_rewind tests though. > > Dropping the assertion sounds good. Thanks for confirming, I'll go ahead with this. > My first impression about the test was that it did not seem like it > was worth the cycles, but I'm convinced by its coverage on closer > read: cases for direct ancestors based on backups are interesting to > have. That was my initial reaction too, but I also came to the conclusion that this test does in fact cover a case which doesn't have good coverage today. -- Daniel Gustafsson