forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita7eadaa
committed
Fix pg_rewind when rewinding new database with tables included
This fixes an issue introduced by266b6ac, which has added filters toexclude file patterns on the target and source data directories toreduce the number of files transferred. Filters get applied to boththe target and source data files, and include pg_internal.init which ispresent for each database once relations are created on it. However, ifthe target differed from the source with at least one new database withrelations, the rewind would fail due to the exclusion filters applied onthe target files, causing pg_internal.init to still be present on thetarget database folder, while its contents should have been completelyremoved so as there is nothing remaining inside at the time of thefolder deletion.Applying exclusion filters on the source files is fine, because this waythe amount of data copied from the source to the target is reduced. Andactually, not applying the filters on the target is what pg_rewindshould do, because this causes such files to be automatically removedduring the rewind on the target. Exclusion filters apply to paths whichare removed or recreated automatically at startup, so removing all thosefiles on the target during the rewind is a win.The existing set of TAP tests already stresses the rewind of databases,but it did not include any tables on those newly-created databases.Creating extra tables in this case is enough to reproduce the failure,so the existing tests are extended to close the gap.Reported-by: Mithun CyAuthor: Michael PaquierDiscussion:https://postgr.es/m/CADq3xVYt6_pO7ZzmjOqPgY9HWsL=kLd-_tNyMtdfjKqEALDyTA@mail.gmail.comBackpatch-through: 111 parentfa33956 commita7eadaa
3 files changed
+21
-10
lines changedLines changed: 7 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
147 | 147 |
| |
148 | 148 |
| |
149 | 149 |
| |
150 |
| - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
151 | 154 |
| |
152 | 155 |
| |
153 | 156 |
| |
| |||
334 | 337 |
| |
335 | 338 |
| |
336 | 339 |
| |
337 |
| - | |
338 |
| - | |
339 |
| - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
340 | 343 |
| |
341 |
| - | |
342 |
| - | |
343 | 344 |
| |
344 | 345 |
| |
345 | 346 |
| |
|
Lines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 |
| - | |
| 18 | + | |
19 | 19 |
| |
| 20 | + | |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
23 |
| - | |
| 24 | + | |
| 25 | + | |
24 | 26 |
| |
| 27 | + | |
| 28 | + | |
25 | 29 |
| |
26 | 30 |
| |
27 | 31 |
| |
28 | 32 |
| |
29 | 33 |
| |
| 34 | + | |
| 35 | + | |
30 | 36 |
| |
| 37 | + | |
| 38 | + | |
31 | 39 |
| |
32 | 40 |
| |
33 | 41 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| 71 | + | |
71 | 72 |
| |
72 | 73 |
| |
73 |
| - | |
| 74 | + | |
74 | 75 |
| |
75 | 76 |
| |
76 | 77 |
| |
77 | 78 |
| |
78 | 79 |
| |
79 | 80 |
| |
| 81 | + | |
80 | 82 |
| |
81 | 83 |
| |
82 |
| - | |
| 84 | + | |
83 | 85 |
| |
84 | 86 |
| |
85 | 87 |
| |
|
0 commit comments
Comments
(0)