Re: Corner-case bug in pg_rewind
Pavel Borisov <pashkin.elfe@gmail.com>
From: Pavel Borisov <pashkin.elfe@gmail.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Ian Barwick <ian.barwick@2ndquadrant.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2020-11-10T09:06:46Z
Lists: pgsql-hackers
I did some effort to review your patch which seems legit to me. I think some minor things are better to be improved i.e. 1. Comment regarding ------ 347 * Check for the possibility that the target is in fact a direct 348 * ancestor of the source. In that case, there is no divergent history 349 * in the target that needs rewinding. ------ are better be reformulated as overall block contents are mostly cover vice versa case of a target NOT being a direct ancestor of the source. Maybe: "We need rewind in cases when .... and don't need only if the target is a direct ancestor of the source." I think it will be more understandable if it would be a commentary with descriptions of all cases in the block or no commentary before the block at all with commentaries of these cases on each if/else inside the block instead. 2. When I do the test with no patching of pg_rewind.c I get the output: ----- # Failed test 'pg_rewind detects rewind needed stderr /(?^:rewinding from last common checkpoint at)/' # at t/007_min_recovery_point.pl line 107. # 'pg_rewind: servers diverged at WAL location 0/3000180 on timeline 2 # pg_rewind: no rewind required # ' # doesn't match '(?^:rewinding from last common checkpoint at)' # Looks like you failed 1 test of 2. t/007_min_recovery_point.pl .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests Test Summary Report ------------------- t/007_min_recovery_point.pl (Wstat: 256 Tests: 2 Failed: 1) Failed test: 2 Non-zero exit status: 1 ------- Maybe it can just give "failed" without so many details? Also, I think Heikki's notion could be fulfilled. Apart from this I consider the patch clean, clear, tests are passes and I'd recommend it to commit after a minor improvement described. Thank you! -- Best regards, Pavel Borisov Postgres Professional: http://postgrespro.com <http://www.postgrespro.com>
Commits
-
Fix more race conditions in the newly-added pg_rewind test.
- beb6b45ab747 9.5.25 landed
- 3ea8e660c0e0 9.6.21 landed
- d137b14c3cec 10.16 landed
- 10d9c9d03cfe 11.11 landed
- 98f8cdd48cc5 12.6 landed
- e6dc04d436f1 13.2 landed
- 6ba581cf1104 14.0 landed
-
Fix race conditions in newly-added test.
- 36a4ac20fcf3 14.0 landed
- 1dd608bbac28 9.5.25 landed
- a075c84f2ce1 9.6.21 landed
- 45d363145094 10.16 landed
- cda50f2112f2 11.11 landed
- ad3fb04b9cc2 12.6 landed
- e41a2efbca10 13.2 landed
-
Fix pg_rewind bugs when rewinding a standby server.
- 81e3c868f891 9.5.25 landed
- 0740857de780 9.6.21 landed
- 8b5c353ecec8 10.16 landed
- 63e316f0bc1d 11.11 landed
- 020f153dbb48 12.6 landed
- abd0abfb749d 13.2 landed
- 2b4f3130382f 14.0 landed
-
Allow pg_rewind to use a standby server as the source system.
- 9c4f5192f69e 14.0 cited
-
Support clean switchover.
- 985bd7d49726 9.4.0 cited