pgsql: Don't waste the last segment of each 4GB logical log file. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Don't waste the last segment of each 4GB logical log file.
Date
Msg-id E1Sipa2-0008Pu-8C@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Don't waste the last segment of each 4GB logical log file.

The comments claimed that wasting the last segment made it easier to do
calculations with XLogRecPtrs, because you don't have problems representing
last-byte-position-plus-1 that way. In my experience, however, it only made
things more complicated, because the there was two ways to represent the
boundary at the beginning of a logical log file: logid = n+1 and xrecoff = 0,
or as xlogid = n and xrecoff = 4GB - XLOG_SEG_SIZE. Some functions were
picky about which representation was used.

Also, use a 64-bit segment number instead of the log/seg combination, to
point to a certain WAL segment. We assume that all platforms have a working
64-bit integer type nowadays.

This is an incompatible change in WAL format, so bumping WAL version number.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/dfda6ebaec6763090fb78b458a979b558c50b39b

Modified Files
--------------
src/backend/access/transam/xlog.c      |  552 ++++++++++++++------------------
src/backend/access/transam/xlogfuncs.c |   48 +--
src/backend/postmaster/checkpointer.c  |    2 +-
src/backend/replication/basebackup.c   |   20 +-
src/backend/replication/walreceiver.c  |   30 +-
src/backend/replication/walsender.c    |   71 ++---
src/bin/pg_basebackup/pg_receivexlog.c |   22 +-
src/bin/pg_basebackup/receivelog.c     |    5 +-
src/bin/pg_resetxlog/pg_resetxlog.c    |   83 ++---
src/include/access/xlog.h              |   11 +-
src/include/access/xlog_internal.h     |  111 +++----
src/include/access/xlogdefs.h          |   16 +-
12 files changed, 415 insertions(+), 556 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Allow WAL record header to be split across pages.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Replace XLogRecPtr struct with a 64-bit integer.