Commit 363e8f9
committed
Fix pg_basebackup with in-place tablespaces some more.
Commit c6f2f01 purported to make
this work, but problems remained. In a plain-format backup, the
files from an in-place tablespace got included in the tar file for
the main tablespace, which is wrong but it's not clear that it
has any user-visible consequences. In a tar-format backup, the
TABLESPACE_MAP option is used, and so we never iterated over
pg_tblspc and thus never backed up the in-place tablespaces
anywhere at all.
To fix this, reverse the changes in that commit, so that when we scan
pg_tblspc during a backup, we create tablespaceinfo objects even for
in-place tablespaces. We set the field that would normally contain the
absolute pathname to the relative path pg_tblspc/${TSOID}, and that's
good enough to make basebackup.c happy without any further changes.
However, pg_basebackup needs a couple of adjustments to make it work.
First, it needs to understand that a relative path for a tablespace
means it's an in-place tablespace. Second, it needs to tolerate the
situation where restoring the main tablespace tries to create
pg_tblspc or a subdirectory and finds that it already exists, because
we restore user-defined tablespaces before the main tablespace.
Since in-place tablespaces are only intended for use in development
and testing, no back-patch.
Patch by me, reviewed by Thomas Munro and Michael Paquier.
Discussion: http://postgr.es/m/CA+TgmobwvbEp+fLq2PykMYzizcvuNv0a7gPMJtxOTMOuuRLMHg@mail.gmail.com1 parent f180290 commit 363e8f9
File tree
4 files changed
+159
-66
lines changed- src
- backend/access/transam
- bin/pg_basebackup
- t
4 files changed
+159
-66
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8454 | 8454 | | |
8455 | 8455 | | |
8456 | 8456 | | |
8457 | | - | |
8458 | | - | |
8459 | 8457 | | |
| 8458 | + | |
8460 | 8459 | | |
8461 | 8460 | | |
8462 | 8461 | | |
8463 | 8462 | | |
8464 | 8463 | | |
8465 | 8464 | | |
8466 | 8465 | | |
8467 | | - | |
8468 | | - | |
8469 | | - | |
8470 | | - | |
8471 | | - | |
8472 | | - | |
8473 | | - | |
| 8466 | + | |
8474 | 8467 | | |
8475 | | - | |
8476 | | - | |
| 8468 | + | |
8477 | 8469 | | |
8478 | | - | |
8479 | | - | |
8480 | | - | |
8481 | | - | |
| 8470 | + | |
| 8471 | + | |
| 8472 | + | |
| 8473 | + | |
| 8474 | + | |
| 8475 | + | |
| 8476 | + | |
| 8477 | + | |
| 8478 | + | |
| 8479 | + | |
| 8480 | + | |
| 8481 | + | |
| 8482 | + | |
| 8483 | + | |
| 8484 | + | |
| 8485 | + | |
| 8486 | + | |
| 8487 | + | |
| 8488 | + | |
| 8489 | + | |
| 8490 | + | |
| 8491 | + | |
| 8492 | + | |
| 8493 | + | |
| 8494 | + | |
| 8495 | + | |
| 8496 | + | |
| 8497 | + | |
| 8498 | + | |
| 8499 | + | |
| 8500 | + | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
| 8504 | + | |
| 8505 | + | |
| 8506 | + | |
| 8507 | + | |
| 8508 | + | |
| 8509 | + | |
| 8510 | + | |
| 8511 | + | |
| 8512 | + | |
| 8513 | + | |
8482 | 8514 | | |
8483 | | - | |
| 8515 | + | |
8484 | 8516 | | |
8485 | | - | |
8486 | | - | |
8487 | | - | |
8488 | | - | |
| 8517 | + | |
| 8518 | + | |
| 8519 | + | |
| 8520 | + | |
| 8521 | + | |
| 8522 | + | |
| 8523 | + | |
| 8524 | + | |
| 8525 | + | |
| 8526 | + | |
| 8527 | + | |
8489 | 8528 | | |
8490 | | - | |
8491 | | - | |
8492 | | - | |
8493 | | - | |
8494 | | - | |
8495 | | - | |
8496 | | - | |
8497 | | - | |
| 8529 | + | |
8498 | 8530 | | |
8499 | | - | |
8500 | | - | |
8501 | | - | |
| 8531 | + | |
| 8532 | + | |
8502 | 8533 | | |
8503 | 8534 | | |
8504 | | - | |
8505 | | - | |
8506 | | - | |
8507 | | - | |
8508 | | - | |
8509 | | - | |
8510 | | - | |
8511 | | - | |
8512 | | - | |
8513 | | - | |
8514 | 8535 | | |
8515 | 8536 | | |
8516 | 8537 | | |
8517 | | - | |
| 8538 | + | |
8518 | 8539 | | |
8519 | 8540 | | |
8520 | 8541 | | |
8521 | 8542 | | |
8522 | | - | |
8523 | | - | |
8524 | | - | |
8525 | | - | |
8526 | | - | |
8527 | 8543 | | |
8528 | 8544 | | |
8529 | 8545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
279 | 312 | | |
280 | 313 | | |
281 | 314 | | |
282 | 315 | | |
283 | 316 | | |
284 | 317 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
301 | 322 | | |
302 | 323 | | |
303 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1122 | 1122 | | |
1123 | 1123 | | |
1124 | 1124 | | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1125 | 1129 | | |
1126 | | - | |
1127 | | - | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
1128 | 1136 | | |
1129 | 1137 | | |
1130 | 1138 | | |
| |||
1955 | 1963 | | |
1956 | 1964 | | |
1957 | 1965 | | |
1958 | | - | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
1959 | 1975 | | |
1960 | 1976 | | |
1961 | 1977 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments