{PG_DATA_CHECKSUM_OFF, PG_DATA_CHECKSUM_INPROGRESS_OFF},
};
+/* Possible operations the DataChecksumsWorker can perform */
+typedef enum DataChecksumsWorkerOperation
+{
+ ENABLE_DATACHECKSUMS,
+ DISABLE_DATACHECKSUMS,
+} DataChecksumsWorkerOperation;
+
+/* Possible states for a database entry which has been processed */
+typedef enum
+{
+ DATACHECKSUMSWORKER_SUCCESSFUL = 0,
+ DATACHECKSUMSWORKER_ABORTED,
+ DATACHECKSUMSWORKER_FAILED,
+ DATACHECKSUMSWORKER_DROPDB,
+} DataChecksumsWorkerResult;
+
/*
* Signaling between backends calling pg_enable/disable_data_checksums, the
* checksums launcher process, and the checksums worker process.
static DataChecksumsWorkerOperation operation;
/* Prototypes */
+static void StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op,
+ int cost_delay,
+ int cost_limit);
static void DataChecksumsShmemRequest(void *arg);
static bool DatabaseExists(Oid dboid);
static List *BuildDatabaseList(void);
/*
* StartDataChecksumsWorkerLauncher
- * Main entry point for datachecksumsworker launcher process
+ * Start the datachecksumsworker launcher process, if not running yet
*
- * The main entrypoint for starting data checksums processing for enabling as
- * well as disabling.
+ * This is called to start data checksums processing for enabling as well as
+ * disabling.
*/
-void
+static void
StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op,
int cost_delay,
int cost_limit)
* Blocks awaiting all current transactions to finish
*
* Returns when all transactions which are active at the call of the function
- * have ended, or if the postmaster dies while waiting. If the postmaster dies
- * the abort flag will be set to indicate that the caller of this shouldn't
- * proceed.
+ * have ended.
*
* NB: this will return early, if aborted by SIGINT or if the target state
* is changed while we're running.
WAIT_EVENT_CHECKSUM_ENABLE_STARTCONDITION);
/*
- * If the postmaster died we won't be able to enable checksums
- * cluster-wide so abort and hope to continue when restarted.
+ * If the postmaster died, bail out. But first print a log message to
+ * note that the checksumming didn't complete.
*/
if (rc & WL_POSTMASTER_DEATH)
ereport(FATAL,
#include "storage/procsignal.h"
-/* Possible operations the DataChecksumsWorker can perform */
-typedef enum DataChecksumsWorkerOperation
-{
- ENABLE_DATACHECKSUMS,
- DISABLE_DATACHECKSUMS,
-} DataChecksumsWorkerOperation;
-
-/*
- * Possible states for a database entry which has been processed. Exported
- * here since we want to be able to reference this from injection point tests.
- */
-typedef enum
-{
- DATACHECKSUMSWORKER_SUCCESSFUL = 0,
- DATACHECKSUMSWORKER_ABORTED,
- DATACHECKSUMSWORKER_FAILED,
- DATACHECKSUMSWORKER_DROPDB,
-} DataChecksumsWorkerResult;
-
/* Prototypes for data checksum state manipulation */
bool AbsorbDataChecksumsBarrier(ProcSignalBarrierType barrier);
void EmitAndWaitDataChecksumsBarrier(uint32 state);
-/* Prototypes for data checksum background worker */
-
-/* Start the background processes for enabling or disabling checksums */
-void StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op,
- int cost_delay,
- int cost_limit);
-
/* Background worker entrypoints */
void DataChecksumsWorkerLauncherMain(Datum arg);
void DataChecksumsWorkerMain(Datum arg);