diff options
author | Magnus Hagander <magnus@hagander.net> | 2018-04-05 21:57:26 +0200 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2018-04-05 22:04:48 +0200 |
commit | 1fde38beaa0c3e66c340efc7cc0dc272d6254bb0 (patch) | |
tree | 1e8291cd8523789d919e239e92aa3ecd6aa749de /src/include/access/xlog.h | |
parent | c39e903d510064e4415bbadb43e34f6998351cca (diff) | |
download | postgresql-1fde38beaa0c3e66c340efc7cc0dc272d6254bb0.tar.gz postgresql-1fde38beaa0c3e66c340efc7cc0dc272d6254bb0.zip |
Allow on-line enabling and disabling of data checksums
This makes it possible to turn checksums on in a live cluster, without
the previous need for dump/reload or logical replication (and to turn it
off).
Enabling checkusm starts a background process in the form of a
launcher/worker combination that goes through the entire database and
recalculates checksums on each and every page. Only when all pages have
been checksummed are they fully enabled in the cluster. Any failure of
the process will revert to checksums off and the process has to be
started.
This adds a new WAL record that indicates the state of checksums, so
the process works across replicated clusters.
Authors: Magnus Hagander and Daniel Gustafsson
Review: Tomas Vondra, Michael Banck, Heikki Linnakangas, Andrey Borodin
Diffstat (limited to 'src/include/access/xlog.h')
-rw-r--r-- | src/include/access/xlog.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 421ba6d7755..f21870c6443 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -154,7 +154,7 @@ extern PGDLLIMPORT int wal_level; * of the bits make it to disk, but the checksum wouldn't match. Also WAL-log * them if forced by wal_log_hints=on. */ -#define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints) +#define XLogHintBitIsNeeded() (DataChecksumsNeedWrite() || wal_log_hints) /* Do we need to WAL-log information required only for Hot Standby and logical replication? */ #define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_REPLICA) @@ -257,7 +257,13 @@ extern char *XLogFileNameP(TimeLineID tli, XLogSegNo segno); extern void UpdateControlFile(void); extern uint64 GetSystemIdentifier(void); extern char *GetMockAuthenticationNonce(void); -extern bool DataChecksumsEnabled(void); +extern bool DataChecksumsNeedWrite(void); +extern bool DataChecksumsNeedVerify(void); +extern bool DataChecksumsInProgress(void); +extern void SetDataChecksumsInProgress(void); +extern void SetDataChecksumsOn(void); +extern void SetDataChecksumsOff(void); +extern const char *show_data_checksums(void); extern XLogRecPtr GetFakeLSNForUnloggedRel(void); extern Size XLOGShmemSize(void); extern void XLOGShmemInit(void); |