1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Use MyBackendType in more places to check what process this is

Remove IsBackgroundWorker, IsAutoVacuumLauncherProcess(),
IsAutoVacuumWorkerProcess(), and IsLogicalSlotSyncWorker() in favor of
new Am*Process() macros that use MyBackendType. For consistency with
the existing Am*Process() macros.

Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/f3ecd4cb-85ee-4e54-8278-5fabfb3a4ed0@iki.fi
This commit is contained in:
Heikki Linnakangas
2024-03-04 10:25:12 +02:00
parent 067701f577
commit 393b5599e5
20 changed files with 42 additions and 91 deletions

View File

@ -113,9 +113,6 @@ static long sleep_ms = MIN_SLOTSYNC_WORKER_NAPTIME_MS;
/* The restart interval for slot sync work used by postmaster */
#define SLOTSYNC_RESTART_INTERVAL_SEC 10
/* Flag to tell if we are in a slot sync worker process */
static bool am_slotsync_worker = false;
/*
* Flag to tell if we are syncing replication slots. Unlike the 'syncing' flag
* in SlotSyncCtxStruct, this flag is true only if the current process is
@ -491,7 +488,7 @@ synchronize_one_slot(RemoteSlot *remote_slot, Oid remote_dbid)
latestFlushPtr = GetStandbyFlushRecPtr(NULL);
if (remote_slot->confirmed_lsn > latestFlushPtr)
{
ereport(am_slotsync_worker ? LOG : ERROR,
ereport(AmLogicalSlotSyncWorkerProcess() ? LOG : ERROR,
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("skipping slot synchronization as the received slot sync"
" LSN %X/%X for slot \"%s\" is ahead of the standby position %X/%X",
@ -1114,8 +1111,6 @@ ReplSlotSyncWorkerMain(int argc, char *argv[])
sigjmp_buf local_sigjmp_buf;
StringInfoData app_name;
am_slotsync_worker = true;
MyBackendType = B_SLOTSYNC_WORKER;
init_ps_display(NULL);
@ -1438,15 +1433,6 @@ IsSyncingReplicationSlots(void)
return syncing_slots;
}
/*
* Is current process a slot sync worker?
*/
bool
IsLogicalSlotSyncWorker(void)
{
return am_slotsync_worker;
}
/*
* Amount of shared memory required for slot synchronization.
*/