mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Remove tabs after spaces in C comments
This was not changed in HEAD, but will be done later as part of a pgindent run. Future pgindent runs will also do this. Report by Tom Lane Backpatch through all supported branches, but not HEAD
This commit is contained in:
@@ -21,21 +21,21 @@
|
||||
* There is an autovacuum shared memory area, where the launcher stores
|
||||
* information about the database it wants vacuumed. When it wants a new
|
||||
* worker to start, it sets a flag in shared memory and sends a signal to the
|
||||
* postmaster. Then postmaster knows nothing more than it must start a worker;
|
||||
* so it forks a new child, which turns into a worker. This new process
|
||||
* postmaster. Then postmaster knows nothing more than it must start a worker;
|
||||
* so it forks a new child, which turns into a worker. This new process
|
||||
* connects to shared memory, and there it can inspect the information that the
|
||||
* launcher has set up.
|
||||
*
|
||||
* If the fork() call fails in the postmaster, it sets a flag in the shared
|
||||
* memory area, and sends a signal to the launcher. The launcher, upon
|
||||
* noticing the flag, can try starting the worker again by resending the
|
||||
* signal. Note that the failure can only be transient (fork failure due to
|
||||
* signal. Note that the failure can only be transient (fork failure due to
|
||||
* high load, memory pressure, too many processes, etc); more permanent
|
||||
* problems, like failure to connect to a database, are detected later in the
|
||||
* worker and dealt with just by having the worker exit normally. The launcher
|
||||
* will launch a new worker again later, per schedule.
|
||||
*
|
||||
* When the worker is done vacuuming it sends SIGUSR2 to the launcher. The
|
||||
* When the worker is done vacuuming it sends SIGUSR2 to the launcher. The
|
||||
* launcher then wakes up and is able to launch another worker, if the schedule
|
||||
* is so tight that a new worker is needed immediately. At this time the
|
||||
* launcher can also balance the settings for the various remaining workers'
|
||||
@@ -243,7 +243,7 @@ typedef enum
|
||||
|
||||
/*-------------
|
||||
* The main autovacuum shmem struct. On shared memory we store this main
|
||||
* struct and the array of WorkerInfo structs. This struct keeps:
|
||||
* struct and the array of WorkerInfo structs. This struct keeps:
|
||||
*
|
||||
* av_signal set by other processes to indicate various conditions
|
||||
* av_launcherpid the PID of the autovacuum launcher
|
||||
@@ -430,7 +430,7 @@ AutoVacLauncherMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (autovacuum probably never has any
|
||||
* can signal any child processes too. (autovacuum probably never has any
|
||||
* child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -440,7 +440,7 @@ AutoVacLauncherMain(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up signal handlers. We operate on databases much like a regular
|
||||
* Set up signal handlers. We operate on databases much like a regular
|
||||
* backend, so we use the same signal handling. See equivalent code in
|
||||
* tcop/postgres.c.
|
||||
*/
|
||||
@@ -547,7 +547,7 @@ AutoVacLauncherMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* Force zero_damaged_pages OFF in the autovac process, even if it is set
|
||||
* in postgresql.conf. We don't really want such a dangerous option being
|
||||
* in postgresql.conf. We don't really want such a dangerous option being
|
||||
* applied non-interactively.
|
||||
*/
|
||||
SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
|
||||
@@ -870,7 +870,7 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
|
||||
* this the "new" database, because when the database was already present on
|
||||
* the list, we expect that this function is not called at all). The
|
||||
* preexisting list, if any, will be used to preserve the order of the
|
||||
* databases in the autovacuum_naptime period. The new database is put at the
|
||||
* databases in the autovacuum_naptime period. The new database is put at the
|
||||
* end of the interval. The actual values are not saved, which should not be
|
||||
* much of a problem.
|
||||
*/
|
||||
@@ -1074,7 +1074,7 @@ db_comparator(const void *a, const void *b)
|
||||
*
|
||||
* Bare-bones procedure for starting an autovacuum worker from the launcher.
|
||||
* It determines what database to work on, sets up shared memory stuff and
|
||||
* signals postmaster to start the worker. It fails gracefully if invoked when
|
||||
* signals postmaster to start the worker. It fails gracefully if invoked when
|
||||
* autovacuum_workers are already active.
|
||||
*
|
||||
* Return value is the OID of the database that the worker is going to process,
|
||||
@@ -1346,7 +1346,7 @@ launch_worker(TimestampTz now)
|
||||
|
||||
/*
|
||||
* Called from postmaster to signal a failure to fork a process to become
|
||||
* worker. The postmaster should kill(SIGUSR2) the launcher shortly
|
||||
* worker. The postmaster should kill(SIGUSR2) the launcher shortly
|
||||
* after calling this function.
|
||||
*/
|
||||
void
|
||||
@@ -1498,7 +1498,7 @@ AutoVacWorkerMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (autovacuum probably never has any
|
||||
* can signal any child processes too. (autovacuum probably never has any
|
||||
* child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -1508,7 +1508,7 @@ AutoVacWorkerMain(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up signal handlers. We operate on databases much like a regular
|
||||
* Set up signal handlers. We operate on databases much like a regular
|
||||
* backend, so we use the same signal handling. See equivalent code in
|
||||
* tcop/postgres.c.
|
||||
*
|
||||
@@ -1559,7 +1559,7 @@ AutoVacWorkerMain(int argc, char *argv[])
|
||||
EmitErrorReport();
|
||||
|
||||
/*
|
||||
* We can now go away. Note that because we called InitProcess, a
|
||||
* We can now go away. Note that because we called InitProcess, a
|
||||
* callback was registered to do ProcKill, which will clean up
|
||||
* necessary state.
|
||||
*/
|
||||
@@ -1573,7 +1573,7 @@ AutoVacWorkerMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* Force zero_damaged_pages OFF in the autovac process, even if it is set
|
||||
* in postgresql.conf. We don't really want such a dangerous option being
|
||||
* in postgresql.conf. We don't really want such a dangerous option being
|
||||
* applied non-interactively.
|
||||
*/
|
||||
SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
|
||||
@@ -1701,7 +1701,7 @@ FreeWorkerInfo(int code, Datum arg)
|
||||
/*
|
||||
* Wake the launcher up so that he can launch a new worker immediately
|
||||
* if required. We only save the launcher's PID in local memory here;
|
||||
* the actual signal will be sent when the PGPROC is recycled. Note
|
||||
* the actual signal will be sent when the PGPROC is recycled. Note
|
||||
* that we always do this, so that the launcher can rebalance the cost
|
||||
* limit setting of the remaining workers.
|
||||
*
|
||||
@@ -1809,7 +1809,7 @@ autovac_balance_cost(void)
|
||||
|
||||
/*
|
||||
* We put a lower bound of 1 on the cost_limit, to avoid division-
|
||||
* by-zero in the vacuum code. Also, in case of roundoff trouble
|
||||
* by-zero in the vacuum code. Also, in case of roundoff trouble
|
||||
* in these calculations, let's be sure we don't ever set
|
||||
* cost_limit to more than the base value.
|
||||
*/
|
||||
@@ -1852,7 +1852,7 @@ get_database_list(void)
|
||||
/*
|
||||
* Start a transaction so we can access pg_database, and get a snapshot.
|
||||
* We don't have a use for the snapshot itself, but we're interested in
|
||||
* the secondary effect that it sets RecentGlobalXmin. (This is critical
|
||||
* the secondary effect that it sets RecentGlobalXmin. (This is critical
|
||||
* for anything that reads heap pages, because HOT may decide to prune
|
||||
* them even if the process doesn't attempt to modify any tuples.)
|
||||
*/
|
||||
@@ -2269,14 +2269,14 @@ do_autovacuum(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Ok, good to go. Store the table in shared memory before releasing
|
||||
* Ok, good to go. Store the table in shared memory before releasing
|
||||
* the lock so that other workers don't vacuum it concurrently.
|
||||
*/
|
||||
MyWorkerInfo->wi_tableoid = relid;
|
||||
LWLockRelease(AutovacuumScheduleLock);
|
||||
|
||||
/*
|
||||
* Remember the prevailing values of the vacuum cost GUCs. We have to
|
||||
* Remember the prevailing values of the vacuum cost GUCs. We have to
|
||||
* restore these at the bottom of the loop, else we'll compute wrong
|
||||
* values in the next iteration of autovac_balance_cost().
|
||||
*/
|
||||
@@ -2305,7 +2305,7 @@ do_autovacuum(void)
|
||||
|
||||
/*
|
||||
* Save the relation name for a possible error message, to avoid a
|
||||
* catalog lookup in case of an error. If any of these return NULL,
|
||||
* catalog lookup in case of an error. If any of these return NULL,
|
||||
* then the relation has been dropped since last we checked; skip it.
|
||||
* Note: they must live in a long-lived memory context because we call
|
||||
* vacuum and analyze in different transactions.
|
||||
@@ -2759,7 +2759,7 @@ relation_needs_vacanalyze(Oid relid,
|
||||
{
|
||||
/*
|
||||
* Skip a table not found in stat hash, unless we have to force vacuum
|
||||
* for anti-wrap purposes. If it's not acted upon, there's no need to
|
||||
* for anti-wrap purposes. If it's not acted upon, there's no need to
|
||||
* vacuum it.
|
||||
*/
|
||||
*dovacuum = force_vacuum;
|
||||
@@ -2961,7 +2961,7 @@ AutoVacuumShmemInit(void)
|
||||
* Refresh pgstats data for an autovacuum process
|
||||
*
|
||||
* Cause the next pgstats read operation to obtain fresh data, but throttle
|
||||
* such refreshing in the autovacuum launcher. This is mostly to avoid
|
||||
* such refreshing in the autovacuum launcher. This is mostly to avoid
|
||||
* rereading the pgstats files too many times in quick succession when there
|
||||
* are many databases.
|
||||
*
|
||||
|
@@ -2,11 +2,11 @@
|
||||
*
|
||||
* bgwriter.c
|
||||
*
|
||||
* The background writer (bgwriter) is new as of Postgres 8.0. It attempts
|
||||
* The background writer (bgwriter) is new as of Postgres 8.0. It attempts
|
||||
* to keep regular backends from having to write out dirty shared buffers
|
||||
* (which they would only do when needing to free a shared buffer to read in
|
||||
* another page). In the best scenario all writes from shared buffers will
|
||||
* be issued by the background writer process. However, regular backends are
|
||||
* be issued by the background writer process. However, regular backends are
|
||||
* still empowered to issue writes if the bgwriter fails to maintain enough
|
||||
* clean shared buffers.
|
||||
*
|
||||
@@ -99,7 +99,7 @@ BackgroundWriterMain(void)
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (bgwriter probably never has any
|
||||
* can signal any child processes too. (bgwriter probably never has any
|
||||
* child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -172,7 +172,7 @@ BackgroundWriterMain(void)
|
||||
|
||||
/*
|
||||
* These operations are really just a minimal subset of
|
||||
* AbortTransaction(). We don't have very many resources to worry
|
||||
* AbortTransaction(). We don't have very many resources to worry
|
||||
* about in bgwriter, but we do have LWLocks, buffers, and temp files.
|
||||
*/
|
||||
LWLockReleaseAll();
|
||||
@@ -269,7 +269,7 @@ BackgroundWriterMain(void)
|
||||
if (FirstCallSinceLastCheckpoint())
|
||||
{
|
||||
/*
|
||||
* After any checkpoint, close all smgr files. This is so we
|
||||
* After any checkpoint, close all smgr files. This is so we
|
||||
* won't hang onto smgr references to deleted files indefinitely.
|
||||
*/
|
||||
smgrcloseall();
|
||||
@@ -304,7 +304,7 @@ BackgroundWriterMain(void)
|
||||
* and the time we call StrategyNotifyBgWriter. While it's not
|
||||
* critical that we not hibernate anyway, we try to reduce the odds of
|
||||
* that by only hibernating when BgBufferSync says nothing's happening
|
||||
* for two consecutive cycles. Also, we mitigate any possible
|
||||
* for two consecutive cycles. Also, we mitigate any possible
|
||||
* consequences of a missed wakeup by not hibernating forever.
|
||||
*/
|
||||
if (rc == WL_TIMEOUT && can_hibernate && prev_hibernate)
|
||||
@@ -358,7 +358,7 @@ bg_quickdie(SIGNAL_ARGS)
|
||||
on_exit_reset();
|
||||
|
||||
/*
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
|
||||
* backend. This is necessary precisely because we don't clean up our
|
||||
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* checkpointer.c
|
||||
*
|
||||
* The checkpointer is new as of Postgres 9.2. It handles all checkpoints.
|
||||
* The checkpointer is new as of Postgres 9.2. It handles all checkpoints.
|
||||
* Checkpoints are automatically dispatched after a certain amount of time has
|
||||
* elapsed since the last one, and it can be signaled to perform requested
|
||||
* checkpoints as well. (The GUC parameter that mandates a checkpoint every
|
||||
@@ -14,7 +14,7 @@
|
||||
* subprocess finishes, or as soon as recovery begins if we are doing archive
|
||||
* recovery. It remains alive until the postmaster commands it to terminate.
|
||||
* Normal termination is by SIGUSR2, which instructs the checkpointer to
|
||||
* execute a shutdown checkpoint and then exit(0). (All backends must be
|
||||
* execute a shutdown checkpoint and then exit(0). (All backends must be
|
||||
* stopped before SIGUSR2 is issued!) Emergency termination is by SIGQUIT;
|
||||
* like any backend, the checkpointer will simply abort and exit on SIGQUIT.
|
||||
*
|
||||
@@ -198,7 +198,7 @@ CheckpointerMain(void)
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (checkpointer probably never has
|
||||
* can signal any child processes too. (checkpointer probably never has
|
||||
* any child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -211,7 +211,7 @@ CheckpointerMain(void)
|
||||
* Properly accept or ignore signals the postmaster might send us
|
||||
*
|
||||
* Note: we deliberately ignore SIGTERM, because during a standard Unix
|
||||
* system shutdown cycle, init will SIGTERM all processes at once. We
|
||||
* system shutdown cycle, init will SIGTERM all processes at once. We
|
||||
* want to wait for the backends to exit, whereupon the postmaster will
|
||||
* tell us it's okay to shut down (via SIGUSR2).
|
||||
*/
|
||||
@@ -279,7 +279,7 @@ CheckpointerMain(void)
|
||||
|
||||
/*
|
||||
* These operations are really just a minimal subset of
|
||||
* AbortTransaction(). We don't have very many resources to worry
|
||||
* AbortTransaction(). We don't have very many resources to worry
|
||||
* about in checkpointer, but we do have LWLocks, buffers, and temp
|
||||
* files.
|
||||
*/
|
||||
@@ -506,7 +506,7 @@ CheckpointerMain(void)
|
||||
ckpt_performed = CreateRestartPoint(flags);
|
||||
|
||||
/*
|
||||
* After any checkpoint, close all smgr files. This is so we
|
||||
* After any checkpoint, close all smgr files. This is so we
|
||||
* won't hang onto smgr references to deleted files indefinitely.
|
||||
*/
|
||||
smgrcloseall();
|
||||
@@ -639,7 +639,7 @@ CheckArchiveTimeout(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if an immediate checkpoint request is pending. (Note that
|
||||
* Returns true if an immediate checkpoint request is pending. (Note that
|
||||
* this does not check the *current* checkpoint's IMMEDIATE flag, but whether
|
||||
* there is one pending behind it.)
|
||||
*/
|
||||
@@ -826,7 +826,7 @@ chkpt_quickdie(SIGNAL_ARGS)
|
||||
on_exit_reset();
|
||||
|
||||
/*
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
|
||||
* backend. This is necessary precisely because we don't clean up our
|
||||
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
|
||||
@@ -977,7 +977,7 @@ RequestCheckpoint(int flags)
|
||||
CreateCheckPoint(flags | CHECKPOINT_IMMEDIATE);
|
||||
|
||||
/*
|
||||
* After any checkpoint, close all smgr files. This is so we won't
|
||||
* After any checkpoint, close all smgr files. This is so we won't
|
||||
* hang onto smgr references to deleted files indefinitely.
|
||||
*/
|
||||
smgrcloseall();
|
||||
@@ -1108,7 +1108,7 @@ RequestCheckpoint(int flags)
|
||||
* to the requests[] queue without checking for duplicates. The checkpointer
|
||||
* will have to eliminate dups internally anyway. However, if we discover
|
||||
* that the queue is full, we make a pass over the entire queue to compact
|
||||
* it. This is somewhat expensive, but the alternative is for the backend
|
||||
* it. This is somewhat expensive, but the alternative is for the backend
|
||||
* to perform its own fsync, which is far more expensive in practice. It
|
||||
* is theoretically possible a backend fsync might still be necessary, if
|
||||
* the queue is full and contains no duplicate entries. In that case, we
|
||||
@@ -1134,7 +1134,7 @@ ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
|
||||
|
||||
/*
|
||||
* If the checkpointer isn't running or the request queue is full, the
|
||||
* backend will have to perform its own fsync request. But before forcing
|
||||
* backend will have to perform its own fsync request. But before forcing
|
||||
* that to happen, we can try to compact the request queue.
|
||||
*/
|
||||
if (CheckpointerShmem->checkpointer_pid == 0 ||
|
||||
@@ -1178,7 +1178,7 @@ ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
|
||||
* Although a full fsync request queue is not common, it can lead to severe
|
||||
* performance problems when it does happen. So far, this situation has
|
||||
* only been observed to occur when the system is under heavy write load,
|
||||
* and especially during the "sync" phase of a checkpoint. Without this
|
||||
* and especially during the "sync" phase of a checkpoint. Without this
|
||||
* logic, each backend begins doing an fsync for every block written, which
|
||||
* gets very expensive and can slow down the whole system.
|
||||
*
|
||||
|
@@ -101,7 +101,7 @@ fork_process(void)
|
||||
#endif /* LINUX_OOM_SCORE_ADJ */
|
||||
|
||||
/*
|
||||
* Older Linux kernels have oom_adj not oom_score_adj. This works
|
||||
* Older Linux kernels have oom_adj not oom_score_adj. This works
|
||||
* similarly except with a different scale of adjustment values. If
|
||||
* it's necessary to build Postgres to work with either API, you can
|
||||
* define both LINUX_OOM_SCORE_ADJ and LINUX_OOM_ADJ.
|
||||
|
@@ -593,9 +593,9 @@ pgarch_archiveXlog(char *xlog)
|
||||
{
|
||||
/*
|
||||
* If either the shell itself, or a called command, died on a signal,
|
||||
* abort the archiver. We do this because system() ignores SIGINT and
|
||||
* abort the archiver. We do this because system() ignores SIGINT and
|
||||
* SIGQUIT while waiting; so a signal is very likely something that
|
||||
* should have interrupted us too. If we overreact it's no big deal,
|
||||
* should have interrupted us too. If we overreact it's no big deal,
|
||||
* the postmaster will just start the archiver again.
|
||||
*
|
||||
* Per the Single Unix Spec, shells report exit status > 128 when a
|
||||
|
@@ -352,7 +352,7 @@ pgstat_init(void)
|
||||
* On some platforms, pg_getaddrinfo_all() may return multiple addresses
|
||||
* only one of which will actually work (eg, both IPv6 and IPv4 addresses
|
||||
* when kernel will reject IPv6). Worse, the failure may occur at the
|
||||
* bind() or perhaps even connect() stage. So we must loop through the
|
||||
* bind() or perhaps even connect() stage. So we must loop through the
|
||||
* results till we find a working combination. We will generate LOG
|
||||
* messages, but no error, for bogus combinations.
|
||||
*/
|
||||
@@ -600,7 +600,7 @@ pgstat_reset_remove_files(const char *directory)
|
||||
/*
|
||||
* pgstat_reset_all() -
|
||||
*
|
||||
* Remove the stats files. This is currently used only if WAL
|
||||
* Remove the stats files. This is currently used only if WAL
|
||||
* recovery is needed after a crash.
|
||||
*/
|
||||
void
|
||||
@@ -661,7 +661,7 @@ pgstat_start(void)
|
||||
/*
|
||||
* Do nothing if too soon since last collector start. This is a safety
|
||||
* valve to protect against continuous respawn attempts if the collector
|
||||
* is dying immediately at launch. Note that since we will be re-called
|
||||
* is dying immediately at launch. Note that since we will be re-called
|
||||
* from the postmaster main loop, we will get another chance later.
|
||||
*/
|
||||
curtime = time(NULL);
|
||||
@@ -1105,7 +1105,7 @@ pgstat_vacuum_stat(void)
|
||||
*
|
||||
* Collect the OIDs of all objects listed in the specified system catalog
|
||||
* into a temporary hash table. Caller should hash_destroy the result
|
||||
* when done with it. (However, we make the table in CurrentMemoryContext
|
||||
* when done with it. (However, we make the table in CurrentMemoryContext
|
||||
* so that it will be freed properly in event of an error.)
|
||||
* ----------
|
||||
*/
|
||||
@@ -1350,7 +1350,7 @@ pgstat_report_analyze(Relation rel,
|
||||
* have counted such rows as live or dead respectively. Because we will
|
||||
* report our counts of such rows at transaction end, we should subtract
|
||||
* off these counts from what we send to the collector now, else they'll
|
||||
* be double-counted after commit. (This approach also ensures that the
|
||||
* be double-counted after commit. (This approach also ensures that the
|
||||
* collector ends up with the right numbers if we abort instead of
|
||||
* committing.)
|
||||
*/
|
||||
@@ -1581,7 +1581,7 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
|
||||
|
||||
/*
|
||||
* Compute the new f_total_time as the total elapsed time added to the
|
||||
* pre-call value of f_total_time. This is necessary to avoid
|
||||
* pre-call value of f_total_time. This is necessary to avoid
|
||||
* double-counting any time taken by recursive calls of myself. (We do
|
||||
* not need any similar kluge for self time, since that already excludes
|
||||
* any recursive calls.)
|
||||
@@ -2067,7 +2067,7 @@ AtPrepare_PgStat(void)
|
||||
* Clean up after successful PREPARE.
|
||||
*
|
||||
* All we need do here is unlink the transaction stats state from the
|
||||
* nontransactional state. The nontransactional action counts will be
|
||||
* nontransactional state. The nontransactional action counts will be
|
||||
* reported to the stats collector immediately, while the effects on live
|
||||
* and dead tuple counts are preserved in the 2PC state file.
|
||||
*
|
||||
@@ -2607,7 +2607,7 @@ pgstat_report_activity(BackendState state, const char *cmd_str)
|
||||
{
|
||||
/*
|
||||
* track_activities is disabled, but we last reported a
|
||||
* non-disabled state. As our final update, change the state and
|
||||
* non-disabled state. As our final update, change the state and
|
||||
* clear fields we will not be updating anymore.
|
||||
*/
|
||||
beentry->st_changecount++;
|
||||
@@ -2828,12 +2828,12 @@ pgstat_read_current_status(void)
|
||||
* pgstat_get_backend_current_activity() -
|
||||
*
|
||||
* Return a string representing the current activity of the backend with
|
||||
* the specified PID. This looks directly at the BackendStatusArray,
|
||||
* the specified PID. This looks directly at the BackendStatusArray,
|
||||
* and so will provide current information regardless of the age of our
|
||||
* transaction's snapshot of the status array.
|
||||
*
|
||||
* It is the caller's responsibility to invoke this only for backends whose
|
||||
* state is expected to remain stable while the result is in use. The
|
||||
* state is expected to remain stable while the result is in use. The
|
||||
* only current use is in deadlock reporting, where we can expect that
|
||||
* the target backend is blocked on a lock. (There are corner cases
|
||||
* where the target's wait could get aborted while we are looking at it,
|
||||
@@ -2901,7 +2901,7 @@ pgstat_get_backend_current_activity(int pid, bool checkUser)
|
||||
* pgstat_get_crashed_backend_activity() -
|
||||
*
|
||||
* Return a string representing the current activity of the backend with
|
||||
* the specified PID. Like the function above, but reads shared memory with
|
||||
* the specified PID. Like the function above, but reads shared memory with
|
||||
* the expectation that it may be corrupt. On success, copy the string
|
||||
* into the "buffer" argument and return that pointer. On failure,
|
||||
* return NULL.
|
||||
@@ -2910,7 +2910,7 @@ pgstat_get_backend_current_activity(int pid, bool checkUser)
|
||||
* query that crashed a backend. In particular, no attempt is made to
|
||||
* follow the correct concurrency protocol when accessing the
|
||||
* BackendStatusArray. But that's OK, in the worst case we'll return a
|
||||
* corrupted message. We also must take care not to trip on ereport(ERROR).
|
||||
* corrupted message. We also must take care not to trip on ereport(ERROR).
|
||||
* ----------
|
||||
*/
|
||||
const char *
|
||||
@@ -3056,7 +3056,7 @@ pgstat_send_bgwriter(void)
|
||||
/* ----------
|
||||
* PgstatCollectorMain() -
|
||||
*
|
||||
* Start up the statistics collector process. This is the body of the
|
||||
* Start up the statistics collector process. This is the body of the
|
||||
* postmaster child process.
|
||||
*
|
||||
* The argc/argv parameters are valid only in EXEC_BACKEND case.
|
||||
@@ -3077,7 +3077,7 @@ PgstatCollectorMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (pgstat probably never has any
|
||||
* can signal any child processes too. (pgstat probably never has any
|
||||
* child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -3302,7 +3302,7 @@ PgstatCollectorMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* Windows, at least in its Windows Server 2003 R2 incarnation,
|
||||
* sometimes loses FD_READ events. Waking up and retrying the recv()
|
||||
* sometimes loses FD_READ events. Waking up and retrying the recv()
|
||||
* fixes that, so don't sleep indefinitely. This is a crock of the
|
||||
* first water, but until somebody wants to debug exactly what's
|
||||
* happening there, this is the best we can do. The two-second
|
||||
@@ -4159,7 +4159,7 @@ pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent,
|
||||
const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename;
|
||||
|
||||
/*
|
||||
* Try to open the stats file. As above, anything but ENOENT is worthy of
|
||||
* Try to open the stats file. As above, anything but ENOENT is worthy of
|
||||
* complaining about.
|
||||
*/
|
||||
if ((fpin = AllocateFile(statfile, PG_BINARY_R)) == NULL)
|
||||
@@ -4295,7 +4295,7 @@ backend_read_statsfile(void)
|
||||
*
|
||||
* We don't recompute min_ts after sleeping, except in the
|
||||
* unlikely case that cur_ts went backwards. So we might end up
|
||||
* accepting a file a bit older than PGSTAT_STAT_INTERVAL. In
|
||||
* accepting a file a bit older than PGSTAT_STAT_INTERVAL. In
|
||||
* practice that shouldn't happen, though, as long as the sleep
|
||||
* time is less than PGSTAT_STAT_INTERVAL; and we don't want to
|
||||
* tell the collector that our cutoff time is less than what we'd
|
||||
@@ -4388,7 +4388,7 @@ pgstat_setup_memcxt(void)
|
||||
/* ----------
|
||||
* pgstat_clear_snapshot() -
|
||||
*
|
||||
* Discard any data collected in the current transaction. Any subsequent
|
||||
* Discard any data collected in the current transaction. Any subsequent
|
||||
* request will cause new snapshots to be read.
|
||||
*
|
||||
* This is also invoked during transaction commit or abort to discard
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* postmaster.c
|
||||
* This program acts as a clearing house for requests to the
|
||||
* POSTGRES system. Frontend programs send a startup message
|
||||
* POSTGRES system. Frontend programs send a startup message
|
||||
* to the Postmaster and the postmaster uses the info in the
|
||||
* message to setup a backend process.
|
||||
*
|
||||
@@ -15,7 +15,7 @@
|
||||
* The postmaster process creates the shared memory and semaphore
|
||||
* pools during startup, but as a rule does not touch them itself.
|
||||
* In particular, it is not a member of the PGPROC array of backends
|
||||
* and so it cannot participate in lock-manager operations. Keeping
|
||||
* and so it cannot participate in lock-manager operations. Keeping
|
||||
* the postmaster away from shared memory operations makes it simpler
|
||||
* and more reliable. The postmaster is almost always able to recover
|
||||
* from crashes of individual backends by resetting shared memory;
|
||||
@@ -146,7 +146,7 @@
|
||||
* children we have and send them appropriate signals when necessary.
|
||||
*
|
||||
* "Special" children such as the startup, bgwriter and autovacuum launcher
|
||||
* tasks are not in this list. Autovacuum worker and walsender are in it.
|
||||
* tasks are not in this list. Autovacuum worker and walsender are in it.
|
||||
* Also, "dead_end" children are in it: these are children launched just for
|
||||
* the purpose of sending a friendly rejection message to a would-be client.
|
||||
* We must track them because they are attached to shared memory, but we know
|
||||
@@ -163,7 +163,7 @@ typedef struct bkend
|
||||
int child_slot; /* PMChildSlot for this backend, if any */
|
||||
|
||||
/*
|
||||
* Flavor of backend or auxiliary process. Note that BACKEND_TYPE_WALSND
|
||||
* Flavor of backend or auxiliary process. Note that BACKEND_TYPE_WALSND
|
||||
* backends initially announce themselves as BACKEND_TYPE_NORMAL, so if
|
||||
* bkend_type is normal, you should check for a recent transition.
|
||||
*/
|
||||
@@ -183,7 +183,7 @@ static Backend *ShmemBackendArray;
|
||||
* List of background workers.
|
||||
*
|
||||
* A worker that requests a database connection during registration will have
|
||||
* rw_backend set, and will be present in BackendList. Note: do not rely on
|
||||
* rw_backend set, and will be present in BackendList. Note: do not rely on
|
||||
* rw_backend being non-NULL for shmem-connected workers!
|
||||
*/
|
||||
typedef struct RegisteredBgWorker
|
||||
@@ -236,10 +236,10 @@ static char ExtraOptions[MAXPGPATH];
|
||||
|
||||
/*
|
||||
* These globals control the behavior of the postmaster in case some
|
||||
* backend dumps core. Normally, it kills all peers of the dead backend
|
||||
* backend dumps core. Normally, it kills all peers of the dead backend
|
||||
* and reinitializes shared memory. By specifying -s or -n, we can have
|
||||
* the postmaster stop (rather than kill) peers and not reinitialize
|
||||
* shared data structures. (Reinit is currently dead code, though.)
|
||||
* shared data structures. (Reinit is currently dead code, though.)
|
||||
*/
|
||||
static bool Reinit = true;
|
||||
static int SendStop = false;
|
||||
@@ -289,7 +289,7 @@ static bool RecoveryError = false; /* T if WAL recovery failed */
|
||||
* state and the startup process is launched. The startup process begins by
|
||||
* reading the control file and other preliminary initialization steps.
|
||||
* In a normal startup, or after crash recovery, the startup process exits
|
||||
* with exit code 0 and we switch to PM_RUN state. However, archive recovery
|
||||
* with exit code 0 and we switch to PM_RUN state. However, archive recovery
|
||||
* is handled specially since it takes much longer and we would like to support
|
||||
* hot standby during archive recovery.
|
||||
*
|
||||
@@ -298,7 +298,7 @@ static bool RecoveryError = false; /* T if WAL recovery failed */
|
||||
* checkpointer are launched, while the startup process continues applying WAL.
|
||||
* If Hot Standby is enabled, then, after reaching a consistent point in WAL
|
||||
* redo, startup process signals us again, and we switch to PM_HOT_STANDBY
|
||||
* state and begin accepting connections to perform read-only queries. When
|
||||
* state and begin accepting connections to perform read-only queries. When
|
||||
* archive recovery is finished, the startup process exits with exit code 0
|
||||
* and we switch to PM_RUN state.
|
||||
*
|
||||
@@ -629,7 +629,7 @@ PostmasterMain(int argc, char *argv[])
|
||||
opterr = 1;
|
||||
|
||||
/*
|
||||
* Parse command-line options. CAUTION: keep this in sync with
|
||||
* Parse command-line options. CAUTION: keep this in sync with
|
||||
* tcop/postgres.c (the option sets should not conflict) and with the
|
||||
* common help() function in main/main.c.
|
||||
*/
|
||||
@@ -1228,7 +1228,7 @@ PostmasterMain(int argc, char *argv[])
|
||||
|
||||
|
||||
/*
|
||||
* Remove old temporary files. At this point there can be no other
|
||||
* Remove old temporary files. At this point there can be no other
|
||||
* Postgres processes running in this directory, so this should be safe.
|
||||
*/
|
||||
RemovePgTempFiles();
|
||||
@@ -1452,7 +1452,7 @@ DetermineSleepTime(struct timeval * timeout)
|
||||
|
||||
/*
|
||||
* When there are crashed bgworkers, we sleep just long enough that
|
||||
* they are restarted when they request to be. Scan the list to
|
||||
* they are restarted when they request to be. Scan the list to
|
||||
* determine the minimum of all wakeup times according to most recent
|
||||
* crash time and requested restart interval.
|
||||
*/
|
||||
@@ -1723,7 +1723,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
|
||||
{
|
||||
/*
|
||||
* EOF after SSLdone probably means the client didn't like our
|
||||
* response to NEGOTIATE_SSL_CODE. That's not an error condition, so
|
||||
* response to NEGOTIATE_SSL_CODE. That's not an error condition, so
|
||||
* don't clutter the log with a complaint.
|
||||
*/
|
||||
if (!SSLdone)
|
||||
@@ -1848,7 +1848,7 @@ retry1:
|
||||
int32 offset = sizeof(ProtocolVersion);
|
||||
|
||||
/*
|
||||
* Scan packet body for name/option pairs. We can assume any string
|
||||
* Scan packet body for name/option pairs. We can assume any string
|
||||
* beginning within the packet body is null-terminated, thanks to
|
||||
* zeroing extra byte above.
|
||||
*/
|
||||
@@ -2268,7 +2268,7 @@ reset_shared(int port)
|
||||
*
|
||||
* Note: in each "cycle of life" we will normally assign the same IPC keys
|
||||
* (if using SysV shmem and/or semas), since the port number is used to
|
||||
* determine IPC keys. This helps ensure that we will clean up dead IPC
|
||||
* determine IPC keys. This helps ensure that we will clean up dead IPC
|
||||
* objects if the postmaster crashes and is restarted.
|
||||
*/
|
||||
CreateSharedMemoryAndSemaphores(false, port);
|
||||
@@ -2629,7 +2629,7 @@ reaper(SIGNAL_ARGS)
|
||||
/*
|
||||
* OK, we saw normal exit of the checkpointer after it's been
|
||||
* told to shut down. We expect that it wrote a shutdown
|
||||
* checkpoint. (If for some reason it didn't, recovery will
|
||||
* checkpoint. (If for some reason it didn't, recovery will
|
||||
* occur on next postmaster start.)
|
||||
*
|
||||
* At this point we should have no normal backend children
|
||||
@@ -2705,7 +2705,7 @@ reaper(SIGNAL_ARGS)
|
||||
/*
|
||||
* Was it the autovacuum launcher? Normal exit can be ignored; we'll
|
||||
* start a new one at the next iteration of the postmaster's main
|
||||
* loop, if necessary. Any other exit condition is treated as a
|
||||
* loop, if necessary. Any other exit condition is treated as a
|
||||
* crash.
|
||||
*/
|
||||
if (pid == AutoVacPID)
|
||||
@@ -2847,7 +2847,7 @@ CleanupBackgroundWorker(int pid,
|
||||
if (!ReleasePostmasterChildSlot(rw->rw_child_slot))
|
||||
{
|
||||
/*
|
||||
* Uh-oh, the child failed to clean itself up. Treat as a crash
|
||||
* Uh-oh, the child failed to clean itself up. Treat as a crash
|
||||
* after all.
|
||||
*/
|
||||
rw->rw_crashed_at = GetCurrentTimestamp();
|
||||
@@ -2931,7 +2931,7 @@ CleanupBackend(int pid,
|
||||
if (!ReleasePostmasterChildSlot(bp->child_slot))
|
||||
{
|
||||
/*
|
||||
* Uh-oh, the child failed to clean itself up. Treat as a
|
||||
* Uh-oh, the child failed to clean itself up. Treat as a
|
||||
* crash after all.
|
||||
*/
|
||||
HandleChildCrash(pid, exitstatus, _("server process"));
|
||||
@@ -3004,7 +3004,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This worker is still alive. Unless we did so already, tell it
|
||||
* This worker is still alive. Unless we did so already, tell it
|
||||
* to commit hara-kiri.
|
||||
*
|
||||
* SIGQUIT is the special signal that says exit without proc_exit
|
||||
@@ -3328,7 +3328,7 @@ PostmasterStateMachine(void)
|
||||
if (FatalError)
|
||||
{
|
||||
/*
|
||||
* Start waiting for dead_end children to die. This state
|
||||
* Start waiting for dead_end children to die. This state
|
||||
* change causes ServerLoop to stop creating new ones.
|
||||
*/
|
||||
pmState = PM_WAIT_DEAD_END;
|
||||
@@ -3427,7 +3427,7 @@ PostmasterStateMachine(void)
|
||||
|
||||
/*
|
||||
* If we've been told to shut down, we exit as soon as there are no
|
||||
* remaining children. If there was a crash, cleanup will occur at the
|
||||
* remaining children. If there was a crash, cleanup will occur at the
|
||||
* next startup. (Before PostgreSQL 8.3, we tried to recover from the
|
||||
* crash before exiting, but that seems unwise if we are quitting because
|
||||
* we got SIGTERM from init --- there may well not be time for recovery
|
||||
@@ -3503,7 +3503,7 @@ PostmasterStateMachine(void)
|
||||
* system().
|
||||
*
|
||||
* There is a race condition for recently-forked children: they might not
|
||||
* have executed setsid() yet. So we signal the child directly as well as
|
||||
* have executed setsid() yet. So we signal the child directly as well as
|
||||
* the group. We assume such a child will handle the signal before trying
|
||||
* to spawn any grandchild processes. We also assume that signaling the
|
||||
* child twice will not cause any problems.
|
||||
@@ -3724,7 +3724,7 @@ BackendStartup(Port *port)
|
||||
|
||||
/*
|
||||
* Try to report backend fork() failure to client before we close the
|
||||
* connection. Since we do not care to risk blocking the postmaster on
|
||||
* connection. Since we do not care to risk blocking the postmaster on
|
||||
* this connection, we set the connection to non-blocking and try only once.
|
||||
*
|
||||
* This is grungy special-purpose code; we cannot use backend libpq since
|
||||
@@ -3778,7 +3778,7 @@ BackendInitialize(Port *port)
|
||||
/*
|
||||
* PreAuthDelay is a debugging aid for investigating problems in the
|
||||
* authentication cycle: it can be set in postgresql.conf to allow time to
|
||||
* attach to the newly-forked backend with a debugger. (See also
|
||||
* attach to the newly-forked backend with a debugger. (See also
|
||||
* PostAuthDelay, which we allow clients to pass through PGOPTIONS, but it
|
||||
* is not honored until after authentication.)
|
||||
*/
|
||||
@@ -3805,7 +3805,7 @@ BackendInitialize(Port *port)
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (We do this now on the off chance
|
||||
* can signal any child processes too. (We do this now on the off chance
|
||||
* that something might spawn a child process during authentication.)
|
||||
*/
|
||||
#ifdef HAVE_SETSID
|
||||
@@ -3815,7 +3815,7 @@ BackendInitialize(Port *port)
|
||||
|
||||
/*
|
||||
* We arrange for a simple exit(1) if we receive SIGTERM or SIGQUIT or
|
||||
* timeout while trying to collect the startup packet. Otherwise the
|
||||
* timeout while trying to collect the startup packet. Otherwise the
|
||||
* postmaster cannot shutdown the database FAST or IMMED cleanly if a
|
||||
* buggy client fails to send the packet promptly.
|
||||
*/
|
||||
@@ -3902,7 +3902,7 @@ BackendInitialize(Port *port)
|
||||
status = ProcessStartupPacket(port, false);
|
||||
|
||||
/*
|
||||
* Stop here if it was bad or a cancel packet. ProcessStartupPacket
|
||||
* Stop here if it was bad or a cancel packet. ProcessStartupPacket
|
||||
* already did any appropriate error reporting.
|
||||
*/
|
||||
if (status != STATUS_OK)
|
||||
@@ -4453,7 +4453,7 @@ SubPostmasterMain(int argc, char *argv[])
|
||||
read_nondefault_variables();
|
||||
|
||||
/*
|
||||
* Reload any libraries that were preloaded by the postmaster. Since we
|
||||
* Reload any libraries that were preloaded by the postmaster. Since we
|
||||
* exec'd this process, those libraries didn't come along with us; but we
|
||||
* should load them into all child processes to be consistent with the
|
||||
* non-EXEC_BACKEND behavior.
|
||||
@@ -4506,7 +4506,7 @@ SubPostmasterMain(int argc, char *argv[])
|
||||
*
|
||||
* This prevents a randomized stack base address that causes child
|
||||
* shared memory to be at a different address than the parent, making
|
||||
* it impossible to attached to shared memory. Return the value to
|
||||
* it impossible to attached to shared memory. Return the value to
|
||||
* '1' when finished.
|
||||
*/
|
||||
CreateSharedMemoryAndSemaphores(false, 0);
|
||||
@@ -4626,7 +4626,7 @@ ExitPostmaster(int status)
|
||||
/* should cleanup shared memory and kill all backends */
|
||||
|
||||
/*
|
||||
* Not sure of the semantics here. When the Postmaster dies, should the
|
||||
* Not sure of the semantics here. When the Postmaster dies, should the
|
||||
* backends all be killed? probably not.
|
||||
*
|
||||
* MUST -- vadim 05-10-1999
|
||||
@@ -4924,7 +4924,7 @@ CountChildren(int target)
|
||||
/*
|
||||
* StartChildProcess -- start an auxiliary process for the postmaster
|
||||
*
|
||||
* xlop determines what kind of child will be started. All child types
|
||||
* xlop determines what kind of child will be started. All child types
|
||||
* initially go to AuxiliaryProcessMain, which will handle common setup.
|
||||
*
|
||||
* Return value of StartChildProcess is subprocess' PID, or 0 if failed
|
||||
@@ -5148,7 +5148,7 @@ CreateOptsFile(int argc, char *argv[], char *fullprogname)
|
||||
* These arrays include regular backends, autovac workers, walsenders
|
||||
* and background workers, but not special children nor dead_end children.
|
||||
* This allows the arrays to have a fixed maximum size, to wit the same
|
||||
* too-many-children limit enforced by canAcceptConnections(). The exact value
|
||||
* too-many-children limit enforced by canAcceptConnections(). The exact value
|
||||
* isn't too critical as long as it's more than MaxBackends.
|
||||
*/
|
||||
int
|
||||
@@ -5355,9 +5355,9 @@ bgworker_quickdie(SIGNAL_ARGS)
|
||||
on_exit_reset();
|
||||
|
||||
/*
|
||||
* Note we do exit(0) here, not exit(2) like quickdie. The reason is that
|
||||
* Note we do exit(0) here, not exit(2) like quickdie. The reason is that
|
||||
* we don't want to be seen this worker as independently crashed, because
|
||||
* then postmaster would delay restarting it again afterwards. If some
|
||||
* then postmaster would delay restarting it again afterwards. If some
|
||||
* idiot DBA manually sends SIGQUIT to a random bgworker, the "dead man
|
||||
* switch" will ensure that postmaster sees this as a crash.
|
||||
*/
|
||||
@@ -5508,7 +5508,7 @@ StartBackgroundWorker(void)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note that in normal processes, we would call InitPostgres here. For a
|
||||
* Note that in normal processes, we would call InitPostgres here. For a
|
||||
* worker, however, we don't know what database to connect to, yet; so we
|
||||
* need to wait until the user code does it via
|
||||
* BackgroundWorkerInitializeConnection().
|
||||
@@ -6172,7 +6172,7 @@ ShmemBackendArrayRemove(Backend *bn)
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* Subset implementation of waitpid() for Windows. We assume pid is -1
|
||||
* Subset implementation of waitpid() for Windows. We assume pid is -1
|
||||
* (that is, check all child processes) and options is WNOHANG (don't wait).
|
||||
*/
|
||||
static pid_t
|
||||
|
@@ -81,7 +81,7 @@ startupproc_quickdie(SIGNAL_ARGS)
|
||||
on_exit_reset();
|
||||
|
||||
/*
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
|
||||
* backend. This is necessary precisely because we don't clean up our
|
||||
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
|
||||
|
@@ -66,7 +66,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* GUC parameters. Logging_collector cannot be changed after postmaster
|
||||
* GUC parameters. Logging_collector cannot be changed after postmaster
|
||||
* start, but the rest can change at SIGHUP.
|
||||
*/
|
||||
bool Logging_collector = false;
|
||||
@@ -192,7 +192,7 @@ SysLoggerMain(int argc, char *argv[])
|
||||
/*
|
||||
* If we restarted, our stderr is already redirected into our own input
|
||||
* pipe. This is of course pretty useless, not to mention that it
|
||||
* interferes with detecting pipe EOF. Point stderr to /dev/null. This
|
||||
* interferes with detecting pipe EOF. Point stderr to /dev/null. This
|
||||
* assumes that all interesting messages generated in the syslogger will
|
||||
* come through elog.c and will be sent to write_syslogger_file.
|
||||
*/
|
||||
@@ -202,7 +202,7 @@ SysLoggerMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* The closes might look redundant, but they are not: we want to be
|
||||
* darn sure the pipe gets closed even if the open failed. We can
|
||||
* darn sure the pipe gets closed even if the open failed. We can
|
||||
* survive running with stderr pointing nowhere, but we can't afford
|
||||
* to have extra pipe input descriptors hanging around.
|
||||
*/
|
||||
@@ -243,7 +243,7 @@ SysLoggerMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (syslogger probably never has any
|
||||
* can signal any child processes too. (syslogger probably never has any
|
||||
* child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -413,7 +413,7 @@ SysLoggerMain(int argc, char *argv[])
|
||||
|
||||
/*
|
||||
* Calculate time till next time-based rotation, so that we don't
|
||||
* sleep longer than that. We assume the value of "now" obtained
|
||||
* sleep longer than that. We assume the value of "now" obtained
|
||||
* above is still close enough. Note we can't make this calculation
|
||||
* until after calling logfile_rotate(), since it will advance
|
||||
* next_rotation_time.
|
||||
@@ -517,7 +517,7 @@ SysLoggerMain(int argc, char *argv[])
|
||||
(errmsg("logger shutting down")));
|
||||
|
||||
/*
|
||||
* Normal exit from the syslogger is here. Note that we
|
||||
* Normal exit from the syslogger is here. Note that we
|
||||
* deliberately do not close syslogFile before exiting; this is to
|
||||
* allow for the possibility of elog messages being generated
|
||||
* inside proc_exit. Regular exit() will take care of flushing
|
||||
@@ -1347,7 +1347,7 @@ set_next_rotation_time(void)
|
||||
/*
|
||||
* The requirements here are to choose the next time > now that is a
|
||||
* "multiple" of the log rotation interval. "Multiple" can be interpreted
|
||||
* fairly loosely. In this version we align to log_timezone rather than
|
||||
* fairly loosely. In this version we align to log_timezone rather than
|
||||
* GMT.
|
||||
*/
|
||||
rotinterval = Log_RotationAge * SECS_PER_MINUTE; /* convert to seconds */
|
||||
|
@@ -103,7 +103,7 @@ WalWriterMain(void)
|
||||
|
||||
/*
|
||||
* If possible, make this process a group leader, so that the postmaster
|
||||
* can signal any child processes too. (walwriter probably never has any
|
||||
* can signal any child processes too. (walwriter probably never has any
|
||||
* child processes, but for consistency we make all postmaster child
|
||||
* processes do this.)
|
||||
*/
|
||||
@@ -176,7 +176,7 @@ WalWriterMain(void)
|
||||
|
||||
/*
|
||||
* These operations are really just a minimal subset of
|
||||
* AbortTransaction(). We don't have very many resources to worry
|
||||
* AbortTransaction(). We don't have very many resources to worry
|
||||
* about in walwriter, but we do have LWLocks, and perhaps buffers?
|
||||
*/
|
||||
LWLockReleaseAll();
|
||||
@@ -250,7 +250,7 @@ WalWriterMain(void)
|
||||
int rc;
|
||||
|
||||
/*
|
||||
* Advertise whether we might hibernate in this cycle. We do this
|
||||
* Advertise whether we might hibernate in this cycle. We do this
|
||||
* before resetting the latch to ensure that any async commits will
|
||||
* see the flag set if they might possibly need to wake us up, and
|
||||
* that we won't miss any signal they send us. (If we discover work
|
||||
@@ -341,7 +341,7 @@ wal_quickdie(SIGNAL_ARGS)
|
||||
on_exit_reset();
|
||||
|
||||
/*
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* Note we do exit(2) not exit(0). This is to force the postmaster into a
|
||||
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
|
||||
* backend. This is necessary precisely because we don't clean up our
|
||||
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
|
||||
|
Reference in New Issue
Block a user