- Notifications
You must be signed in to change notification settings - Fork5
Commite3f4cfc
committed
Fix bug leading to restoring unlogged relations from empty files.
At the end of crash recovery, unlogged relations are reset to the emptystate, using their init fork as the template. The init fork is copied tothe main fork without going through shared buffers. Unfortunately WALreplay so far has not necessarily flushed writes from shared buffers todisk at that point. In normal crash recovery, and before theintroduction of 'fast promotions' infd4ced5 / 9.3, theEND_OF_RECOVERY checkpoint flushes the buffers out in time. But withfast promotions that's not the case anymore.To fix, force WAL writes targeting the init fork to be flushedimmediately (using the new FlushOneBuffer() function). In 9.5+ thatflush can centrally be triggered from the code dealing with restoringfull page writes (XLogReadBufferForRedoExtended), in earlier releasesthat responsibility is in the hands of XLOG_HEAP_NEWPAGE's replayfunction.Backpatch to 9.1, even if this currently is only known to trigger in9.3+. Flushing earlier is more robust, and it is advantageous to keepthe branches similar.Typical symptoms of this bug are errors like'ERROR: index "..." contains unexpected zero page at block 0'shortly after promoting a node.Reported-By: Thom BrownAuthor: Andres Freund and Michael PaquierDiscussion: 20150326175024.GJ451@alap3.anarazel.deBackpatch: 9.1-1 parent9c779c4 commite3f4cfc
File tree
3 files changed
+31
-0
lines changed- src
- backend
- access/transam
- storage/buffer
- include/storage
3 files changed
+31
-0
lines changedLines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
368 | 368 |
| |
369 | 369 |
| |
370 | 370 |
| |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
371 | 380 |
| |
372 | 381 |
| |
373 | 382 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2988 | 2988 |
| |
2989 | 2989 |
| |
2990 | 2990 |
| |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
2991 | 3012 |
| |
2992 | 3013 |
| |
2993 | 3014 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
176 | 176 |
| |
177 | 177 |
| |
178 | 178 |
| |
| 179 | + | |
179 | 180 |
| |
180 | 181 |
| |
181 | 182 |
| |
|
0 commit comments
Comments
(0)