commit a2b37f504a88b8d479af9eb07e6fcb42c591abf4 Author: Daniel Gustafsson Date: Thu Apr 2 20:09:57 2026 +0200 fixupÄ diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 9a62d002002..1ce81d00d85 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4781,12 +4781,17 @@ SetDataChecksumsOn(void) /* * The only allowed state transition to "on" is from "inprogress-on" since - * that state ensures that all pages will have data checksums written. + * that state ensures that all pages will have data checksums written. No + * such state transition exists, if it does happen it's likely due to a + * programmer error. */ if (XLogCtl->data_checksum_version != PG_DATA_CHECKSUM_INPROGRESS_ON) { SpinLockRelease(&XLogCtl->info_lck); - elog(PANIC, "checksums not in \"inprogress-on\" mode"); + elog(WARNING, + "cannot set data checksums to \"on\", current state is not \"inprogress-on\", disabling"); + SetDataChecksumsOff(); + return; } SpinLockRelease(&XLogCtl->info_lck); diff --git a/src/backend/postmaster/datachecksum_state.c b/src/backend/postmaster/datachecksum_state.c index 9923a18c92c..754edc5c746 100644 --- a/src/backend/postmaster/datachecksum_state.c +++ b/src/backend/postmaster/datachecksum_state.c @@ -96,7 +96,7 @@ * If processing was halted by the cluster shutting down (due to a crash or * intentional restart), the controlfile state "inprogress-on" will be observed * on system startup and all backends will be placed in Bd. The controlfile - * state will also be set of "off". + * state will also be set to "off". * * Backends transition Bd -> Bi via a procsignalbarrier which is emitted by the * DataChecksumsLauncher. When all backends have acknowledged the barrier then @@ -223,69 +223,43 @@ /* * Configuration of conditions which must match when absorbing a procsignal * barrier during data checksum enable/disable operations. A single function - * is used for absorbing all barriers, and the set of conditions to use is - * looked up in the checksum_barriers struct. The struct member for the target - * state defines which state the backend must currently be in, and which it - * must not be in. - * - * The reason for this explicit checking is to ensure that processing cannot - * be started such that it breaks the assumptions of the state machine. - * - * MAX_BARRIER_CONDITIONS must match largest number of sets in barrier_eq and - * barrier_ne in the below checksum_barriers definition. + * is used for absorbing all barriers, and the current and target states must + * be defined as a from/to tuple in the checksum_barriers struct. */ -#define MAX_BARRIER_CONDITIONS 2 typedef struct ChecksumBarrierCondition { - /* The target state of the barrier */ - int target; - /* A set of states in which at least one MUST match the current state */ - int barrier_eq[MAX_BARRIER_CONDITIONS]; - /* The number of elements in the barrier_eq set */ - int barrier_eq_sz; - /* A set of states which all MUST NOT match the current state */ - int barrier_ne[MAX_BARRIER_CONDITIONS]; - /* The number of elements in the barrier_ne set */ - int barrier_ne_sz; + /* Current state of data checksums */ + int from; + /* Target state for data checksums */ + int to; } ChecksumBarrierCondition; -static const ChecksumBarrierCondition checksum_barriers[4] = +static const ChecksumBarrierCondition checksum_barriers[6] = { /* - * When disabling checksums, either inprogress state is Ok but checksums - * must not be in the enabled state. + * Disabling checksums: If checksums are currently enabled, disabling must + * go through the 'inprogress-off' state. */ - { - .target = PG_DATA_CHECKSUM_OFF, - .barrier_eq = {PG_DATA_CHECKSUM_INPROGRESS_ON, PG_DATA_CHECKSUM_INPROGRESS_OFF}, - .barrier_eq_sz = 2, - .barrier_ne = {PG_DATA_CHECKSUM_VERSION}, - .barrier_ne_sz = 1 - }, - /* When enabling the current state must be inprogress-on */ - { - .target = PG_DATA_CHECKSUM_VERSION, - .barrier_eq = {PG_DATA_CHECKSUM_INPROGRESS_ON}, - .barrier_eq_sz = 1, - {0}, 0 - }, + {PG_DATA_CHECKSUM_VERSION, PG_DATA_CHECKSUM_INPROGRESS_OFF}, + {PG_DATA_CHECKSUM_INPROGRESS_OFF, PG_DATA_CHECKSUM_OFF}, /* - * When moving to inprogress-on the current state cannot enabled, but when - * moving to inprogress-off the current state must be enabled. + * If checksums are in the process of being enabled, but are not yet being + * verified, we can abort by going back to 'off' state. */ - { - .target = PG_DATA_CHECKSUM_INPROGRESS_ON, - {0}, 0, - .barrier_ne = {PG_DATA_CHECKSUM_VERSION}, - .barrier_ne_sz = 1 - }, - { - .target = PG_DATA_CHECKSUM_INPROGRESS_OFF, - .barrier_eq = {PG_DATA_CHECKSUM_VERSION}, - .barrier_eq_sz = 1, - {0}, 0 - }, + {PG_DATA_CHECKSUM_INPROGRESS_ON, PG_DATA_CHECKSUM_OFF}, + + /* + * Enabling checksums must normally go through the 'inprogress-on' state. + */ + {PG_DATA_CHECKSUM_OFF, PG_DATA_CHECKSUM_INPROGRESS_ON}, + {PG_DATA_CHECKSUM_INPROGRESS_ON, PG_DATA_CHECKSUM_VERSION}, + + /* + * If checksums are being disabled but all backends are still computing + * checksums, we can go straight back to 'on' + */ + {PG_DATA_CHECKSUM_INPROGRESS_OFF, PG_DATA_CHECKSUM_VERSION}, }; /* @@ -294,10 +268,10 @@ static const ChecksumBarrierCondition checksum_barriers[4] = * * This struct is protected by DataChecksumsWorkerLock */ -typedef struct DataChecksumsWorkerShmemStruct +typedef struct DataChecksumsStateStruct { /* - * These are set by pg_{enable|disable|verify}_data_checksums, to tell the + * These are set by pg_{enable|disable}_data_checksums, to tell the * launcher what the target state is. */ DataChecksumsWorkerOperation launch_operation; @@ -311,10 +285,10 @@ typedef struct DataChecksumsWorkerShmemStruct bool launcher_running; /* - * If a worker process currently running? This is set by the worker + * Is a worker process currently running? This is set by the worker * launcher when it starts waiting for a worker process to finish. */ - bool worker_running; + int worker_running; /* * These fields indicate the target state that the launcher is currently @@ -348,10 +322,10 @@ typedef struct DataChecksumsWorkerShmemStruct * catalogs */ bool process_shared_catalogs; -} DataChecksumsWorkerShmemStruct; +} DataChecksumsStateStruct; /* Shared memory segment for datachecksumsworker */ -static DataChecksumsWorkerShmemStruct *DataChecksumsWorkerShmem; +static DataChecksumsStateStruct *DataChecksumState; typedef struct DataChecksumsWorkerDatabase { @@ -359,21 +333,16 @@ typedef struct DataChecksumsWorkerDatabase char *dbname; } DataChecksumsWorkerDatabase; - -/* - * Flag set by the interrupt handler - */ +/* Flag set by the interrupt handler */ static volatile sig_atomic_t abort_requested = false; /* - * Have we set the DataChecksumsWorkerShmemStruct->launcher_running flag? + * Have we set the DataChecksumsStateStruct->launcher_running flag? * If we have, we need to clear it before exiting! */ static volatile sig_atomic_t launcher_running = false; -/* - * Are we enabling data checksums, or disabling them? - */ +/* Are we enabling data checksums, or disabling them? */ static DataChecksumsWorkerOperation operation; /* Prototypes */ @@ -435,7 +404,6 @@ EmitAndWaitDataChecksumsBarrier(uint32 state) bool AbsorbDataChecksumsBarrier(ProcSignalBarrierType barrier) { - const ChecksumBarrierCondition *condition = NULL; uint32 target_state; int current = data_checksums; bool found = false; @@ -485,38 +453,10 @@ AbsorbDataChecksumsBarrier(ProcSignalBarrierType barrier) * a condition would be a grave programmer error as the states are a * discrete set. */ - for (int i = 0; i < lengthof(checksum_barriers); i++) + for (int i = 0; i < lengthof(checksum_barriers) && !found; i++) { - if (checksum_barriers[i].target == target_state) - condition = &checksum_barriers[i]; - } - Assert(condition); - - /* - * The current state MUST be equal to one of the EQ states defined in this - * barrier condition. If the EQ states array is zero then that implies - * that the current state can match any state, so fastpath check for that - * first. - */ - if (condition->barrier_eq_sz == 0) - found = true; - else - { - for (int i = 0; i < condition->barrier_eq_sz; i++) - { - if (current == condition->barrier_eq[i]) - found = true; - } - } - - /* - * The current state MUST NOT be equal to any of the NE states defined in - * this barrier condition. - */ - for (int i = 0; i < condition->barrier_ne_sz; i++) - { - if (current == condition->barrier_ne[i]) - found = false; + if (checksum_barriers[i].from == current && checksum_barriers[i].to == target_state) + found = true; } /* @@ -614,14 +554,14 @@ StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op, /* Store the desired state in shared memory */ LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - DataChecksumsWorkerShmem->launch_operation = op; - DataChecksumsWorkerShmem->launch_cost_delay = cost_delay; - DataChecksumsWorkerShmem->launch_cost_limit = cost_limit; + DataChecksumState->launch_operation = op; + DataChecksumState->launch_cost_delay = cost_delay; + DataChecksumState->launch_cost_limit = cost_limit; /* Is the launcher already running? If so, what is it doing? */ - launcher_running = DataChecksumsWorkerShmem->launcher_running; + launcher_running = DataChecksumState->launcher_running; if (launcher_running) - launcher_running_op = DataChecksumsWorkerShmem->operation; + launcher_running_op = DataChecksumState->operation; LWLockRelease(DataChecksumsWorkerLock); @@ -733,21 +673,16 @@ ProcessSingleRelationFork(Relation reln, ForkNumber forkNum, BufferAccessStrateg */ Assert(operation == ENABLE_DATACHECKSUMS); LWLockAcquire(DataChecksumsWorkerLock, LW_SHARED); - if (DataChecksumsWorkerShmem->launch_operation == DISABLE_DATACHECKSUMS) + if (DataChecksumState->launch_operation == DISABLE_DATACHECKSUMS) abort_requested = true; LWLockRelease(DataChecksumsWorkerLock); if (abort_requested) return false; - /* - * As of now we only update the block counter for main forks in order - * to not cause too frequent calls. TODO: investigate whether we - * should do it more frequent? - */ - if (forkNum == MAIN_FORKNUM) - pgstat_progress_update_param(PROGRESS_DATACHECKSUMS_BLOCKS_DONE, - (blknum + 1)); + /* update the block counter */ + pgstat_progress_update_param(PROGRESS_DATACHECKSUMS_BLOCKS_DONE, + (blknum + 1)); /* * Processing is re-using the vacuum cost delay for process @@ -826,7 +761,7 @@ ProcessDatabase(DataChecksumsWorkerDatabase *db) pid_t pid; char activity[NAMEDATALEN + 64]; - DataChecksumsWorkerShmem->success = DATACHECKSUMSWORKER_FAILED; + DataChecksumState->success = DATACHECKSUMSWORKER_FAILED; memset(&bgw, 0, sizeof(bgw)); bgw.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; @@ -890,8 +825,9 @@ ProcessDatabase(DataChecksumsWorkerDatabase *db) errmsg("initiating data checksum processing in database \"%s\"", db->dbname)); + /* Save the pid of the worker so we can signal it later */ LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - DataChecksumsWorkerShmem->worker_running = true; + DataChecksumState->worker_running = pid; LWLockRelease(DataChecksumsWorkerLock); snprintf(activity, sizeof(activity) - 1, @@ -906,17 +842,17 @@ ProcessDatabase(DataChecksumsWorkerDatabase *db) db->dbname), errhint("Restart the database and restart data checksum processing by calling pg_enable_data_checksums().")); - if (DataChecksumsWorkerShmem->success == DATACHECKSUMSWORKER_ABORTED) + if (DataChecksumState->success == DATACHECKSUMSWORKER_ABORTED) ereport(LOG, errmsg("data checksums processing was aborted in database \"%s\"", db->dbname)); pgstat_report_activity(STATE_IDLE, NULL); LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - DataChecksumsWorkerShmem->worker_running = false; + DataChecksumState->worker_running = InvalidPid; LWLockRelease(DataChecksumsWorkerLock); - return DataChecksumsWorkerShmem->success; + return DataChecksumState->success; } /* @@ -936,17 +872,23 @@ launcher_exit(int code, Datum arg) { LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); launcher_running = false; - DataChecksumsWorkerShmem->launcher_running = false; + DataChecksumState->launcher_running = false; - /* - * TODO: how to really handle the worker still running when the - * launcher exits? - */ - if (DataChecksumsWorkerShmem->worker_running) + if (DataChecksumState->worker_running != InvalidPid) + { ereport(LOG, - errmsg("data checksums launcher exiting while worker is still running")); + errmsg("data checksums launcher exiting while worker is still running, signalling worker")); + kill(DataChecksumState->worker_running, SIGTERM); + } LWLockRelease(DataChecksumsWorkerLock); } + + /* + * If the launcher is exiting before data checksums are enabled then set + * the state to off since processing cannot be resumed. + */ + if (DataChecksumsInProgress()) + SetDataChecksumsOff(); } /* @@ -1027,7 +969,7 @@ WaitForAllTransactionsToFinish(void) CHECK_FOR_INTERRUPTS(); LWLockAcquire(DataChecksumsWorkerLock, LW_SHARED); - if (DataChecksumsWorkerShmem->launch_operation != operation) + if (DataChecksumState->launch_operation != operation) abort_requested = true; LWLockRelease(DataChecksumsWorkerLock); if (abort_requested) @@ -1068,7 +1010,7 @@ DataChecksumsWorkerLauncherMain(Datum arg) LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - if (DataChecksumsWorkerShmem->launcher_running) + if (DataChecksumState->launcher_running) { ereport(LOG, errmsg("background worker \"datachecksums launcher\" already running, exiting")); @@ -1082,11 +1024,11 @@ DataChecksumsWorkerLauncherMain(Datum arg) /* Initialize a connection to shared catalogs only */ BackgroundWorkerInitializeConnectionByOid(InvalidOid, InvalidOid, 0); - operation = DataChecksumsWorkerShmem->launch_operation; - DataChecksumsWorkerShmem->launcher_running = true; - DataChecksumsWorkerShmem->operation = operation; - DataChecksumsWorkerShmem->cost_delay = DataChecksumsWorkerShmem->launch_cost_delay; - DataChecksumsWorkerShmem->cost_limit = DataChecksumsWorkerShmem->launch_cost_limit; + operation = DataChecksumState->launch_operation; + DataChecksumState->launcher_running = true; + DataChecksumState->operation = operation; + DataChecksumState->cost_delay = DataChecksumState->launch_cost_delay; + DataChecksumState->cost_limit = DataChecksumState->launch_cost_limit; LWLockRelease(DataChecksumsWorkerLock); /* @@ -1109,6 +1051,9 @@ again: if (DataChecksumsNeedVerify()) goto done; + ereport(LOG, + errmsg("enabling data checksums requested, starting data checksum calculation")); + /* * Set the state to inprogress-on and wait on the procsignal barrier. */ @@ -1127,7 +1072,7 @@ again: * failure, so restart processing instead. */ LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - if (DataChecksumsWorkerShmem->launch_operation != operation) + if (DataChecksumState->launch_operation != operation) { LWLockRelease(DataChecksumsWorkerLock); goto done; @@ -1143,12 +1088,20 @@ again: * order to instruct backends to validate checksums on reading. */ SetDataChecksumsOn(); + + ereport(LOG, + errmsg("data checksums are now enabled")); } else if (operation == DISABLE_DATACHECKSUMS) { + ereport(LOG, + errmsg("disabling data checksums requested")); + pgstat_progress_update_param(PROGRESS_DATACHECKSUMS_PHASE, PROGRESS_DATACHECKSUMS_PHASE_DISABLING); SetDataChecksumsOff(); + ereport(LOG, + errmsg("data checksums are now disabled")); } else Assert(false); @@ -1168,12 +1121,12 @@ done: * again. */ LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - if (DataChecksumsWorkerShmem->launch_operation != operation) + if (DataChecksumState->launch_operation != operation) { - DataChecksumsWorkerShmem->operation = DataChecksumsWorkerShmem->launch_operation; - operation = DataChecksumsWorkerShmem->launch_operation; - DataChecksumsWorkerShmem->cost_delay = DataChecksumsWorkerShmem->launch_cost_delay; - DataChecksumsWorkerShmem->cost_limit = DataChecksumsWorkerShmem->launch_cost_limit; + DataChecksumState->operation = DataChecksumState->launch_operation; + operation = DataChecksumState->launch_operation; + DataChecksumState->cost_delay = DataChecksumState->launch_cost_delay; + DataChecksumState->cost_limit = DataChecksumState->launch_cost_limit; LWLockRelease(DataChecksumsWorkerLock); goto again; } @@ -1182,7 +1135,7 @@ done: pgstat_progress_end_command(); launcher_running = false; - DataChecksumsWorkerShmem->launcher_running = false; + DataChecksumState->launcher_running = false; LWLockRelease(DataChecksumsWorkerLock); } @@ -1201,7 +1154,7 @@ ProcessAllDatabases(void) int cumulative_total = 0; /* Set up so first run processes shared catalogs, not once in every db */ - DataChecksumsWorkerShmem->process_shared_catalogs = true; + DataChecksumState->process_shared_catalogs = true; /* Get a list of all databases to process */ WaitForAllTransactionsToFinish(); @@ -1270,7 +1223,7 @@ ProcessAllDatabases(void) * When one database has completed, it will have done shared catalogs * so we don't have to process them again. */ - DataChecksumsWorkerShmem->process_shared_catalogs = false; + DataChecksumState->process_shared_catalogs = false; } FreeDatabaseList(DatabaseList); @@ -1281,35 +1234,35 @@ ProcessAllDatabases(void) } /* - * DataChecksumsWorkerShmemSize + * DataChecksumStateSize * Compute required space for datachecksumsworker-related shared memory */ Size -DataChecksumsWorkerShmemSize(void) +DataChecksumsShmemSize(void) { Size size; - size = sizeof(DataChecksumsWorkerShmemStruct); + size = sizeof(DataChecksumsStateStruct); size = MAXALIGN(size); return size; } /* - * DataChecksumsWorkerShmemInit + * DataChecksumStateInit * Allocate and initialize datachecksumsworker-related shared memory */ void -DataChecksumsWorkerShmemInit(void) +DataChecksumsShmemInit(void) { bool found; - DataChecksumsWorkerShmem = (DataChecksumsWorkerShmemStruct *) + DataChecksumState = (DataChecksumsStateStruct *) ShmemInitStruct("DataChecksumsWorker Data", - DataChecksumsWorkerShmemSize(), + DataChecksumsShmemSize(), &found); if (!found) - MemSet(DataChecksumsWorkerShmem, 0, DataChecksumsWorkerShmemSize()); + MemSet(DataChecksumState, 0, DataChecksumsShmemSize()); } /* @@ -1528,9 +1481,9 @@ DataChecksumsWorkerMain(Datum arg) * implementation detail and care should be taken to avoid it bleeding * through to the user to avoid confusion. */ - Assert(DataChecksumsWorkerShmem->operation == ENABLE_DATACHECKSUMS); - VacuumCostDelay = DataChecksumsWorkerShmem->cost_delay; - VacuumCostLimit = DataChecksumsWorkerShmem->cost_limit; + Assert(DataChecksumState->operation == ENABLE_DATACHECKSUMS); + VacuumCostDelay = DataChecksumState->cost_delay; + VacuumCostLimit = DataChecksumState->cost_limit; VacuumCostActive = (VacuumCostDelay > 0); VacuumCostBalance = 0; VacuumCostPageHit = 0; @@ -1543,7 +1496,7 @@ DataChecksumsWorkerMain(Datum arg) strategy = GetAccessStrategy(BAS_VACUUM); RelationList = BuildRelationList(false, - DataChecksumsWorkerShmem->process_shared_catalogs); + DataChecksumState->process_shared_catalogs); /* Update the total number of relations to be processed in this DB. */ { @@ -1579,7 +1532,7 @@ DataChecksumsWorkerMain(Datum arg) if (aborted) { - DataChecksumsWorkerShmem->success = DATACHECKSUMSWORKER_ABORTED; + DataChecksumState->success = DATACHECKSUMSWORKER_ABORTED; ereport(DEBUG1, errmsg("data checksum processing aborted in database OID %u", dboid)); @@ -1633,14 +1586,14 @@ DataChecksumsWorkerMain(Datum arg) WAIT_EVENT_CHECKSUM_ENABLE_TEMPTABLE_WAIT); LWLockAcquire(DataChecksumsWorkerLock, LW_EXCLUSIVE); - aborted = DataChecksumsWorkerShmem->launch_operation != operation; + aborted = DataChecksumState->launch_operation != operation; LWLockRelease(DataChecksumsWorkerLock); CHECK_FOR_INTERRUPTS(); if (aborted || abort_requested) { - DataChecksumsWorkerShmem->success = DATACHECKSUMSWORKER_ABORTED; + DataChecksumState->success = DATACHECKSUMSWORKER_ABORTED; ereport(LOG, errmsg("data checksum processing aborted in database OID %u", dboid)); @@ -1653,5 +1606,5 @@ DataChecksumsWorkerMain(Datum arg) /* worker done */ pgstat_progress_end_command(); - DataChecksumsWorkerShmem->success = DATACHECKSUMSWORKER_SUCCESSFUL; + DataChecksumState->success = DATACHECKSUMSWORKER_SUCCESSFUL; } diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index d2018860eca..3cc0b0bdd92 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8566,6 +8566,7 @@ buffer_readv_complete_one(PgAioTargetData *td, uint8 buf_off, Buffer buffer, /* the local zero_damaged_pages may differ from the definer's */ if (flags & READ_BUFFERS_IGNORE_CHECKSUM_FAILURES) piv_flags |= PIV_IGNORE_CHECKSUM_FAILURE; + /* * If the buffers are marked for zero on error, we want to log that in * case of a checksum failure. diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index d6826709728..7aab5da3386 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -143,7 +143,7 @@ CalculateShmemSize(void) size = add_size(size, AioShmemSize()); size = add_size(size, WaitLSNShmemSize()); size = add_size(size, LogicalDecodingCtlShmemSize()); - size = add_size(size, DataChecksumsWorkerShmemSize()); + size = add_size(size, DataChecksumsShmemSize()); /* include additional requested shmem from preload libraries */ size = add_size(size, total_addin_request); @@ -312,7 +312,7 @@ CreateOrAttachShmemStructs(void) PgArchShmemInit(); ApplyLauncherShmemInit(); SlotSyncShmemInit(); - DataChecksumsWorkerShmemInit(); + DataChecksumsShmemInit(); /* * Set up other modules that need some shared memory space diff --git a/src/include/postmaster/datachecksum_state.h b/src/include/postmaster/datachecksum_state.h index 8e21b7d673a..343494edcc8 100644 --- a/src/include/postmaster/datachecksum_state.h +++ b/src/include/postmaster/datachecksum_state.h @@ -18,8 +18,8 @@ #include "storage/procsignal.h" /* Shared memory */ -extern Size DataChecksumsWorkerShmemSize(void); -extern void DataChecksumsWorkerShmemInit(void); +extern Size DataChecksumsShmemSize(void); +extern void DataChecksumsShmemInit(void); /* Possible operations the Datachecksumsworker can perform */ typedef enum DataChecksumsWorkerOperation diff --git a/src/test/modules/test_checksums/t/002_restarts.pl b/src/test/modules/test_checksums/t/002_restarts.pl index c63d01f3ba7..bab59be82bd 100644 --- a/src/test/modules/test_checksums/t/002_restarts.pl +++ b/src/test/modules/test_checksums/t/002_restarts.pl @@ -100,7 +100,7 @@ is($result, '9999', 'ensure checksummed pages can be read back'); $result = $node->poll_query_until( 'postgres', - "SELECT count(*) FROM pg_stat_activity WHERE backend_type LIKE 'datachecksumsworker%';", + "SELECT count(*) FROM pg_stat_activity WHERE backend_type LIKE 'datachecksum%';", '0'); is($result, 1, 'await datachecksums worker/launcher termination'); diff --git a/src/test/modules/test_checksums/t/003_standby_restarts.pl b/src/test/modules/test_checksums/t/003_standby_restarts.pl index cc4d964989a..6b016925651 100644 --- a/src/test/modules/test_checksums/t/003_standby_restarts.pl +++ b/src/test/modules/test_checksums/t/003_standby_restarts.pl @@ -89,7 +89,7 @@ is($result, '19998', 'ensure we can safely read all data with checksums'); $result = $node_primary->poll_query_until( 'postgres', - "SELECT count(*) FROM pg_stat_activity WHERE backend_type LIKE 'datachecksumsworker%';", + "SELECT count(*) FROM pg_stat_activity WHERE backend_type LIKE 'datachecksum%';", '0'); is($result, 1, 'await datachecksums worker/launcher termination'); diff --git a/src/test/modules/test_checksums/test_checksums.c b/src/test/modules/test_checksums/test_checksums.c index 6ac715a76f7..edded415931 100644 --- a/src/test/modules/test_checksums/test_checksums.c +++ b/src/test/modules/test_checksums/test_checksums.c @@ -22,7 +22,6 @@ PG_MODULE_MAGIC; extern PGDLLEXPORT void dc_delay_barrier(const char *name, const void *private_data, void *arg); -extern PGDLLEXPORT void dc_fail_database(const char *name, const void *private_data, void *arg); extern PGDLLEXPORT void dc_modify_db_result(const char *name, const void *private_data, void *arg); extern PGDLLEXPORT void dc_fake_temptable(const char *name, const void *private_data, void *arg); @@ -115,7 +114,7 @@ void dc_modify_db_result(const char *name, const void *private_data, void *arg) { DataChecksumsWorkerResult *res = (DataChecksumsWorkerResult *) arg; - int new_res = *(int *) private_data; + uint32 new_res = *(uint32 *) private_data; *res = new_res; } diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index 892117d113a..61132ee3377 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -631,7 +631,7 @@ DSMRegistryEntry DWORD DataChecksumsWorkerDatabase DataChecksumsWorkerResult -DataChecksumsWorkerShmemStruct +DataChecksumsStateStruct DataDirSyncMethod DataDumperPtr DataPageDeleteStack