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/postmaster | |
| parent | c39e903d510064e4415bbadb43e34f6998351cca (diff) | |
| download | postgresql-1fde38beaa0c3e66c340efc7cc0dc272d6254bb0.tar.gz | |
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/postmaster')
| -rw-r--r-- | src/include/postmaster/checksumhelper.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/include/postmaster/checksumhelper.h b/src/include/postmaster/checksumhelper.h new file mode 100644 index 0000000000..289bf2a935 --- /dev/null +++ b/src/include/postmaster/checksumhelper.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * checksumhelper.h + * header file for checksum helper background worker + * + * + * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/checksumhelper.h + * + *------------------------------------------------------------------------- + */ +#ifndef CHECKSUMHELPER_H +#define CHECKSUMHELPER_H + +/* Shared memory */ +extern Size ChecksumHelperShmemSize(void); +extern void ChecksumHelperShmemInit(void); + +/* Start the background processes for enabling checksums */ +bool StartChecksumHelperLauncher(int cost_delay, int cost_limit); + +/* Shutdown the background processes, if any */ +void ShutdownChecksumHelperIfRunning(void); + +/* Background worker entrypoints */ +void ChecksumHelperLauncherMain(Datum arg); +void ChecksumHelperWorkerMain(Datum arg); + +#endif /* CHECKSUMHELPER_H */ |
