forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf3db7f1
committed
Prevent running pg_resetwal/pg_resetxlog against wrong-version data dirs.
pg_resetwal (formerly pg_resetxlog) doesn't insist on finding a matchingversion number in pg_control, and that seems like an important thing topreserve since recovering from corrupt pg_control is a prime reason toneed to run it. However, that means you can try to run it against adata directory of a different major version, which is at best uselessand at worst disastrous. So as to provide some protection against thattype of pilot error, inspect PG_VERSION at startup and refuse to doanything if it doesn't match. PG_VERSION is read-only after initdb,so it's unlikely to get corrupted, and even if it were corrupted it wouldbe easy to fix by hand.This hazard has been there all along, so back-patch to all supportedbranches.Michael Paquier, with some kibitzing by meDiscussion:https://postgr.es/m/f4b8eb91-b934-8a0d-b3cc-68f06e2279d1@enterprisedb.com1 parentce50945 commitf3db7f1
File tree
2 files changed
+74
-1
lines changed- doc/src/sgml/ref
- src/bin/pg_resetwal
2 files changed
+74
-1
lines changedLines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
281 | 281 |
| |
282 | 282 |
| |
283 | 283 |
| |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
284 | 289 |
| |
285 | 290 |
| |
286 | 291 |
| |
|
Lines changed: 69 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
| 74 | + | |
74 | 75 |
| |
75 | 76 |
| |
76 | 77 |
| |
| |||
319 | 320 |
| |
320 | 321 |
| |
321 | 322 |
| |
| 323 | + | |
| 324 | + | |
| 325 | + | |
322 | 326 |
| |
323 | 327 |
| |
324 | 328 |
| |
| |||
452 | 456 |
| |
453 | 457 |
| |
454 | 458 |
| |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
455 | 523 |
| |
456 | 524 |
| |
457 | 525 |
| |
| |||
521 | 589 |
| |
522 | 590 |
| |
523 | 591 |
| |
524 |
| - | |
| 592 | + | |
525 | 593 |
| |
526 | 594 |
| |
527 | 595 |
| |
|
0 commit comments
Comments
(0)