mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Use MyBackendType in more places to check what process this is
Remove IsBackgroundWorker, IsAutoVacuumLauncherProcess(), IsAutoVacuumWorkerProcess(), and IsLogicalSlotSyncWorker() in favor of new Am*Process() macros that use MyBackendType. For consistency with the existing Am*Process() macros. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/f3ecd4cb-85ee-4e54-8278-5fabfb3a4ed0@iki.fi
This commit is contained in:
@@ -351,7 +351,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
|
||||
save_nestlevel = NewGUCNestLevel();
|
||||
|
||||
/* measure elapsed time iff autovacuum logging requires it */
|
||||
if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
|
||||
if (AmAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
|
||||
{
|
||||
if (track_io_timing)
|
||||
{
|
||||
@@ -729,7 +729,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
|
||||
vac_close_indexes(nindexes, Irel, NoLock);
|
||||
|
||||
/* Log the action if appropriate */
|
||||
if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
|
||||
if (AmAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
|
||||
{
|
||||
TimestampTz endtime = GetCurrentTimestamp();
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ vacuum(List *relations, VacuumParams *params, BufferAccessStrategy bstrategy,
|
||||
else
|
||||
{
|
||||
Assert(params->options & VACOPT_ANALYZE);
|
||||
if (IsAutoVacuumWorkerProcess())
|
||||
if (AmAutoVacuumWorkerProcess())
|
||||
use_own_xacts = true;
|
||||
else if (in_outer_xact)
|
||||
use_own_xacts = false;
|
||||
@@ -809,7 +809,7 @@ vacuum_open_relation(Oid relid, RangeVar *relation, bits32 options,
|
||||
* statements in the permission checks; otherwise, only log if the caller
|
||||
* so requested.
|
||||
*/
|
||||
if (!IsAutoVacuumWorkerProcess())
|
||||
if (!AmAutoVacuumWorkerProcess())
|
||||
elevel = WARNING;
|
||||
else if (verbose)
|
||||
elevel = LOG;
|
||||
@@ -896,7 +896,7 @@ expand_vacuum_rel(VacuumRelation *vrel, MemoryContext vac_context,
|
||||
* Since autovacuum workers supply OIDs when calling vacuum(), no
|
||||
* autovacuum worker should reach this code.
|
||||
*/
|
||||
Assert(!IsAutoVacuumWorkerProcess());
|
||||
Assert(!AmAutoVacuumWorkerProcess());
|
||||
|
||||
/*
|
||||
* We transiently take AccessShareLock to protect the syscache lookup
|
||||
@@ -2336,7 +2336,7 @@ vacuum_delay_point(void)
|
||||
* [autovacuum_]vacuum_cost_delay to take effect while a table is being
|
||||
* vacuumed or analyzed.
|
||||
*/
|
||||
if (ConfigReloadPending && IsAutoVacuumWorkerProcess())
|
||||
if (ConfigReloadPending && AmAutoVacuumWorkerProcess())
|
||||
{
|
||||
ConfigReloadPending = false;
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
|
||||
Reference in New Issue
Block a user