Skip to content

Commit 80647bf

Browse files
committed
Make oldSnapshotControl a pointer to a volatile structure
It was incorrectly declared as a volatile pointer to a non-volatile structure. Eliminate the OldSnapshotControl struct definition; it is really not needed. Pointed out by Tom Lane. While at it, add OldSnapshotControlData to pgindent's list of structures.
1 parent d8ed83c commit 80647bf

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/backend/utils/time/snapmgr.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ typedef struct OldSnapshotControlData
117117
TransactionId xid_by_minute[FLEXIBLE_ARRAY_MEMBER];
118118
} OldSnapshotControlData;
119119

120-
typedef struct OldSnapshotControlData *OldSnapshotControl;
121-
122-
static volatile OldSnapshotControl oldSnapshotControl;
120+
static volatile OldSnapshotControlData *oldSnapshotControl;
123121

124122

125123
/*
@@ -259,9 +257,9 @@ SnapMgrInit(void)
259257
bool found;
260258

261259
/*
262-
* Create or attach to the OldSnapshotControl structure.
260+
* Create or attach to the OldSnapshotControlData structure.
263261
*/
264-
oldSnapshotControl = (OldSnapshotControl)
262+
oldSnapshotControl = (volatile OldSnapshotControlData *)
265263
ShmemInitStruct("OldSnapshotControlData",
266264
SnapMgrShmemSize(), &found);
267265

src/tools/pgindent/typedefs.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,7 @@ Oid
11751175
OidOptions
11761176
OkeysState
11771177
OldSerXidControl
1178+
OldSnapshotControlData
11781179
OldToNewMapping
11791180
OldToNewMappingData
11801181
OldTriggerInfo

0 commit comments

Comments
 (0)