Replace problematic modification of global variable with a constant argument.
There was a concern that an exception during GetNonHistoricCatalogSnapshot would be problematic after setting the global variable and not resetting it back to its original value. This patch threads the desired distributed transaction context into GetNonHistoricCatalogSnapshot without modifying global state.
@@ -295,20 +295,7 @@ GetCatalogSnapshot(Oid relid)
if (HistoricSnapshotActive())
return HistoricSnapshot;
- /*
- * GPDB_94_MERGE_FIXME: This is typically the way SnapshotNow was.
- * I think it makes sense to use a local snapshot for this.. But
- * update comments, and verify all the places where this is used.
- * Also, do we need a TRY-CATCH block to reset DistributedTransactionContext
- * on error?
- */
- DtxContext saveDistributedTransactionContext = DistributedTransactionContext;
- DistributedTransactionContext = DTX_CONTEXT_LOCAL_ONLY;
-
- Snapshot snapshot = GetNonHistoricCatalogSnapshot(relid, DistributedTransactionContext);
-
- DistributedTransactionContext = saveDistributedTransactionContext;
- return snapshot;
+ return GetNonHistoricCatalogSnapshot(relid, DTX_CONTEXT_LOCAL_ONLY);
}
/*
