mirror of https://github.com/citusdata/citus.git
Fix assertion failure in maintenance daemon during Citus upgrades (#7537)
Fixes https://github.com/citusdata/citus/issues/7536. Note to reviewer: Before this commit, the following results in an assertion failure when executed locally and this won't be the case anymore: ```console make -C src/test/regress/ check-citus-upgrade-local citus-old-version=v10.2.0 ``` Note that this doesn't happen on CI as we don't enable assertions there. --------- Co-authored-by: Jelte Fennema-Nio <jelte.fennema@microsoft.com>pull/7522/head
parent
d129064280
commit
0acb5f6e86
|
@ -34,6 +34,7 @@
|
||||||
#include "utils/fmgroids.h"
|
#include "utils/fmgroids.h"
|
||||||
#include "utils/memutils.h"
|
#include "utils/memutils.h"
|
||||||
#include "utils/rel.h"
|
#include "utils/rel.h"
|
||||||
|
#include "utils/syscache.h"
|
||||||
#include "utils/xid8.h"
|
#include "utils/xid8.h"
|
||||||
|
|
||||||
#include "pg_version_constants.h"
|
#include "pg_version_constants.h"
|
||||||
|
@ -261,11 +262,28 @@ RecoverWorkerTransactions(WorkerNode *workerNode)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the transaction is created by an outer transaction from a non-main database */
|
|
||||||
bool outerXidIsNull = false;
|
bool outerXidIsNull = false;
|
||||||
Datum outerXidDatum = heap_getattr(heapTuple,
|
Datum outerXidDatum = 0;
|
||||||
Anum_pg_dist_transaction_outerxid,
|
if (EnableVersionChecks ||
|
||||||
tupleDescriptor, &outerXidIsNull);
|
SearchSysCacheExistsAttName(DistTransactionRelationId(), "outer_xid"))
|
||||||
|
{
|
||||||
|
/* 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;
|
TransactionId outerXid = 0;
|
||||||
if (!outerXidIsNull)
|
if (!outerXidIsNull)
|
||||||
|
|
Loading…
Reference in New Issue