Re: failures in t/031_recovery_conflict.pl on CI
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@gmail.com>
Date: 2022-04-29T20:08:09Z
Lists: pgsql-hackers
Attachments
Hi,
Attached are patches for this issue.
It adds a test case for deadlock conflicts to make sure that case isn't
broken. I also tested the recovery conflict tests in the back branches, and
they work there with a reasonably small set of changes.
Questions:
- I'm planning to backpatch the test as 031_recovery_conflict.pl, even though
preceding numbers are unused. It seems way more problematic to use a
different number in the backbranches than have gaps?
- The test uses pump_until() and wait_for_log(), which don't exist in the
backbranches. For now I've just inlined the implementation, but I guess we
could also backpatch their introduction?
- There's a few incompatibilities in the test with older branches:
- older branches don't have allow_in_place_tablespaces - I think just
skipping tablespace conflicts is fine, they're comparatively
simple.
Eventually it might make sense to backpatch allow_in_place_tablespaces,
our test coverage in the area is quite poor.
- the stats tests can't easily made reliably in the backbranches - which is
ok, as the conflict itself is verified via the log
- some branches don't have log_recovery_conflict_waits, since it's not
critical to the test, it's ok to just not include it there
I played with the idea of handling the differences using version comparisons
in the code, and have the test be identically across branches. Since it's
something we don't do so far, I'm leaning against it, but ...
> - For HEAD we have to replace the disable_all_timeouts() calls, it breaks the
> replay progress reporting. Is there a reason to keep them in the
> backbranches? Hard to see how an extension or something could rely on it,
> but ...?
I've left it as is for now, will start a separate thread.
> - There's the following comment in ResolveRecoveryConflictWithBufferPin():
>
> "We assume that only UnpinBuffer() and the timeout requests established
> above can wake us up here."
>
> That bogus afaict? There's plenty other things that can cause MyProc->latch
> to be set. Is it worth doing something about this at the same time? Right
> now we seem to call ResolveRecoveryConflictWithBufferPin() in rapid
> succession initially.
The comment is more recent than I had realized. I raised this separately in
https://postgr.es/m/20220429191815.xewxjlpmq7mxhsr2%40alap3.anarazel.de
pgindent uses some crazy formatting nearby:
SendRecoveryConflictWithBufferPin(
PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK);
I'm tempted to clean that up in passing by having just one
SendRecoveryConflictWithBufferPin() call instead of two, storing the type of
conflict in a local variable? Doesn't look entirely pretty either, but ...
I'm very doubtful of this claim above ResolveRecoveryConflictWithBufferPin(),
btw. But that'd be a non-backpatchable cleanup, I think:
* The ProcWaitForSignal() sleep normally done in LockBufferForCleanup()
* (when not InHotStandby) is performed here, for code clarity.
Greetings,
Andres Freund
Commits
-
Disable 031_recovery_conflict.pl until after minor releases.
- 390b489eff76 10.21 landed
- 4caa29414d60 11.16 landed
- 1e1542833e8c 12.11 landed
- 6348e4685068 13.7 landed
- 55e5a5e0fa16 14.3 landed
-
Temporarily skip recovery deadlock test in back branches.
- 441fa7a63ad4 10.21 landed
- fb965ab0f641 11.16 landed
- 26f9e21cb63e 12.11 landed
- 4e39957e6eb5 13.7 landed
- f40d362a667f 14.3 landed
-
Backpatch addition of pump_until() more completely.
- 47f47a8d4738 11.16 landed
- fbf659bc4040 12.11 landed
- 6ab90d215afc 13.7 landed
- 7fa95bb0ac8e 14.3 landed
-
Fix timing issue in deadlock recovery conflict test.
- 3197e0f5ae9d 10.21 landed
- 7a1267f9fe74 11.16 landed
- 512d76f6dbda 12.11 landed
- 8a3a8d9f103e 13.7 landed
- 5136967f1eb1 14.3 landed
- 9e6b7b45ca92 15.0 landed
-
Backpatch 031_recovery_conflict.pl.
- b1f35a36e6d5 10.21 landed
- 25d5494e2841 11.16 landed
- a5ede13916f3 12.11 landed
- 0446d3bf3909 13.7 landed
- f74496dd611e 14.3 landed
-
Fix possibility of self-deadlock in ResolveRecoveryConflictWithBufferPin().
- cbc47ad7ef60 10.21 landed
- 9cda785b4ea3 11.16 landed
- edfc03ec91f2 12.11 landed
- 57c5ad168be1 13.7 landed
- 9ab3b2bdbb5d 14.3 landed
- 8f1537d10e83 15.0 landed
-
Backpatch addition of wait_for_log(), pump_until().
- e8a0cf9b20a1 10.21 landed
- 2adb8debe5aa 11.16 landed
- 90abe1e17f9d 13.7 landed
- 5c8b14a71d31 12.11 landed
- 5ab8e8014801 14.3 landed
-
Add tests for recovery deadlock conflicts.
- 21e184403bf9 15.0 landed
-
Phase 3 of pgindent updates.
- 382ceffdf7f6 10.0 cited