Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
onurctirtir committed Feb 26, 2024
1 parent f424268 commit b540988
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/backend/distributed/transaction/transaction_recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,32 @@ RecoverWorkerTransactions(WorkerNode *workerNode)
continue;
}

/* Check if the transaction is created by an outer transaction from a non-main database */
bool outerXidIsNull = false;
Datum outerXidDatum = heap_getattr(heapTuple,
Anum_pg_dist_transaction_outerxid,
tupleDescriptor, &outerXidIsNull);
Datum outerXidDatum = 0;

HeapTuple outerXidAttTuple =
SearchSysCacheCopyAttName(DistTransactionRelationId(), "outer_xid");
if (HeapTupleIsValid(outerXidAttTuple))
{
ReleaseSysCache(outerXidAttTuple);

/* Check if the transaction is created by an outer transaction from a non-main database */
outerXidDatum = heap_getattr(heapTuple,
Anum_pg_dist_transaction_outerxid,
tupleDescriptor, &outerXidIsNull);
}
else
{
/*
* Normally we don't try to recover prepared transactions when the
* binary version doesn't match the sql version. However, we skip
* those checks in regression tests by disabling
* citus.enable_version_checks. And when this is the case, while
* the C code looks for "outer_xid" attribute, pg_dist_transaction
* doesn't yet have it.
*/
Assert(!EnableVersionChecks);
}

TransactionId outerXid = 0;
if (!outerXidIsNull)
Expand Down

0 comments on commit b540988

Please sign in to comment.