postgresql/src/backend/access
Heikki Linnakangas 3d80a1e0e3 Fix logic to skip checkpoint if no records have been inserted.
After the WAL format changes, the calculation of the size of a checkpoint
record became incorrect. Instead of trying to fix the math, check that the
previous record, i.e. the xl_prev value that we'd write for the next
record, matches the last checkpoint's redo pointer. That way it's not
dependent on the size of the checkpoint record at all.

The old logic was actually slightly wrong all along: if the previous
checkpoint record crossed a page boundary, the page headers threw off the
record size calculation, and the checkpoint was not skipped. The new
checkpoint would not cross a page boundary, so this only resulted in at
most one extra checkpoint after the system became idle. The new logic fixes
that. (It's not worth fixing in backbranches).

However, it makes some sense to try to keep the latest checkpoint contained
fully in a page, or at least in a single WAL segment, just on general
robustness grounds. If something goes awfully wrong, it's more likely that
you can recover the latest WAL segment, than the last two WAL segments. So
I added an extra check that the checkpoint is not skipped if the previous
checkpoint crossed a WAL segment.

Reported by Jeff Janes.
2015-04-15 17:21:04 +03:00
..
brin Move BRIN page type to page's last two bytes 2015-03-10 12:27:15 -03:00
common Add log_min_autovacuum_duration per-table option 2015-04-03 11:55:50 -03:00
gin Make ginbuild's funcCtx be independent of its tmpCtx. 2015-03-29 14:02:58 -04:00
gist Fix GiST index-only scans for opclasses with different storage type. 2015-03-26 23:07:52 +02:00
hash Remove unnecessary variables in _hash_splitbucket(). 2015-04-03 16:49:44 -04:00
heap Optimize locking a tuple already locked by another subxact 2015-04-10 13:47:15 -03:00
index Add support for index-only scans in GiST. 2015-03-26 19:12:00 +02:00
nbtree Remove duplicated word in README 2015-04-13 14:28:21 -03:00
rmgrdesc Merge the various forms of transaction commit & abort records. 2015-03-15 17:37:07 +01:00
spgist Add support for index-only scans in GiST. 2015-03-26 19:12:00 +02:00
transam Fix logic to skip checkpoint if no records have been inserted. 2015-04-15 17:21:04 +03:00
Makefile BRIN: Block Range Indexes 2014-11-07 16:38:14 -03:00