forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit853c640
committed
Fix race condition in 028_pitr_timelines.pl test, add note to docs.
The 028_pitr_timelines.pl test would sometimes hang, waiting for a WALsegment that was just filled up to be archived. It was because thetest used 'pg_stat_archiver.last_archived_wal' to check if a file wasarchived, but the order that WAL files are archived when a standby ispromoted is not fully deterministic, and 'last_archived_wal' tracksthe last segment that was archived, not the highest-numbered WALsegment. Because of that, if the archiver archived segment 3, and then2, 'last_archived_wal' say 2, and the test query would think that 3has not been archived yet.Normally, WAL files are marked ready for archival in order, and thearchiver process will process them in order, so that issue doesn'tarise. We have used the same query on 'last_archived_wal' in a fewother tests with no problem. But when a standby is promoted, thingsare a bit chaotic. After promotion, the server will try to archive allthe WAL segments from the old timeline that are in pg_wal, as well asthe history file and any new WAL segments on the new timeline. Theend-of-recovery checkpoint will create the .ready files for all theWAL files on the old timeline, but at the same time, the new timelineis opened up for business. A file from the new timeline can thereforebe archived before the files from the old timeline have been marked asready for archival.It turns out that we don't really need to wait for the archival inthis particular test, because the standby server is about to bestopped, and stopping a server will wait for the end-of-recoverycheckpoint and all WAL archivals to finish, anyway. So we can justremove it from the test.Add a note to the docs on 'pg_stat_archiver' view that files can bearchived out of order.Reviewed-by: Tom LaneDiscussion:https://www.postgresql.org/message-id/3186114.1644960507@sss.pgh.pa.us1 parent988ffc3 commit853c640
File tree
2 files changed
+15
-15
lines changed- doc/src/sgml
- src/test/recovery/t
2 files changed
+15
-15
lines changedLines changed: 13 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3422 | 3422 |
| |
3423 | 3423 |
| |
3424 | 3424 |
| |
3425 |
| - | |
| 3425 | + | |
3426 | 3426 |
| |
3427 | 3427 |
| |
3428 | 3428 |
| |
| |||
3431 | 3431 |
| |
3432 | 3432 |
| |
3433 | 3433 |
| |
3434 |
| - | |
| 3434 | + | |
3435 | 3435 |
| |
3436 | 3436 |
| |
3437 | 3437 |
| |
| |||
3449 | 3449 |
| |
3450 | 3450 |
| |
3451 | 3451 |
| |
3452 |
| - | |
| 3452 | + | |
3453 | 3453 |
| |
3454 | 3454 |
| |
3455 | 3455 |
| |
| |||
3458 | 3458 |
| |
3459 | 3459 |
| |
3460 | 3460 |
| |
3461 |
| - | |
| 3461 | + | |
3462 | 3462 |
| |
3463 | 3463 |
| |
3464 | 3464 |
| |
| |||
3474 | 3474 |
| |
3475 | 3475 |
| |
3476 | 3476 |
| |
| 3477 | + | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
3477 | 3486 |
| |
3478 | 3487 |
| |
3479 | 3488 |
| |
|
Lines changed: 2 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
39 |
| - | |
40 | 39 |
| |
41 | 40 |
| |
42 | 41 |
| |
| |||
70 | 69 |
| |
71 | 70 |
| |
72 | 71 |
| |
73 |
| - | |
74 | 72 |
| |
75 | 73 |
| |
76 | 74 |
| |
| |||
93 | 91 |
| |
94 | 92 |
| |
95 | 93 |
| |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
| 94 | + | |
| 95 | + | |
105 | 96 |
| |
106 | 97 |
| |
107 | 98 |
| |
|
0 commit comments
Comments
(0)