- Notifications
You must be signed in to change notification settings - Fork5
Commit3d80a1e
committed
Fix logic to skip checkpoint if no records have been inserted.
After the WAL format changes, the calculation of the size of a checkpointrecord became incorrect. Instead of trying to fix the math, check that theprevious record, i.e. the xl_prev value that we'd write for the nextrecord, matches the last checkpoint's redo pointer. That way it's notdependent on the size of the checkpoint record at all.The old logic was actually slightly wrong all along: if the previouscheckpoint record crossed a page boundary, the page headers threw off therecord size calculation, and the checkpoint was not skipped. The newcheckpoint would not cross a page boundary, so this only resulted in atmost one extra checkpoint after the system became idle. The new logic fixesthat. (It's not worth fixing in backbranches).However, it makes some sense to try to keep the latest checkpoint containedfully in a page, or at least in a single WAL segment, just on generalrobustness grounds. If something goes awfully wrong, it's more likely thatyou can recover the latest WAL segment, than the last two WAL segments. SoI added an extra check that the checkpoint is not skipped if the previouscheckpoint crossed a WAL segment.Reported by Jeff Janes.1 parent9fa8b0e commit3d80a1e
1 file changed
+9
-7
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7903 | 7903 |
| |
7904 | 7904 |
| |
7905 | 7905 |
| |
| 7906 | + | |
7906 | 7907 |
| |
7907 | 7908 |
| |
7908 | 7909 |
| |
| |||
7988 | 7989 |
| |
7989 | 7990 |
| |
7990 | 7991 |
| |
| 7992 | + | |
7991 | 7993 |
| |
7992 | 7994 |
| |
7993 | 7995 |
| |
| |||
7999 | 8001 |
| |
8000 | 8002 |
| |
8001 | 8003 |
| |
8002 |
| - | |
8003 |
| - | |
8004 |
| - | |
8005 |
| - | |
| 8004 | + | |
| 8005 | + | |
| 8006 | + | |
| 8007 | + | |
| 8008 | + | |
8006 | 8009 |
| |
8007 | 8010 |
| |
8008 | 8011 |
| |
8009 | 8012 |
| |
8010 |
| - | |
8011 |
| - | |
8012 |
| - | |
| 8013 | + | |
| 8014 | + | |
8013 | 8015 |
| |
8014 | 8016 |
| |
8015 | 8017 |
| |
|
0 commit comments
Comments
(0)