diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/bootstrap/bootstrap.h | 12 | ||||
-rw-r--r-- | src/include/miscadmin.h | 42 | ||||
-rw-r--r-- | src/include/replication/walreceiver.h | 1 |
3 files changed, 36 insertions, 19 deletions
diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index b31bca94110..58fc2825b86 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -16,18 +16,6 @@ #include "nodes/execnodes.h" -typedef enum -{ - CheckerProcess, - BootstrapProcess, - StartupProcess, - BgWriterProcess, - CheckpointerProcess, - WalWriterProcess, - WalReceiverProcess, - - NUM_AUXPROCTYPES /* Must be last! */ -} AuxProcType; /* * MAXATTR is the maximum number of attributes in a relation supported diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index b186eed8f47..8df2a28126a 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -328,8 +328,8 @@ extern bool superuser_arg(Oid roleid); /* given user is superuser */ * initialization is complete. Some code behaves differently when executed * in this mode to enable system bootstrapping. * - * If a POSTGRES binary is in normal mode, then all code may be executed - * normally. + * If a POSTGRES backend process is in normal mode, then all code may be + * executed normally. */ typedef enum ProcessingMode @@ -341,9 +341,11 @@ typedef enum ProcessingMode extern ProcessingMode Mode; -#define IsBootstrapProcessingMode() ((bool)(Mode == BootstrapProcessing)) -#define IsInitProcessingMode() ((bool)(Mode == InitProcessing)) -#define IsNormalProcessingMode() ((bool)(Mode == NormalProcessing)) +#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing) +#define IsInitProcessingMode() (Mode == InitProcessing) +#define IsNormalProcessingMode() (Mode == NormalProcessing) + +#define GetProcessingMode() Mode #define SetProcessingMode(mode) \ do { \ @@ -353,7 +355,35 @@ extern ProcessingMode Mode; Mode = (mode); \ } while(0) -#define GetProcessingMode() Mode + +/* + * Auxiliary-process type identifiers. These used to be in bootstrap.h + * but it seems saner to have them here, with the ProcessingMode stuff. + * The MyAuxProcType global is defined and set in bootstrap.c. + */ + +typedef enum +{ + NotAnAuxProcess = -1, + CheckerProcess = 0, + BootstrapProcess, + StartupProcess, + BgWriterProcess, + CheckpointerProcess, + WalWriterProcess, + WalReceiverProcess, + + NUM_AUXPROCTYPES /* Must be last! */ +} AuxProcType; + +extern AuxProcType MyAuxProcType; + +#define AmBootstrapProcess() (MyAuxProcType == BootstrapProcess) +#define AmStartupProcess() (MyAuxProcType == StartupProcess) +#define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess) +#define AmCheckpointerProcess() (MyAuxProcType == CheckpointerProcess) +#define AmWalWriterProcess() (MyAuxProcType == WalWriterProcess) +#define AmWalReceiverProcess() (MyAuxProcType == WalReceiverProcess) /***************************************************************************** diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h index 31449d214ec..8ef67f8a867 100644 --- a/src/include/replication/walreceiver.h +++ b/src/include/replication/walreceiver.h @@ -17,7 +17,6 @@ #include "storage/spin.h" #include "pgtime.h" -extern bool am_walreceiver; extern int wal_receiver_status_interval; extern bool hot_standby_feedback; |