- Notifications
You must be signed in to change notification settings - Fork5k
Commited48e35
committed
Clean up TAP tests' usage of wait_for_catchup().
By default, wait_for_catchup() waits for the replication connectionto reach the primary's write LSN. That's fine, but in an apparentattempt to save one query round-trip, it was coded so that weexecuted pg_current_wal_lsn() again during each probe query.Thus, we presented the standby with a moving target to be reached.(While the test script itself couldn't be causing the write LSNto advance while it's blocked in wait_for_catchup(), it's plentyplausible that background activity such as autovacuum is emittingmore WAL.) That could make the test take longer than necessary,and potentially it could mask bugs by allowing the standby to processmore WAL than a strict interpretation of the test scenario allows.So, change wait_for_catchup() to do it "by the book", explicitlycollecting the write LSN to wait for at the outset.Also, various call sites were instructing wait_for_catchup() towait for the standby to reach the primary's insert LSN rather thanits write LSN. This also seems like a bad idea. While in mosttest scenarios those are the same, if they are different then theinserted-but-not-yet-written WAL is not presently available to thestandby. The test isn't doing anything to make it become so, soagain we have the potential for unwanted test delay, perhaps evena test timeout. (Again, background activity would be needed tomake this more than a hypothetical problem.) Hence, change thecallers where necessary so that the wait target is always theprimary's write LSN.While at it, simplify callers by making use of wait_for_catchup'sdefault arguments wherever possible (the preceding change makesthis possible in more places than it was before). And rewritewait_for_catchup's documentation a bit.Patch by me; thanks to Julien Rouhaud for review.Discussion:https://postgr.es/m/2368336.1641843098@sss.pgh.pa.us1 parent269b532 commited48e35
File tree
13 files changed
+59
-84
lines changed- src
- bin
- pg_basebackup/t
- pg_rewind/t
- test
- perl/PostgreSQL/Test
- recovery/t
13 files changed
+59
-84
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
290 | 290 |
| |
291 | 291 |
| |
292 | 292 |
| |
293 |
| - | |
| 293 | + | |
294 | 294 |
| |
295 | 295 |
| |
296 | 296 |
| |
|
Lines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
74 | 74 |
| |
75 | 75 |
| |
76 | 76 |
| |
77 |
| - | |
| 77 | + | |
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
96 |
| - | |
97 |
| - | |
| 96 | + | |
98 | 97 |
| |
99 | 98 |
| |
100 | 99 |
| |
| |||
161 | 160 |
| |
162 | 161 |
| |
163 | 162 |
| |
164 |
| - | |
165 |
| - | |
| 163 | + | |
166 | 164 |
| |
167 | 165 |
| |
168 | 166 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
72 |
| - | |
73 |
| - | |
| 72 | + | |
74 | 73 |
| |
75 | 74 |
| |
76 | 75 |
| |
| |||
106 | 105 |
| |
107 | 106 |
| |
108 | 107 |
| |
109 |
| - | |
110 |
| - | |
| 108 | + | |
111 | 109 |
| |
112 | 110 |
| |
113 | 111 |
| |
|
Lines changed: 19 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2496 | 2496 |
| |
2497 | 2497 |
| |
2498 | 2498 |
| |
2499 |
| - | |
2500 |
| - | |
2501 |
| - | |
2502 |
| - | |
2503 |
| - | |
2504 |
| - | |
2505 |
| - | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
2506 | 2514 |
| |
2507 | 2515 |
| |
2508 | 2516 |
| |
2509 | 2517 |
| |
2510 | 2518 |
| |
2511 | 2519 |
| |
2512 |
| - | |
2513 |
| - | |
2514 |
| - | |
2515 | 2520 |
| |
2516 | 2521 |
| |
2517 | 2522 |
| |
| |||
2531 | 2536 |
| |
2532 | 2537 |
| |
2533 | 2538 |
| |
2534 |
| - | |
2535 |
| - | |
2536 |
| - | |
2537 |
| - | |
2538 |
| - | |
2539 |
| - | |
| 2539 | + | |
2540 | 2540 |
| |
2541 |
| - | |
| 2541 | + | |
2542 | 2542 |
| |
2543 | 2543 |
| |
2544 | 2544 |
| |
2545 | 2545 |
| |
2546 | 2546 |
| |
2547 |
| - | |
| 2547 | + | |
2548 | 2548 |
| |
2549 | 2549 |
| |
2550 |
| - | |
| 2550 | + | |
2551 | 2551 |
| |
2552 | 2552 |
| |
2553 | 2553 |
| |
|
Lines changed: 11 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 |
| - | |
51 |
| - | |
52 |
| - | |
53 |
| - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
54 | 53 |
| |
55 | 54 |
| |
56 | 55 |
| |
| |||
67 | 66 |
| |
68 | 67 |
| |
69 | 68 |
| |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
74 | 72 |
| |
75 | 73 |
| |
76 | 74 |
| |
| |||
374 | 372 |
| |
375 | 373 |
| |
376 | 374 |
| |
377 |
| - | |
378 |
| - | |
379 |
| - | |
380 |
| - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
381 | 379 |
| |
382 | 380 |
| |
383 | 381 |
| |
| |||
481 | 479 |
| |
482 | 480 |
| |
483 | 481 |
| |
484 |
| - | |
485 |
| - | |
| 482 | + | |
486 | 483 |
| |
487 | 484 |
| |
488 | 485 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
41 |
| - | |
42 |
| - | |
| 41 | + | |
43 | 42 |
| |
44 | 43 |
| |
45 | 44 |
| |
| |||
64 | 63 |
| |
65 | 64 |
| |
66 | 65 |
| |
67 |
| - | |
68 |
| - | |
| 66 | + | |
69 | 67 |
| |
70 | 68 |
| |
71 | 69 |
| |
| |||
103 | 101 |
| |
104 | 102 |
| |
105 | 103 |
| |
106 |
| - | |
107 |
| - | |
| 104 | + | |
108 | 105 |
| |
109 | 106 |
| |
110 | 107 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
92 |
| - | |
| 91 | + | |
93 | 92 |
| |
94 | 93 |
| |
95 | 94 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
106 |
| - | |
107 |
| - | |
| 106 | + | |
108 | 107 |
| |
109 | 108 |
| |
110 | 109 |
| |
| |||
150 | 149 |
| |
151 | 150 |
| |
152 | 151 |
| |
153 |
| - | |
154 |
| - | |
| 152 | + | |
155 | 153 |
| |
156 | 154 |
| |
157 | 155 |
| |
| |||
187 | 185 |
| |
188 | 186 |
| |
189 | 187 |
| |
190 |
| - | |
191 |
| - | |
| 188 | + | |
192 | 189 |
| |
193 | 190 |
| |
194 | 191 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 |
| - | |
| 47 | + | |
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 |
| - | |
| 63 | + | |
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
81 |
| - | |
| 81 | + | |
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
102 |
| - | |
| 102 | + | |
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
|
Lines changed: 6 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 |
| - | |
53 |
| - | |
| 52 | + | |
54 | 53 |
| |
55 | 54 |
| |
56 | 55 |
| |
| |||
84 | 83 |
| |
85 | 84 |
| |
86 | 85 |
| |
87 |
| - | |
88 |
| - | |
| 86 | + | |
89 | 87 |
| |
90 | 88 |
| |
91 | 89 |
| |
| |||
115 | 113 |
| |
116 | 114 |
| |
117 | 115 |
| |
118 |
| - | |
119 |
| - | |
| 116 | + | |
120 | 117 |
| |
121 | 118 |
| |
122 | 119 |
| |
| |||
135 | 132 |
| |
136 | 133 |
| |
137 | 134 |
| |
138 |
| - | |
139 |
| - | |
| 135 | + | |
140 | 136 |
| |
141 | 137 |
| |
142 | 138 |
| |
| |||
163 | 159 |
| |
164 | 160 |
| |
165 | 161 |
| |
166 |
| - | |
167 |
| - | |
| 162 | + | |
168 | 163 |
| |
169 | 164 |
| |
170 | 165 |
| |
| |||
334 | 329 |
| |
335 | 330 |
| |
336 | 331 |
| |
337 |
| - | |
| 332 | + | |
338 | 333 |
| |
339 | 334 |
| |
340 | 335 |
| |
|
Lines changed: 5 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
79 |
| - | |
80 |
| - | |
| 79 | + | |
81 | 80 |
| |
82 | 81 |
| |
83 | 82 |
| |
| |||
98 | 97 |
| |
99 | 98 |
| |
100 | 99 |
| |
101 |
| - | |
102 |
| - | |
| 100 | + | |
103 | 101 |
| |
104 | 102 |
| |
105 | 103 |
| |
| |||
112 | 110 |
| |
113 | 111 |
| |
114 | 112 |
| |
115 |
| - | |
116 |
| - | |
| 113 | + | |
117 | 114 |
| |
118 | 115 |
| |
119 | 116 |
| |
| |||
142 | 139 |
| |
143 | 140 |
| |
144 | 141 |
| |
145 |
| - | |
146 |
| - | |
| 142 | + | |
147 | 143 |
| |
148 | 144 |
| |
149 | 145 |
| |
| |||
154 | 150 |
| |
155 | 151 |
| |
156 | 152 |
| |
157 |
| - | |
158 |
| - | |
| 153 | + | |
159 | 154 |
| |
160 | 155 |
| |
161 | 156 |
| |
|
0 commit comments
Comments
(0)