Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit149e38e

Browse files
committed
Assorted bgworker-related comment fixes.
Per gripes by Amit Kapila.
1 parent813fb03 commit149e38e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

‎src/backend/postmaster/bgworker.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,15 @@ BackgroundWorkerShmemInit(void)
134134
Assert(found);
135135
}
136136

137+
/*
138+
* Search the postmaster's backend-private list of RegisteredBgWorker objects
139+
* for the one that maps to the given slot number.
140+
*/
137141
staticRegisteredBgWorker*
138142
FindRegisteredWorkerBySlotNumber(intslotno)
139143
{
140144
slist_itersiter;
141145

142-
/*
143-
* Copy contents of worker list into shared memory. Record the
144-
* shared memory slot assigned to each worker. This ensures
145-
* a 1-to-1 correspondence betwen the postmaster's private list and
146-
* the array in shared memory.
147-
*/
148146
slist_foreach(siter,&BackgroundWorkerList)
149147
{
150148
RegisteredBgWorker*rw;
@@ -158,7 +156,7 @@ FindRegisteredWorkerBySlotNumber(int slotno)
158156
}
159157

160158
/*
161-
* Notice changes toshared_memory made by other backends. This code
159+
* Notice changes toshared memory made by other backends. This code
162160
* runs in the postmaster, so we must be very careful not to assume that
163161
* shared memory contents are sane. Otherwise, a rogue backend could take
164162
* out the postmaster.

‎src/include/postmaster/bgworker.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
* including normal transactions.
77
*
88
* Any external module loaded via shared_preload_libraries can register a
9-
* worker.Then, at the appropriate time, the worker process is forked from
10-
* the postmaster and runs the user-supplied "main" function. This code may
11-
* connect to a database and run transactions.Once started, it stays active
12-
* until shutdown or crash. The process should sleep during periods of
13-
* inactivity.
9+
* worker.Workers can also be registered dynamically at runtime. In either
10+
* case, the worker process is forked from the postmaster and runs the
11+
* user-supplied "main" function. This code may connect to a database and
12+
* run transactions. Once started, it stays active until shutdown or crash;
13+
* unless the restart interval is declared as BGW_NEVER_RESTART and the
14+
* process exits with a return code of 1; workers that do this are
15+
* automatically unregistered by the postmaster.
1416
*
1517
* If the fork() call fails in the postmaster, it will try again later. Note
1618
* that the failure can only be transient (fork failure due to high load,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp