- Notifications
You must be signed in to change notification settings - Fork86
Commit8952b84
committed
[PBCKP-434] greatly simplify stop_lsn handling
It was long believed `stop_lsn` should point on start of last record.But in fact it points to end of last record (because XLogInsert(BACKUP_END)returns pointer to end of record, and that is what pg_backup_stop/pg_stop_backup returns).So we don't need to lookup `stop_lsn` record in WAL log, but rather checkexistence of record which ends on `stop_lsn` (which is what`get_prior_record_lsn` does).And there is no need to raise error on `stop_lsn` which points on block end- it is very valid when xlog record ends at block end.So:- we simplify wait_wal_lsn to just wait for `get_prior_record_lsn` returns "ok" (ie find such previous record). But now we don't overwrite stop_lsn with lsn of this record.- we use `wait_wal_lsn` only in "ARCHIVE" mode/directory. So get rid of `in_stream_dir` argument.- and `wait_wal_lsn` now waits only for previous record even for `is_start_lsn`, since there is no much gain in waiting for it. Even for PAGE mode we need only records before `start_lsn`, since `start_lsn` record is considered as part of backup.- "STREAM" mode now waits for lsn by hooking streamer. We don't need to calculate stop_backup_lsn since we may use stop_backup_result.lsn directly to stop streamer. After streamer stopped, we just check wal with `get_prior_record_lsn`. We don't need to, but just for sanity.- therefore `wait_wal_and_calculate_stop_lsn` become obsolete. Lets get rid of it. Without it, there is no need in get_first_record_lsn and get_next_record_lsn. Lets delete them too.- Instead of using XRecOffIsValid and XRecOffIsNull use added XRecPtrLooksGood and XRecEndLooksGood. XRecPtrLooksGood validates record start more rigidly than XRecOffIsValid, and XRecEndLooksGood validates record end, which could be on block end.- In fact, some of `XRecOffIsValid(x)` had to be `!XLogRecPtrIsInvalid(x)`- Since stop_lsn is not inclusive now, RunXLogThreads doesn't need `inclusive_endpoint` parameter. (And because Page mode needs just till start_lsn)- PAGE_LSN_FROM_FUTURE must be considered as error, btw.(And by the way there's no need to XLogBeginRead before XLogFindNextRecord. Cleanup such calls)1 parent79b8755 commit8952b84
File tree
9 files changed
+259
-575
lines changed- src
- compatibility
9 files changed
+259
-575
lines changedLines changed: 55 additions & 241 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 |
| - | |
22 |
| - | |
| 21 | + | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| |||
1857 | 1857 |
| |
1858 | 1858 |
| |
1859 | 1859 |
| |
1860 |
| - | |
1861 |
| - | |
| 1860 | + | |
| 1861 | + | |
1862 | 1862 |
| |
1863 | 1863 |
| |
1864 | 1864 |
| |
| |||
2222 | 2222 |
| |
2223 | 2223 |
| |
2224 | 2224 |
| |
2225 |
| - | |
| 2225 | + | |
2226 | 2226 |
| |
2227 | 2227 |
| |
2228 | 2228 |
| |
| |||
2245 | 2245 |
| |
2246 | 2246 |
| |
2247 | 2247 |
| |
2248 |
| - | |
| 2248 | + | |
2249 | 2249 |
| |
2250 | 2250 |
| |
2251 | 2251 |
| |
| |||
2273 | 2273 |
| |
2274 | 2274 |
| |
2275 | 2275 |
| |
2276 |
| - | |
| 2276 | + | |
2277 | 2277 |
| |
2278 | 2278 |
| |
2279 | 2279 |
| |
| |||
2287 | 2287 |
| |
2288 | 2288 |
| |
2289 | 2289 |
| |
2290 |
| - | |
| 2290 | + | |
2291 | 2291 |
| |
2292 | 2292 |
| |
2293 | 2293 |
| |
|
Lines changed: 19 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1048 | 1048 |
| |
1049 | 1049 |
| |
1050 | 1050 |
| |
| 1051 | + | |
1051 | 1052 |
| |
1052 |
| - | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1053 | 1071 |
| |
1054 | 1072 |
| |
1055 | 1073 |
| |
| |||
1075 | 1093 |
| |
1076 | 1094 |
| |
1077 | 1095 |
| |
1078 |
| - | |
1079 |
| - | |
1080 |
| - | |
1081 |
| - | |
1082 |
| - | |
1083 |
| - | |
1084 |
| - | |
1085 |
| - | |
1086 |
| - | |
1087 |
| - | |
1088 |
| - | |
1089 |
| - | |
1090 |
| - | |
1091 |
| - | |
1092 |
| - | |
1093 |
| - | |
1094 |
| - | |
1095 |
| - | |
1096 |
| - | |
1097 |
| - | |
1098 | 1096 |
| |
1099 | 1097 |
| |
1100 | 1098 |
| |
|
Lines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
496 | 496 |
| |
497 | 497 |
| |
498 | 498 |
| |
499 |
| - | |
500 | 499 |
| |
501 | 500 |
| |
502 | 501 |
| |
| |||
781 | 780 |
| |
782 | 781 |
| |
783 | 782 |
| |
784 |
| - | |
785 |
| - | |
786 |
| - | |
787 |
| - | |
| 783 | + | |
788 | 784 |
| |
789 | 785 |
| |
| 786 | + | |
| 787 | + | |
790 | 788 |
| |
791 | 789 |
| |
792 | 790 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 |
| - | |
34 |
| - | |
| 33 | + | |
35 | 34 |
| |
36 | 35 |
| |
37 | 36 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1541 | 1541 |
| |
1542 | 1542 |
| |
1543 | 1543 |
| |
| 1544 | + | |
1544 | 1545 |
| |
1545 | 1546 |
| |
1546 | 1547 |
| |
|
0 commit comments
Comments
(0)