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

Commit 370a46f

Browse files
committed
Add new snapshot fields to serialize/deserialize functions.
The "snapshot too old" condition was not being recognized when using a copied snapshot, since the original timestamp and lsn were not being passed along. Noticed when testing the combination of "snapshot too old" with parallel query execution.
1 parent 6436a85 commit 370a46f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/backend/utils/time/snapmgr.c

+6
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ typedef struct SerializedSnapshotData
239239
bool suboverflowed;
240240
bool takenDuringRecovery;
241241
CommandId curcid;
242+
int64 whenTaken;
243+
XLogRecPtr lsn;
242244
} SerializedSnapshotData;
243245

244246
Size
@@ -1936,6 +1938,8 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
19361938
serialized_snapshot->suboverflowed = snapshot->suboverflowed;
19371939
serialized_snapshot->takenDuringRecovery = snapshot->takenDuringRecovery;
19381940
serialized_snapshot->curcid = snapshot->curcid;
1941+
serialized_snapshot->whenTaken = snapshot->whenTaken;
1942+
serialized_snapshot->lsn = snapshot->lsn;
19391943

19401944
/*
19411945
* Ignore the SubXID array if it has overflowed, unless the snapshot was
@@ -2002,6 +2006,8 @@ RestoreSnapshot(char *start_address)
20022006
snapshot->suboverflowed = serialized_snapshot->suboverflowed;
20032007
snapshot->takenDuringRecovery = serialized_snapshot->takenDuringRecovery;
20042008
snapshot->curcid = serialized_snapshot->curcid;
2009+
snapshot->whenTaken = serialized_snapshot->whenTaken;
2010+
snapshot->lsn = serialized_snapshot->lsn;
20052011

20062012
/* Copy XIDs, if present. */
20072013
if (serialized_snapshot->xcnt > 0)

0 commit comments

Comments
 (0)