Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
149e38e5
Commit
149e38e5
authored
Aug 01, 2013
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assorted bgworker-related comment fixes.
Per gripes by Amit Kapila.
parent
813fb031
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
src/backend/postmaster/bgworker.c
src/backend/postmaster/bgworker.c
+5
-7
src/include/postmaster/bgworker.h
src/include/postmaster/bgworker.h
+7
-5
No files found.
src/backend/postmaster/bgworker.c
View file @
149e38e5
...
@@ -134,17 +134,15 @@ BackgroundWorkerShmemInit(void)
...
@@ -134,17 +134,15 @@ BackgroundWorkerShmemInit(void)
Assert
(
found
);
Assert
(
found
);
}
}
/*
* Search the postmaster's backend-private list of RegisteredBgWorker objects
* for the one that maps to the given slot number.
*/
static
RegisteredBgWorker
*
static
RegisteredBgWorker
*
FindRegisteredWorkerBySlotNumber
(
int
slotno
)
FindRegisteredWorkerBySlotNumber
(
int
slotno
)
{
{
slist_iter
siter
;
slist_iter
siter
;
/*
* Copy contents of worker list into shared memory. Record the
* shared memory slot assigned to each worker. This ensures
* a 1-to-1 correspondence betwen the postmaster's private list and
* the array in shared memory.
*/
slist_foreach
(
siter
,
&
BackgroundWorkerList
)
slist_foreach
(
siter
,
&
BackgroundWorkerList
)
{
{
RegisteredBgWorker
*
rw
;
RegisteredBgWorker
*
rw
;
...
@@ -158,7 +156,7 @@ FindRegisteredWorkerBySlotNumber(int slotno)
...
@@ -158,7 +156,7 @@ FindRegisteredWorkerBySlotNumber(int slotno)
}
}
/*
/*
* Notice changes to shared
_
memory made by other backends. This code
* Notice changes to shared
memory made by other backends. This code
* runs in the postmaster, so we must be very careful not to assume that
* runs in the postmaster, so we must be very careful not to assume that
* shared memory contents are sane. Otherwise, a rogue backend could take
* shared memory contents are sane. Otherwise, a rogue backend could take
* out the postmaster.
* out the postmaster.
...
...
src/include/postmaster/bgworker.h
View file @
149e38e5
...
@@ -6,11 +6,13 @@
...
@@ -6,11 +6,13 @@
* including normal transactions.
* including normal transactions.
*
*
* Any external module loaded via shared_preload_libraries can register a
* Any external module loaded via shared_preload_libraries can register a
* worker. Then, at the appropriate time, the worker process is forked from
* worker. Workers can also be registered dynamically at runtime. In either
* the postmaster and runs the user-supplied "main" function. This code may
* case, the worker process is forked from the postmaster and runs the
* connect to a database and run transactions. Once started, it stays active
* user-supplied "main" function. This code may connect to a database and
* until shutdown or crash. The process should sleep during periods of
* run transactions. Once started, it stays active until shutdown or crash;
* inactivity.
* unless the restart interval is declared as BGW_NEVER_RESTART and the
* process exits with a return code of 1; workers that do this are
* automatically unregistered by the postmaster.
*
*
* If the fork() call fails in the postmaster, it will try again later. Note
* If the fork() call fails in the postmaster, it will try again later. Note
* that the failure can only be transient (fork failure due to high load,
* that the failure can only be transient (fork failure due to high load,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment