forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4fff78f
committed
Restructure pg_upgrade output directories for better idempotence
38bfae3 has moved the contents written to files by pg_upgrade under anew directory called pg_upgrade_output.d/ located in the new cluster'sdata folder, and it used a simple structure made of two subdirectoriesleading to a fixed structure: log/ and dump/. This design has madeweaker pg_upgrade on repeated calls, as we could get failures whencreating one or more of those directories, while potentially losing thelogs of a previous run (logs are retained automatically on failure, andcleaned up on success unless --retain is specified). So a user wouldneed to clean up pg_upgrade_output.d/ as an extra step for any repeatedcalls of pg_upgrade. The most common scenario here is --check followedby the actual upgrade, but one could see a failure when specifying anincorrect input argument value. Removing entirely the logs would havethe disadvantage of removing all the past information, even if --retainwas specified at some past step.This result is annoying for a lot of users and automated upgrade flows.So, rather than requiring a manual removal of pg_upgrade_output.d/, thisredesigns the set of output directories in a more dynamic way, based ona suggestion from Tom Lane and Daniel Gustafsson. pg_upgrade_output.d/is still the base path, but a second directory level is added, mostlynamed after an ISO-8601-formatted timestamp (in short human-readable,with milliseconds appended to the name to avoid any conflicts). Thelogs and dumps are saved within the same subdirectories as previously,as of log/ and dump/, but these are located inside the subdirectorynamed after the timestamp.The logs of a given run are removed only after a successful run if--retain is not used, and pg_upgrade_output.d/ is kept if there are anylogs from a previous run. Note that previously, pg_upgrade would havekept the logs even after a successful --check but that was inconsistentcompared to the case without --check when using --retain. The code incharge of the removal of the output directories is now refactored into asingle routine.Two TAP tests are added with some --check commands (one failure case andone success case), to look after the issue fixed here. Note that thetests had to be tweaked a bit to fit with the new directory structure soas it can find any logs generated on failure. This is still going torequire a change in the buildfarm client for the case where pg_upgradeis tested without the TAP test, though, but I'll tackle that with aseparate patch where needed.Reported-by: Tushar AhujaAuthor: Michael PaquierReviewed-by: Daniel Gustafsson, Justin PryzbyDiscussion:https://postgr.es/m/77e6ecaa-2785-97aa-f229-4b6e047cbd2b@enterprisedb.com1 parentfa5185b commit4fff78f
File tree
6 files changed
+150
-31
lines changed- doc/src/sgml/ref
- src/bin/pg_upgrade
- t
6 files changed
+150
-31
lines changedLines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
768 | 768 |
| |
769 | 769 |
| |
770 | 770 |
| |
771 |
| - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
772 | 775 |
| |
773 | 776 |
| |
774 | 777 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
210 | 210 |
| |
211 | 211 |
| |
212 | 212 |
| |
| 213 | + | |
| 214 | + | |
213 | 215 |
| |
214 | 216 |
| |
215 | 217 |
| |
|
Lines changed: 46 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
61 |
| - | |
62 | 61 |
| |
63 | 62 |
| |
64 | 63 |
| |
| |||
204 | 203 |
| |
205 | 204 |
| |
206 | 205 |
| |
207 |
| - | |
| 206 | + | |
208 | 207 |
| |
209 | 208 |
| |
210 | 209 |
| |
| |||
221 | 220 |
| |
222 | 221 |
| |
223 | 222 |
| |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
224 | 259 |
| |
225 |
| - | |
226 |
| - | |
227 |
| - | |
228 |
| - | |
229 |
| - | |
230 |
| - | |
231 |
| - | |
232 |
| - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
233 | 267 |
| |
234 |
| - | |
| 268 | + | |
235 | 269 |
| |
236 |
| - | |
| 270 | + | |
237 | 271 |
| |
238 | 272 |
| |
239 | 273 |
| |
| |||
745 | 779 |
| |
746 | 780 |
| |
747 | 781 |
| |
748 |
| - | |
749 |
| - | |
750 |
| - | |
751 |
| - | |
752 |
| - | |
753 |
| - | |
754 |
| - | |
755 |
| - | |
756 |
| - | |
757 |
| - | |
758 |
| - | |
|
Lines changed: 9 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 |
| - | |
34 |
| - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 |
| |
36 | 38 |
| |
37 |
| - | |
38 |
| - | |
| 39 | + | |
| 40 | + | |
39 | 41 |
| |
40 | 42 |
| |
41 | 43 |
| |
| |||
276 | 278 |
| |
277 | 279 |
| |
278 | 280 |
| |
279 |
| - | |
| 281 | + | |
| 282 | + | |
280 | 283 |
| |
281 | 284 |
| |
282 | 285 |
| |
| |||
432 | 435 |
| |
433 | 436 |
| |
434 | 437 |
| |
| 438 | + | |
435 | 439 |
| |
436 | 440 |
| |
437 | 441 |
| |
|
Lines changed: 47 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
| 8 | + | |
| 9 | + | |
8 | 10 |
| |
9 | 11 |
| |
10 | 12 |
| |
| |||
213 | 215 |
| |
214 | 216 |
| |
215 | 217 |
| |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
216 | 251 |
| |
217 | 252 |
| |
218 | 253 |
| |
| |||
221 | 256 |
| |
222 | 257 |
| |
223 | 258 |
| |
| 259 | + | |
| 260 | + | |
| 261 | + | |
224 | 262 |
| |
225 | 263 |
| |
226 | 264 |
| |
227 | 265 |
| |
228 |
| - | |
| 266 | + | |
229 | 267 |
| |
230 | 268 |
| |
231 |
| - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
232 | 277 |
| |
233 | 278 |
| |
234 | 279 |
| |
|
Lines changed: 42 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
58 | 100 |
| |
59 | 101 |
| |
60 | 102 |
| |
|
0 commit comments
Comments
(0)