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

Commit0ecb4ea

Browse files
committed
Volatile-qualify the ProcArray PGPROC pointer in a bunch of routines
that examine fields that could change under them. This is just to makereally sure that when we are fetching a value 'only once', that's whatactually happens. Possibly this is a bug that should be back-patched,but in the absence of solid evidence that it's needed, I won't bother.
1 parent4bf2dfb commit0ecb4ea

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*
2525
* IDENTIFICATION
26-
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.29 2007/09/0518:10:47 tgl Exp $
26+
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.30 2007/09/0521:11:19 tgl Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -233,7 +233,7 @@ TransactionIdIsInProgress(TransactionId xid)
233233

234234
for (i=0;i<arrayP->numProcs;i++)
235235
{
236-
PGPROC*proc=arrayP->procs[i];
236+
volatilePGPROC*proc=arrayP->procs[i];
237237

238238
/* Fetch xid just once - see GetNewTransactionId */
239239
TransactionIdpxid=proc->xid;
@@ -361,7 +361,7 @@ TransactionIdIsActive(TransactionId xid)
361361

362362
for (i=0;i<arrayP->numProcs;i++)
363363
{
364-
PGPROC*proc=arrayP->procs[i];
364+
volatilePGPROC*proc=arrayP->procs[i];
365365

366366
/* Fetch xid just once - see GetNewTransactionId */
367367
TransactionIdpxid=proc->xid;
@@ -434,7 +434,7 @@ GetOldestXmin(bool allDbs, bool ignoreVacuum)
434434

435435
for (index=0;index<arrayP->numProcs;index++)
436436
{
437-
PGPROC*proc=arrayP->procs[index];
437+
volatilePGPROC*proc=arrayP->procs[index];
438438

439439
if (ignoreVacuum&&proc->inVacuum)
440440
continue;
@@ -613,7 +613,7 @@ GetSnapshotData(Snapshot snapshot, bool serializable)
613613
*/
614614
for (index=0;index<arrayP->numProcs;index++)
615615
{
616-
PGPROC*proc=arrayP->procs[index];
616+
volatilePGPROC*proc=arrayP->procs[index];
617617
TransactionIdxid;
618618

619619
/* Ignore procs running LAZY VACUUM */
@@ -672,7 +672,7 @@ GetSnapshotData(Snapshot snapshot, bool serializable)
672672
if (nxids>0)
673673
{
674674
memcpy(snapshot->subxip+subcount,
675-
proc->subxids.xids,
675+
(void*)proc->subxids.xids,
676676
nxids*sizeof(TransactionId));
677677
subcount+=nxids;
678678
}
@@ -739,7 +739,7 @@ GetTransactionsInCommit(TransactionId **xids_p)
739739

740740
for (index=0;index<arrayP->numProcs;index++)
741741
{
742-
PGPROC*proc=arrayP->procs[index];
742+
volatilePGPROC*proc=arrayP->procs[index];
743743
/* Fetch xid just once - see GetNewTransactionId */
744744
TransactionIdpxid=proc->xid;
745745

@@ -773,7 +773,7 @@ HaveTransactionsInCommit(TransactionId *xids, int nxids)
773773

774774
for (index=0;index<arrayP->numProcs;index++)
775775
{
776-
PGPROC*proc=arrayP->procs[index];
776+
volatilePGPROC*proc=arrayP->procs[index];
777777
/* Fetch xid just once - see GetNewTransactionId */
778778
TransactionIdpxid=proc->xid;
779779

@@ -861,7 +861,7 @@ BackendXidGetPid(TransactionId xid)
861861

862862
for (index=0;index<arrayP->numProcs;index++)
863863
{
864-
PGPROC*proc=arrayP->procs[index];
864+
volatilePGPROC*proc=arrayP->procs[index];
865865

866866
if (proc->xid==xid)
867867
{
@@ -909,7 +909,7 @@ GetCurrentVirtualXIDs(TransactionId limitXmin)
909909

910910
for (index=0;index<arrayP->numProcs;index++)
911911
{
912-
PGPROC*proc=arrayP->procs[index];
912+
volatilePGPROC*proc=arrayP->procs[index];
913913
/* Fetch xmin just once - might change on us? */
914914
TransactionIdpxmin=proc->xmin;
915915

@@ -963,7 +963,7 @@ CountActiveBackends(void)
963963
*/
964964
for (index=0;index<arrayP->numProcs;index++)
965965
{
966-
PGPROC*proc=arrayP->procs[index];
966+
volatilePGPROC*proc=arrayP->procs[index];
967967

968968
if (proc==MyProc)
969969
continue;/* do not count myself */
@@ -993,7 +993,7 @@ CountDBBackends(Oid databaseid)
993993

994994
for (index=0;index<arrayP->numProcs;index++)
995995
{
996-
PGPROC*proc=arrayP->procs[index];
996+
volatilePGPROC*proc=arrayP->procs[index];
997997

998998
if (proc->pid==0)
999999
continue;/* do not count prepared xacts */
@@ -1020,7 +1020,7 @@ CountUserBackends(Oid roleid)
10201020

10211021
for (index=0;index<arrayP->numProcs;index++)
10221022
{
1023-
PGPROC*proc=arrayP->procs[index];
1023+
volatilePGPROC*proc=arrayP->procs[index];
10241024

10251025
if (proc->pid==0)
10261026
continue;/* do not count prepared xacts */
@@ -1072,7 +1072,7 @@ CheckOtherDBBackends(Oid databaseId)
10721072

10731073
for (index=0;index<arrayP->numProcs;index++)
10741074
{
1075-
PGPROC*proc=arrayP->procs[index];
1075+
volatilePGPROC*proc=arrayP->procs[index];
10761076

10771077
if (proc->databaseId!=databaseId)
10781078
continue;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp