forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitad3fb04
committed
Fix race conditions in newly-added test.
Buildfarm has been failing sporadically on the new test. I was able toreproduce this by adding a random 0-10 s delay in the walreceiver, justbefore it connects to the primary. There's a race condition where node_3is promoted before it has fully caught up with node_1, leading to divergedtimelines. When node_1 is later reconfigured as standby following node_3,it fails to catch up:LOG: primary server contains no more WAL on requested timeline 1LOG: new timeline 2 forked off current database system timeline 1 before current recovery point 0/30000A0That's the situation where you'd need to use pg_rewind, but in this caseit happens already when we are just setting up the actual pg_rewindscenario we want to test, so change the test so that it waits untilnode_3 is connected and fully caught up before promoting it, so that youget a clean, controlled failover.Also rewrite some of the comments, for clarity. The existing commentsdetailed what each step in the test did, but didn't give a good overviewof the situation the steps were trying to create.For reasons I don't understand, the test setup had to be written slightlydifferently in 9.6 and 9.5 than in later versions. The 9.5/9.6 versionneeded node 1 to be reinitialized from backup, whereas in later versionsit could be shut down and reconfigured to be a standby. But even 9.5 shouldsupport "clean switchover", where primary makes sure that pending WAL isreplicated to standby on shutdown. It would be nice to figure out what'sgoing on there, but that's independent of pg_rewind and the scenario thatthis test tests.Discussion:https://www.postgresql.org/message-id/b0a3b95b-82d2-6089-6892-40570f8c5e60%40iki.fi1 parentf3f033a commitad3fb04
1 file changed
+20
-13
lines changedLines changed: 20 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
53 |
| - | |
54 |
| - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
55 | 56 |
| |
56 | 57 |
| |
57 | 58 |
| |
58 |
| - | |
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
65 | 64 |
| |
66 | 65 |
| |
67 | 66 |
| |
68 | 67 |
| |
69 | 68 |
| |
70 |
| - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
71 | 72 |
| |
| 73 | + | |
| 74 | + | |
| 75 | + | |
72 | 76 |
| |
73 |
| - | |
74 |
| - | |
75 | 77 |
| |
76 | 78 |
| |
77 |
| - | |
78 |
| - | |
| 79 | + | |
79 | 80 |
| |
80 |
| - | |
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
87 |
| - | |
88 |
| - | |
| 87 | + | |
89 | 88 |
| |
90 | 89 |
| |
91 | 90 |
| |
92 | 91 |
| |
93 | 92 |
| |
94 |
| - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 |
| |
96 | 101 |
| |
97 | 102 |
| |
| 103 | + | |
98 | 104 |
| |
99 | 105 |
| |
100 | 106 |
| |
| 107 | + | |
101 | 108 |
| |
102 | 109 |
| |
103 | 110 |
| |
|
0 commit comments
Comments
(0)