- Notifications
You must be signed in to change notification settings - Fork28
Commita7e8ece
committed
Add -c/--restore-target-wal to pg_rewind
pg_rewind needs to copy from the source cluster to the target cluster aset of relation blocks changed from the previous checkpoint where WALforked up to the end of WAL on the target. Building this list ofrelation blocks requires a range of WAL segments that may not be presentanymore on the target's pg_wal, causing pg_rewind to fail. It ispossible to work around this issue by copying manually the WAL segmentsneeded but this may lead to some extra and actually useless work.This commit introduces a new option allowing pg_rewind to use arestore_command while doing the rewind by grabbing the parameter valueof restore_command from the target cluster configuration. This allowsthe rewind operation to be more reliable, so as only the WAL segmentsneeded by the rewind are restored from the archives.In order to be able to do that, a new routine is added to src/common/ toallow frontend tools to restore files from archives using analready-built restore command. This version is more simple than thebackend equivalent as there is no need to handle the non-recovery case.Author: Alexey KondratovReviewed-by: Andrey Borodin, Andres Freund, Alvaro Herrera, AlexanderKorotkov, Michael PaquierDiscussion:https://postgr.es/m/a3acff50-5a0d-9a2c-b3b2-ee36168955c1@postgrespro.ru1 parent92d3108 commita7e8ece
File tree
12 files changed
+360
-27
lines changed- doc/src/sgml/ref
- src
- bin/pg_rewind
- t
- common
- include
- common
- tools/msvc
12 files changed
+360
-27
lines changedLines changed: 22 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
74 | 74 |
| |
75 | 75 |
| |
76 | 76 |
| |
| |||
232 | 232 |
| |
233 | 233 |
| |
234 | 234 |
| |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
235 | 248 |
| |
236 | 249 |
| |
237 | 250 |
| |
| |||
318 | 331 |
| |
319 | 332 |
| |
320 | 333 |
| |
321 |
| - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
322 | 338 |
| |
323 | 339 |
| |
324 | 340 |
| |
|
Lines changed: 29 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
| |||
41 | 42 |
| |
42 | 43 |
| |
43 | 44 |
| |
| 45 | + | |
44 | 46 |
| |
45 | 47 |
| |
46 | 48 |
| |
| |||
55 | 57 |
| |
56 | 58 |
| |
57 | 59 |
| |
58 |
| - | |
| 60 | + | |
59 | 61 |
| |
60 | 62 |
| |
61 | 63 |
| |
62 | 64 |
| |
63 | 65 |
| |
64 | 66 |
| |
65 | 67 |
| |
| 68 | + | |
66 | 69 |
| |
67 | 70 |
| |
68 | 71 |
| |
| |||
146 | 149 |
| |
147 | 150 |
| |
148 | 151 |
| |
149 |
| - | |
| 152 | + | |
150 | 153 |
| |
151 | 154 |
| |
152 | 155 |
| |
| |||
170 | 173 |
| |
171 | 174 |
| |
172 | 175 |
| |
| 176 | + | |
173 | 177 |
| |
174 | 178 |
| |
175 | 179 |
| |
| |||
281 | 285 |
| |
282 | 286 |
| |
283 | 287 |
| |
284 |
| - | |
285 |
| - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
286 | 311 |
| |
287 | 312 |
| |
288 | 313 |
| |
|
Lines changed: 82 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
| 25 | + | |
25 | 26 |
| |
26 | 27 |
| |
27 | 28 |
| |
| |||
38 | 39 |
| |
39 | 40 |
| |
40 | 41 |
| |
| 42 | + | |
41 | 43 |
| |
42 | 44 |
| |
43 | 45 |
| |
| |||
53 | 55 |
| |
54 | 56 |
| |
55 | 57 |
| |
| 58 | + | |
56 | 59 |
| |
57 | 60 |
| |
58 | 61 |
| |
59 | 62 |
| |
60 | 63 |
| |
| 64 | + | |
61 | 65 |
| |
62 | 66 |
| |
63 | 67 |
| |
| |||
74 | 78 |
| |
75 | 79 |
| |
76 | 80 |
| |
| 81 | + | |
| 82 | + | |
77 | 83 |
| |
78 | 84 |
| |
79 | 85 |
| |
| |||
103 | 109 |
| |
104 | 110 |
| |
105 | 111 |
| |
| 112 | + | |
106 | 113 |
| |
107 | 114 |
| |
108 | 115 |
| |
| |||
144 | 151 |
| |
145 | 152 |
| |
146 | 153 |
| |
147 |
| - | |
| 154 | + | |
148 | 155 |
| |
149 | 156 |
| |
150 | 157 |
| |
151 | 158 |
| |
152 | 159 |
| |
153 | 160 |
| |
154 | 161 |
| |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
155 | 166 |
| |
156 | 167 |
| |
157 | 168 |
| |
| |||
255 | 266 |
| |
256 | 267 |
| |
257 | 268 |
| |
| 269 | + | |
| 270 | + | |
258 | 271 |
| |
259 | 272 |
| |
260 | 273 |
| |
| |||
350 | 363 |
| |
351 | 364 |
| |
352 | 365 |
| |
353 |
| - | |
354 |
| - | |
355 |
| - | |
| 366 | + | |
| 367 | + | |
356 | 368 |
| |
357 | 369 |
| |
358 | 370 |
| |
| |||
378 | 390 |
| |
379 | 391 |
| |
380 | 392 |
| |
381 |
| - | |
| 393 | + | |
382 | 394 |
| |
383 | 395 |
| |
384 | 396 |
| |
| |||
804 | 816 |
| |
805 | 817 |
| |
806 | 818 |
| |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
807 | 884 |
| |
808 | 885 |
| |
809 | 886 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
45 |
| - | |
| 45 | + | |
| 46 | + | |
46 | 47 |
| |
47 | 48 |
| |
48 | 49 |
| |
49 |
| - | |
| 50 | + | |
| 51 | + | |
50 | 52 |
| |
51 | 53 |
| |
52 | 54 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
| 4 | + | |
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
| 174 | + | |
174 | 175 |
| |
175 | 176 |
|
0 commit comments
Comments
(0)