summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorHeikki Linnakangas2024-03-04 08:25:12 +0000
committerHeikki Linnakangas2024-03-04 08:25:12 +0000
commit393b5599e5177e456cdce500039813629d370b38 (patch)
treebafd118d5dd94f63bcc711457a6d9c9248064051 /src/include
parent067701f57758f9baed5bd9d868539738d77bfa92 (diff)
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
Diffstat (limited to 'src/include')
-rw-r--r--src/include/miscadmin.h6
-rw-r--r--src/include/postmaster/autovacuum.h5
-rw-r--r--src/include/replication/slotsync.h1
3 files changed, 5 insertions, 7 deletions
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 712f4ad68a1..f900da61573 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -165,7 +165,6 @@ do { \
extern PGDLLIMPORT pid_t PostmasterPid;
extern PGDLLIMPORT bool IsPostmasterEnvironment;
extern PGDLLIMPORT bool IsUnderPostmaster;
-extern PGDLLIMPORT bool IsBackgroundWorker;
extern PGDLLIMPORT bool IsBinaryUpgrade;
extern PGDLLIMPORT bool ExitOnAnyError;
@@ -369,6 +368,11 @@ typedef enum BackendType
extern PGDLLIMPORT BackendType MyBackendType;
+#define AmAutoVacuumLauncherProcess() (MyBackendType == B_AUTOVAC_LAUNCHER)
+#define AmAutoVacuumWorkerProcess() (MyBackendType == B_AUTOVAC_WORKER)
+#define AmBackgroundWorkerProcess() (MyBackendType == B_BG_WORKER)
+#define AmWalSenderProcess() (MyBackendType == B_WAL_SENDER)
+#define AmLogicalSlotSyncWorkerProcess() (MyBackendType == B_SLOTSYNC_WORKER)
#define AmArchiverProcess() (MyBackendType == B_ARCHIVER)
#define AmBackgroundWriterProcess() (MyBackendType == B_BG_WRITER)
#define AmCheckpointerProcess() (MyBackendType == B_CHECKPOINTER)
diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h
index 1994aedef03..80cf4cdd969 100644
--- a/src/include/postmaster/autovacuum.h
+++ b/src/include/postmaster/autovacuum.h
@@ -49,11 +49,6 @@ extern PGDLLIMPORT int Log_autovacuum_min_duration;
/* Status inquiry functions */
extern bool AutoVacuumingActive(void);
-extern bool IsAutoVacuumLauncherProcess(void);
-extern bool IsAutoVacuumWorkerProcess(void);
-
-#define IsAnyAutoVacuumProcess() \
- (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())
/* Functions to start autovacuum process, called from postmaster */
extern void autovac_init(void);
diff --git a/src/include/replication/slotsync.h b/src/include/replication/slotsync.h
index 726d65f9b62..dca57c50204 100644
--- a/src/include/replication/slotsync.h
+++ b/src/include/replication/slotsync.h
@@ -34,7 +34,6 @@ extern int StartSlotSyncWorker(void);
extern void ShutDownSlotSync(void);
extern bool SlotSyncWorkerCanRestart(void);
extern bool IsSyncingReplicationSlots(void);
-extern bool IsLogicalSlotSyncWorker(void);
extern Size SlotSyncShmemSize(void);
extern void SlotSyncShmemInit(void);
extern void SyncReplicationSlots(WalReceiverConn *wrconn);