Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d545692

Browse files
committed
Fix initdb failure with non-zero global_snapshot_defer_time.
And set its default value to 5. Also fix one warning (damned 'void' instead of true void).
1 parent e73c9b6 commit d545692

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ GetSnapshotData(Snapshot snapshot)
17671767
* Take GlobalCSN under ProcArrayLock so the local/global snapshot stays
17681768
* synchronized.
17691769
*/
1770-
if (track_global_snapshots || global_snapshot_defer_time > 0)
1770+
if (track_global_snapshots)
17711771
global_csn = GlobalSnapshotGenerate(false);
17721772

17731773
LWLockRelease(ProcArrayLock);
@@ -1846,7 +1846,8 @@ GetSnapshotData(Snapshot snapshot)
18461846

18471847
snapshot->imported_global_csn = false;
18481848
snapshot->global_csn = global_csn;
1849-
if (global_snapshot_defer_time > 0)
1849+
/* if (global_snapshot_defer_time > 0 && IsNormalProcessingMode()) */
1850+
if (global_snapshot_defer_time > 0 && IsUnderPostmaster)
18501851
GlobalSnapshotMapXmin(snapshot->global_csn);
18511852

18521853
return snapshot;
@@ -3091,7 +3092,7 @@ ProcArraySetGlobalSnapshotXmin(TransactionId xmin)
30913092
* ProcArrayGetGlobalSnapshotXmin
30923093
*/
30933094
TransactionId
3094-
ProcArrayGetGlobalSnapshotXmin()
3095+
ProcArrayGetGlobalSnapshotXmin(void)
30953096
{
30963097
return procArray->global_snapshot_xmin;
30973098
}

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ static struct config_int ConfigureNamesInt[] =
23492349
NULL
23502350
},
23512351
&global_snapshot_defer_time,
2352-
30, 0, INT_MAX,
2352+
5, 0, INT_MAX,
23532353
NULL, NULL, NULL
23542354
},
23552355

src/include/storage/procarray.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ extern void ProcArrayGetReplicationSlotXmin(TransactionId *xmin,
130130

131131
extern void ProcArraySetGlobalSnapshotXmin(TransactionId xmin);
132132

133-
extern TransactionId ProcArrayGetGlobalSnapshotXmin();
133+
extern TransactionId ProcArrayGetGlobalSnapshotXmin(void);
134134

135135
#endif /* PROCARRAY_H */

0 commit comments

Comments
 (0)