PR #6728  / commit - 9

Do not enforce distributed transaction at `EnsureCoordinatorInitiatedOperation`.
pull/6728/head
aykutbozkurt 2023-03-21 14:32:24 +03:00
parent cf4e93a332
commit a74232bb39
5 changed files with 0 additions and 37 deletions

View File

@ -3241,7 +3241,6 @@ EnsureCoordinatorInitiatedOperation(void)
* by the coordinator.
*/
if (!(IsCitusInternalBackend() || IsRebalancerInternalBackend()) ||
!MyBackendIsInDisributedTransaction() ||
GetLocalGroupId() == COORDINATOR_GROUP_ID)
{
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),

View File

@ -1270,23 +1270,6 @@ MyBackendGotCancelledDueToDeadlock(bool clearState)
}
/*
* MyBackendIsInDisributedTransaction returns true if MyBackendData
* is in a distributed transaction.
*/
bool
MyBackendIsInDisributedTransaction(void)
{
/* backend might not have used citus yet and thus not initialized backend data */
if (!MyBackendData)
{
return false;
}
return IsInDistributedTransaction(MyBackendData);
}
/*
* ActiveDistributedTransactionNumbers returns a list of pointers to
* transaction numbers of distributed transactions that are in progress

View File

@ -66,7 +66,6 @@ extern int ExtractProcessIdFromGlobalPID(uint64 globalPID);
extern void GetBackendDataForProc(PGPROC *proc, BackendData *result);
extern void CancelTransactionDueToDeadlock(PGPROC *proc);
extern bool MyBackendGotCancelledDueToDeadlock(bool clearState);
extern bool MyBackendIsInDisributedTransaction(void);
extern List * ActiveDistributedTransactionNumbers(void);
extern LocalTransactionId GetMyProcLocalTransactionId(void);
extern int GetExternalClientBackendCount(void);

View File

@ -1197,15 +1197,6 @@ BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
ERROR: must be owner of table super_user_table
ROLLBACK;
-- the user only allowed to delete shards in a distributed transaction
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET application_name to 'citus_internal gpid=10000000001';
\set VERBOSITY terse
WITH shard_data(shardid)
AS (VALUES (1420007))
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
ERROR: This is an internal Citus function can only be used in a distributed transaction
ROLLBACK;
-- the user cannot delete non-existing shards
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02');

View File

@ -749,15 +749,6 @@ BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
ROLLBACK;
-- the user only allowed to delete shards in a distributed transaction
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET application_name to 'citus_internal gpid=10000000001';
\set VERBOSITY terse
WITH shard_data(shardid)
AS (VALUES (1420007))
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
ROLLBACK;
-- the user cannot delete non-existing shards
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02');