diff options
Diffstat (limited to 'src/backend/utils/time/snapmgr.c')
-rw-r--r-- | src/backend/utils/time/snapmgr.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index f4bdabfd791..2f0e9cda8c3 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -131,7 +131,7 @@ static ActiveSnapshotElt *ActiveSnapshot = NULL; static int xmin_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg); -static pairingheap RegisteredSnapshots = { &xmin_cmp, NULL, NULL }; +static pairingheap RegisteredSnapshots = {&xmin_cmp, NULL, NULL}; /* first GetTransactionSnapshot call in a transaction? */ bool FirstSnapshotSet = false; @@ -313,10 +313,10 @@ GetNonHistoricCatalogSnapshot(Oid relid) { /* * If the caller is trying to scan a relation that has no syscache, no - * catcache invalidations will be sent when it is updated. For a few - * key relations, snapshot invalidations are sent instead. If we're - * trying to scan a relation for which neither catcache nor snapshot - * invalidations are sent, we must refresh the snapshot every time. + * catcache invalidations will be sent when it is updated. For a few key + * relations, snapshot invalidations are sent instead. If we're trying to + * scan a relation for which neither catcache nor snapshot invalidations + * are sent, we must refresh the snapshot every time. */ if (!CatalogSnapshotStale && !RelationInvalidatesSnapshotsOnly(relid) && !RelationHasSysCache(relid)) @@ -587,7 +587,9 @@ PushCopiedSnapshot(Snapshot snapshot) void UpdateActiveSnapshotCommandId(void) { - CommandId save_curcid, curcid; + CommandId save_curcid, + curcid; + Assert(ActiveSnapshot != NULL); Assert(ActiveSnapshot->as_snap->active_count == 1); Assert(ActiveSnapshot->as_snap->regd_count == 0); @@ -772,7 +774,7 @@ xmin_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg) static void SnapshotResetXmin(void) { - Snapshot minSnapshot; + Snapshot minSnapshot; if (ActiveSnapshot != NULL) return; @@ -897,7 +899,8 @@ AtEOXact_Snapshot(bool isCommit) */ foreach(lc, exportedSnapshots) { - Snapshot snap = (Snapshot) lfirst(lc); + Snapshot snap = (Snapshot) lfirst(lc); + pairingheap_remove(&RegisteredSnapshots, &snap->ph_node); } @@ -1472,8 +1475,8 @@ EstimateSnapshotSpace(Snapshot snap) /* * SerializeSnapshot - * Dumps the serialized snapshot (extracted from given snapshot) onto the - * memory location at start_address. + * Dumps the serialized snapshot (extracted from given snapshot) onto the + * memory location at start_address. */ void SerializeSnapshot(Snapshot snapshot, char *start_address) @@ -1494,9 +1497,9 @@ SerializeSnapshot(Snapshot snapshot, char *start_address) serialized_snapshot->curcid = snapshot->curcid; /* - * Ignore the SubXID array if it has overflowed, unless the snapshot - * was taken during recovey - in that case, top-level XIDs are in subxip - * as well, and we mustn't lose them. + * Ignore the SubXID array if it has overflowed, unless the snapshot was + * taken during recovey - in that case, top-level XIDs are in subxip as + * well, and we mustn't lose them. */ if (serialized_snapshot->suboverflowed && !snapshot->takenDuringRecovery) serialized_snapshot->subxcnt = 0; @@ -1514,8 +1517,8 @@ SerializeSnapshot(Snapshot snapshot, char *start_address) */ if (snapshot->subxcnt > 0) { - Size subxipoff = sizeof(SerializedSnapshotData) + - snapshot->xcnt * sizeof(TransactionId); + Size subxipoff = sizeof(SerializedSnapshotData) + + snapshot->xcnt * sizeof(TransactionId); memcpy((TransactionId *) ((char *) serialized_snapshot + subxipoff), snapshot->subxip, snapshot->subxcnt * sizeof(TransactionId)); |