- Notifications
You must be signed in to change notification settings - Fork5
Commitfecfc2b
committed
In WAL replay, restore GIN metapage unconditionally to avoid torn page.
We don't take a full-page image of the GIN metapage; instead, the WAL recordcontains all the information required to reconstruct it from scratch. Butto avoid torn page hazards, we must re-initialize it from the WAL recordevery time, even if it already has a greater LSN, similar to how normal fullpage images are restored.This was highly unlikely to cause any problems in practice, because the GINmetapage is small. We rely on an update smaller than a 512 byte disk sectorto be atomic elsewhere, at least in pg_control. But better safe than sorry,and this would be easy to overlook if more fields are added to the metapageso that it's no longer small.Reported by Noah Misch. Backpatch to all supported versions.1 parente85a5ff commitfecfc2b
1 file changed
+11
-12
lines changedLines changed: 11 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
564 | 564 |
| |
565 | 565 |
| |
566 | 566 |
| |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
567 | 572 |
| |
568 | 573 |
| |
569 | 574 |
| |
570 | 575 |
| |
571 | 576 |
| |
572 |
| - | |
573 |
| - | |
574 |
| - | |
575 |
| - | |
576 |
| - | |
577 |
| - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
578 | 580 |
| |
579 | 581 |
| |
580 | 582 |
| |
| |||
724 | 726 |
| |
725 | 727 |
| |
726 | 728 |
| |
727 |
| - | |
728 |
| - | |
729 |
| - | |
730 |
| - | |
731 |
| - | |
732 |
| - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
733 | 732 |
| |
734 | 733 |
| |
735 | 734 |
| |
|
0 commit comments
Comments
(0)