mirror of https://github.com/citusdata/citus.git
PR #6728 / commit - 9
Do not enforce distributed transaction at `EnsureCoordinatorInitiatedOperation`.pull/6728/head
parent
cf4e93a332
commit
a74232bb39
|
@ -3241,7 +3241,6 @@ EnsureCoordinatorInitiatedOperation(void)
|
||||||
* by the coordinator.
|
* by the coordinator.
|
||||||
*/
|
*/
|
||||||
if (!(IsCitusInternalBackend() || IsRebalancerInternalBackend()) ||
|
if (!(IsCitusInternalBackend() || IsRebalancerInternalBackend()) ||
|
||||||
!MyBackendIsInDisributedTransaction() ||
|
|
||||||
GetLocalGroupId() == COORDINATOR_GROUP_ID)
|
GetLocalGroupId() == COORDINATOR_GROUP_ID)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
|
|
|
@ -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
|
* ActiveDistributedTransactionNumbers returns a list of pointers to
|
||||||
* transaction numbers of distributed transactions that are in progress
|
* transaction numbers of distributed transactions that are in progress
|
||||||
|
|
|
@ -66,7 +66,6 @@ extern int ExtractProcessIdFromGlobalPID(uint64 globalPID);
|
||||||
extern void GetBackendDataForProc(PGPROC *proc, BackendData *result);
|
extern void GetBackendDataForProc(PGPROC *proc, BackendData *result);
|
||||||
extern void CancelTransactionDueToDeadlock(PGPROC *proc);
|
extern void CancelTransactionDueToDeadlock(PGPROC *proc);
|
||||||
extern bool MyBackendGotCancelledDueToDeadlock(bool clearState);
|
extern bool MyBackendGotCancelledDueToDeadlock(bool clearState);
|
||||||
extern bool MyBackendIsInDisributedTransaction(void);
|
|
||||||
extern List * ActiveDistributedTransactionNumbers(void);
|
extern List * ActiveDistributedTransactionNumbers(void);
|
||||||
extern LocalTransactionId GetMyProcLocalTransactionId(void);
|
extern LocalTransactionId GetMyProcLocalTransactionId(void);
|
||||||
extern int GetExternalClientBackendCount(void);
|
extern int GetExternalClientBackendCount(void);
|
||||||
|
|
|
@ -1197,15 +1197,6 @@ BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||||
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
|
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
|
||||||
ERROR: must be owner of table super_user_table
|
ERROR: must be owner of table super_user_table
|
||||||
ROLLBACK;
|
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
|
-- the user cannot delete non-existing shards
|
||||||
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||||
SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02');
|
SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02');
|
||||||
|
|
|
@ -749,15 +749,6 @@ BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||||
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
|
SELECT citus_internal_delete_shard_metadata(shardid) FROM shard_data;
|
||||||
ROLLBACK;
|
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
|
-- the user cannot delete non-existing shards
|
||||||
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||||
SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02');
|
SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02');
|
||||||
|
|
Loading…
Reference in New Issue