pgsql: Fix logic to skip checkpoint if no records have been inserted.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Fix logic to skip checkpoint if no records have been inserted.
Дата
Msg-id E1YiODn-0006yU-DW@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3d80a1e0e3e278edc6022d642478dcbd089d4483

Modified Files
--------------
src/backend/access/transam/xlog.c |   16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Mark the second argument of pg_log as the translatable string in
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Shut down test servers after pg_rewind regression tests.