Re: PANIC during crash recovery of a recently promoted standby
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Pavan Deolasee <pavan.deolasee@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-05-11T22:41:33Z
Lists: pgsql-hackers
On Fri, May 11, 2018 at 12:09:58PM -0300, Alvaro Herrera wrote: > Yeah, I had this exact comment, but I was unable to come up with a test > case that would cause a problem. pg_ctl promote would wait for the control file to be updated, so you cannot use it in the TAP tests to trigger the promotion. Still I think I found one after waking up? Please note I have not tested it: - Use a custom trigger file and then trigger promotion with a signal. - Use a sleep command in recovery_end_command to increase the window, as what matters is sleeping after CreateEndOfRecoveryRecord updates the control file. - Issue a restart point on the standby, which will update the control file. - Stop the standby with immediate mode. - Start the standby, it should see unreferenced pages. > Hmm. Can we change the control file in released branches? (It should > be possible to make the new server understand both old and new formats, > but I think this is breaking new ground and it looks easy to introduce > more bugs there.) We definitely can't, even if the new value is added at the end of DBState :( A couple of wild ideas, not tested, again after waking up: 1) We could also abuse of existing values by using the existing DB_IN_CRASH_RECOVERY or DB_STARTUP. Still that's not completely true as the cluster may be open for business as a hot standby. 2) Invent a new special value for XLogRecPtr, normally impossible to reach, which uses high bits. -- Michael
Commits
-
Prevent references to invalid relation pages after fresh promotion
- 56535dcdc9e2 9.3.24 landed
- f352f43d3f10 9.4.19 landed
- 23eef5cd7ffc 9.5.14 landed
- 8d68ee6f31ca 9.6.10 landed
- 6716f2f96256 10.5 landed
- 9a1bd8271172 11.0 landed
- 3c64dcb1e35d 12.0 landed