Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c67946

Browse files
committed
Add BackendType for standalone backends
All backends should have a BackendType to enable statistics reporting per BackendType. Add a new BackendType for standalone backends, B_STANDALONE_BACKEND (and alphabetize the BackendTypes). Both the bootstrap backend and single user mode backends will have BackendType B_STANDALONE_BACKEND. Author: Melanie Plageman <[email protected]> Reviewed-by: Andres Freund <[email protected]> Discussion: https://www.postgresql.org/message-id/CAAKRu_aaq33UnG4TXq3S-OSXGWj1QGf0sU%2BECH4tNwGFNERkZA%40mail.gmail.com
1 parent cd06334 commit 0c67946

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/backend/utils/init/miscinit.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ InitStandaloneProcess(const char *argv0)
176176
{
177177
Assert(!IsPostmasterEnvironment);
178178

179+
MyBackendType = B_STANDALONE_BACKEND;
180+
179181
/*
180182
* Start our win32 signal implementation
181183
*/
@@ -255,6 +257,9 @@ GetBackendTypeDesc(BackendType backendType)
255257
case B_INVALID:
256258
backendDesc = "not initialized";
257259
break;
260+
case B_ARCHIVER:
261+
backendDesc = "archiver";
262+
break;
258263
case B_AUTOVAC_LAUNCHER:
259264
backendDesc = "autovacuum launcher";
260265
break;
@@ -273,6 +278,12 @@ GetBackendTypeDesc(BackendType backendType)
273278
case B_CHECKPOINTER:
274279
backendDesc = "checkpointer";
275280
break;
281+
case B_LOGGER:
282+
backendDesc = "logger";
283+
break;
284+
case B_STANDALONE_BACKEND:
285+
backendDesc = "standalone backend";
286+
break;
276287
case B_STARTUP:
277288
backendDesc = "startup";
278289
break;
@@ -285,12 +296,6 @@ GetBackendTypeDesc(BackendType backendType)
285296
case B_WAL_WRITER:
286297
backendDesc = "walwriter";
287298
break;
288-
case B_ARCHIVER:
289-
backendDesc = "archiver";
290-
break;
291-
case B_LOGGER:
292-
backendDesc = "logger";
293-
break;
294299
}
295300

296301
return backendDesc;

src/include/miscadmin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,19 @@ extern void SwitchBackToLocalLatch(void);
316316
typedef enum BackendType
317317
{
318318
B_INVALID = 0,
319+
B_ARCHIVER,
319320
B_AUTOVAC_LAUNCHER,
320321
B_AUTOVAC_WORKER,
321322
B_BACKEND,
322323
B_BG_WORKER,
323324
B_BG_WRITER,
324325
B_CHECKPOINTER,
326+
B_LOGGER,
327+
B_STANDALONE_BACKEND,
325328
B_STARTUP,
326329
B_WAL_RECEIVER,
327330
B_WAL_SENDER,
328331
B_WAL_WRITER,
329-
B_ARCHIVER,
330-
B_LOGGER,
331332
} BackendType;
332333

333334
extern PGDLLIMPORT BackendType MyBackendType;

0 commit comments

Comments
 (0)