git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 34486b6)
Replace PGPROC.isBackgroundWorker with isRegularBackend.
2024年12月28日 21:21:54 +0000 (16:21 -0500)
2024年12月28日 21:21:54 +0000 (16:21 -0500)
Commit 34486b609 effectively redefined isBackgroundWorker as meaning
"not a regular backend", whereas before it had the narrower
meaning of AmBackgroundWorkerProcess(). For clarity, rename the
field to isRegularBackend and invert its sense.

Discussion: https://postgr.es/m/1808397.1735156190@sss.pgh.pa.us


diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index edb8e0608141a6ad18c1474770e51dea0bec486e..885c9b513e9037222e562e736266119714c74c8d 100644 (file)
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -466,7 +466,7 @@ MarkAsPreparingGuts(GlobalTransaction gxact, TransactionId xid, const char *gid,
proc->databaseId = databaseid;
proc->roleId = owner;
proc->tempNamespaceId = InvalidOid;
- proc->isBackgroundWorker = true;
+ proc->isRegularBackend = false;
proc->lwWaiting = LW_WS_NOT_WAITING;
proc->lwWaitMode = 0;
proc->waitLock = NULL;
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index a640b6f5f78a6bc319920133ac861d25fade2c3b..3f8764da852a51a3a65f84fe10283b5a3dd558c0 100644 (file)
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -3640,8 +3640,8 @@ CountDBConnections(Oid databaseid)
if (proc->pid == 0)
continue; /* do not count prepared xacts */
- if (proc->isBackgroundWorker)
- continue; /* do not count background workers */
+ if (!proc->isRegularBackend)
+ continue; /* count only regular backend processes */
if (!OidIsValid(databaseid) ||
proc->databaseId == databaseid)
count++;
@@ -3712,8 +3712,8 @@ CountUserBackends(Oid roleid)
if (proc->pid == 0)
continue; /* do not count prepared xacts */
- if (proc->isBackgroundWorker)
- continue; /* do not count background workers */
+ if (!proc->isRegularBackend)
+ continue; /* count only regular backend processes */
if (proc->roleId == roleid)
count++;
}
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index acf16d2b89f9c43ed7f642af71ac8d2b28f11489..fd7077dfcdfaddd00b901a2aef25b0f8cc3a2a3e 100644 (file)
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -432,7 +432,7 @@ InitProcess(void)
MyProc->databaseId = InvalidOid;
MyProc->roleId = InvalidOid;
MyProc->tempNamespaceId = InvalidOid;
- MyProc->isBackgroundWorker = !AmRegularBackendProcess();
+ MyProc->isRegularBackend = AmRegularBackendProcess();
MyProc->delayChkptFlags = 0;
MyProc->statusFlags = 0;
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
@@ -631,7 +631,7 @@ InitAuxiliaryProcess(void)
MyProc->databaseId = InvalidOid;
MyProc->roleId = InvalidOid;
MyProc->tempNamespaceId = InvalidOid;
- MyProc->isBackgroundWorker = true;
+ MyProc->isRegularBackend = false;
MyProc->delayChkptFlags = 0;
MyProc->statusFlags = 0;
MyProc->lwWaiting = LW_WS_NOT_WAITING;
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index b20f9989a3f15f2126d22340eddfec2d85f7f9de..0b1fa61310f7b05bfa3d5efb32518311757365f0 100644 (file)
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -149,7 +149,7 @@ typedef enum
* but its myProcLocks[] lists are valid.
*
* We allow many fields of this struct to be accessed without locks, such as
- * delayChkptFlags and isBackgroundWorker. However, keep in mind that writing
+ * delayChkptFlags and isRegularBackend. However, keep in mind that writing
* mirrored ones (see below) requires holding ProcArrayLock or XidGenLock in
* at least shared mode, so that pgxactoff does not change concurrently.
*
@@ -216,7 +216,7 @@ struct PGPROC
Oid tempNamespaceId; /* OID of temp schema this backend is
* using */
- bool isBackgroundWorker; /* true if not a regular backend. */
+ bool isRegularBackend; /* true if it's a regular backend. */
/*
* While in hot standby mode, shows that a conflict signal has been sent
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /