Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb21f5b

Browse filesBrowse files
committed
Remove redundant SetProcessingMode(InitProcessing) calls
After several refactoring iterations, auxiliary processes are no longer initialized from the bootstrapper. Using the InitProcessing mode for initializing auxiliary processes is more appropriate. Since the global variable Mode is initialized to InitProcessing, we can just remove the redundant calls of SetProcessingMode(InitProcessing). Author: Xing Guo <higuoxing@gmail.com> Discussion: https://www.postgresql.org/message-id/CACpMh%2BDBHVT4xPGimzvex%3DwMdMLQEu9PYhT%2BkwwD2x2nu9dU_Q%40mail.gmail.com
1 parent 4d22173 commit eb21f5b
Copy full SHA for eb21f5b

File tree

Expand file treeCollapse file tree

5 files changed

+7
-6
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+7
-6
lines changed

‎src/backend/postmaster/autovacuum.c

Copy file name to clipboardExpand all lines: src/backend/postmaster/autovacuum.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ AutoVacLauncherMain(char *startup_data, size_t startup_data_len)
380380
if (PostAuthDelay)
381381
pg_usleep(PostAuthDelay * 1000000L);
382382

383-
SetProcessingMode(InitProcessing);
383+
Assert(GetProcessingMode() == InitProcessing);
384384

385385
/*
386386
* Set up signal handlers. We operate on databases much like a regular
@@ -1373,7 +1373,7 @@ AutoVacWorkerMain(char *startup_data, size_t startup_data_len)
13731373
MyBackendType = B_AUTOVAC_WORKER;
13741374
init_ps_display(NULL);
13751375

1376-
SetProcessingMode(InitProcessing);
1376+
Assert(GetProcessingMode() == InitProcessing);
13771377

13781378
/*
13791379
* Set up signal handlers. We operate on databases much like a regular

‎src/backend/postmaster/auxprocess.c

Copy file name to clipboardExpand all lines: src/backend/postmaster/auxprocess.c
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ AuxiliaryProcessMainCommon(void)
5454

5555
init_ps_display(NULL);
5656

57-
SetProcessingMode(BootstrapProcessing);
57+
Assert(GetProcessingMode() == InitProcessing);
58+
5859
IgnoreSystemIndexes = true;
5960

6061
/*

‎src/backend/postmaster/bgworker.c

Copy file name to clipboardExpand all lines: src/backend/postmaster/bgworker.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ BackgroundWorkerMain(char *startup_data, size_t startup_data_len)
746746
MyBackendType = B_BG_WORKER;
747747
init_ps_display(worker->bgw_name);
748748

749-
SetProcessingMode(InitProcessing);
749+
Assert(GetProcessingMode() == InitProcessing);
750750

751751
/* Apply PostAuthDelay */
752752
if (PostAuthDelay > 0)

‎src/backend/replication/logical/slotsync.c

Copy file name to clipboardExpand all lines: src/backend/replication/logical/slotsync.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len)
13421342

13431343
init_ps_display(NULL);
13441344

1345-
SetProcessingMode(InitProcessing);
1345+
Assert(GetProcessingMode() == InitProcessing);
13461346

13471347
/*
13481348
* Create a per-backend PGPROC struct in shared memory. We must do this

‎src/backend/tcop/postgres.c

Copy file name to clipboardExpand all lines: src/backend/tcop/postgres.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4161,7 +4161,7 @@ PostgresMain(const char *dbname, const char *username)
41614161
Assert(dbname != NULL);
41624162
Assert(username != NULL);
41634163

4164-
SetProcessingMode(InitProcessing);
4164+
Assert(GetProcessingMode() == InitProcessing);
41654165

41664166
/*
41674167
* Set up signal handlers. (InitPostmasterChild or InitStandaloneProcess

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.