diff --git a/src/backend/distributed/connection/placement_connection.c b/src/backend/distributed/connection/placement_connection.c index eea25a13a..3a290bcb0 100644 --- a/src/backend/distributed/connection/placement_connection.c +++ b/src/backend/distributed/connection/placement_connection.c @@ -781,7 +781,7 @@ ConnectionModifiedPlacement(MultiConnection *connection) { dlist_iter placementIter; - if (connection->remoteTransaction.transactionState == REMOTE_TRANS_INVALID) + if (connection->remoteTransaction.transactionState == REMOTE_TRANS_NOT_STARTED) { /* * When StartPlacementListConnection() is called, we set the diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index aadd3a0ea..6d9d7eae2 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -1365,7 +1365,7 @@ CleanUpSessions(DistributedExecution *execution) ClearResults(connection, false); } - else if (!(transactionState == REMOTE_TRANS_INVALID || + else if (!(transactionState == REMOTE_TRANS_NOT_STARTED || transactionState == REMOTE_TRANS_STARTED)) { /* @@ -2467,7 +2467,7 @@ ConnectionStateMachine(WorkerSession *session) if (!connection->remoteTransaction.beginSent) { connection->remoteTransaction.transactionState = - REMOTE_TRANS_INVALID; + REMOTE_TRANS_NOT_STARTED; } break; @@ -2581,7 +2581,7 @@ TransactionStateMachine(WorkerSession *session) switch (currentState) { - case REMOTE_TRANS_INVALID: + case REMOTE_TRANS_NOT_STARTED: { if (execution->isTransaction) { @@ -2677,7 +2677,7 @@ TransactionStateMachine(WorkerSession *session) } else { - transaction->transactionState = REMOTE_TRANS_INVALID; + transaction->transactionState = REMOTE_TRANS_NOT_STARTED; } break; } @@ -3433,7 +3433,7 @@ PlacementExecutionReady(TaskPlacementExecution *placementExecution) &placementExecution->sessionReadyQueueNode); } - if (transactionState == REMOTE_TRANS_INVALID || + if (transactionState == REMOTE_TRANS_NOT_STARTED || transactionState == REMOTE_TRANS_STARTED) { /* @@ -3467,7 +3467,7 @@ PlacementExecutionReady(TaskPlacementExecution *placementExecution) RemoteTransaction *transaction = &(connection->remoteTransaction); RemoteTransactionState transactionState = transaction->transactionState; - if (transactionState == REMOTE_TRANS_INVALID || + if (transactionState == REMOTE_TRANS_NOT_STARTED || transactionState == REMOTE_TRANS_STARTED) { UpdateConnectionWaitFlags(session, diff --git a/src/backend/distributed/transaction/remote_transaction.c b/src/backend/distributed/transaction/remote_transaction.c index 8bc6b7da4..8ca78791d 100644 --- a/src/backend/distributed/transaction/remote_transaction.c +++ b/src/backend/distributed/transaction/remote_transaction.c @@ -61,7 +61,7 @@ StartRemoteTransactionBegin(struct MultiConnection *connection) StringInfo beginAndSetDistributedTransactionId = makeStringInfo(); ListCell *subIdCell = NULL; - Assert(transaction->transactionState == REMOTE_TRANS_INVALID); + Assert(transaction->transactionState == REMOTE_TRANS_NOT_STARTED); /* remember transaction as being in-progress */ dlist_push_tail(&InProgressTransactions, &connection->transactionNode); @@ -206,7 +206,7 @@ StartRemoteTransactionCommit(MultiConnection *connection) const bool isCommit = true; /* can only commit if transaction is in progress */ - Assert(transaction->transactionState != REMOTE_TRANS_INVALID); + Assert(transaction->transactionState != REMOTE_TRANS_NOT_STARTED); /* can't commit if we already started to commit or abort */ Assert(transaction->transactionState < REMOTE_TRANS_1PC_ABORTING); @@ -348,7 +348,7 @@ StartRemoteTransactionAbort(MultiConnection *connection) const bool raiseErrors = false; const bool isNotCommit = false; - Assert(transaction->transactionState != REMOTE_TRANS_INVALID); + Assert(transaction->transactionState != REMOTE_TRANS_NOT_STARTED); /* * Clear previous results, so we have a better chance to send ROLLBACK @@ -474,7 +474,7 @@ StartRemoteTransactionPrepare(struct MultiConnection *connection) const bool raiseErrors = true; /* can't prepare a nonexistant transaction */ - Assert(transaction->transactionState != REMOTE_TRANS_INVALID); + Assert(transaction->transactionState != REMOTE_TRANS_NOT_STARTED); /* can't prepare in a failed transaction */ Assert(!transaction->transactionFailed); @@ -615,7 +615,7 @@ RemoteTransactionsBeginIfNecessary(List *connectionList) * don't start it again. That's quite normal if a piece of code allows * cached connections. */ - if (transaction->transactionState != REMOTE_TRANS_INVALID) + if (transaction->transactionState != REMOTE_TRANS_NOT_STARTED) { continue; } @@ -760,7 +760,7 @@ CloseRemoteTransaction(struct MultiConnection *connection) RemoteTransaction *transaction = &connection->remoteTransaction; /* unlink from list of open transactions, if necessary */ - if (transaction->transactionState != REMOTE_TRANS_INVALID) + if (transaction->transactionState != REMOTE_TRANS_NOT_STARTED) { /* XXX: Should we error out for a critical transaction? */ @@ -802,7 +802,7 @@ CoordinatedRemoteTransactionsPrepare(void) iter.cur); RemoteTransaction *transaction = &connection->remoteTransaction; - Assert(transaction->transactionState != REMOTE_TRANS_INVALID); + Assert(transaction->transactionState != REMOTE_TRANS_NOT_STARTED); /* can't PREPARE a transaction that failed */ if (transaction->transactionFailed) @@ -863,7 +863,7 @@ CoordinatedRemoteTransactionsCommit(void) iter.cur); RemoteTransaction *transaction = &connection->remoteTransaction; - if (transaction->transactionState == REMOTE_TRANS_INVALID || + if (transaction->transactionState == REMOTE_TRANS_NOT_STARTED || transaction->transactionState == REMOTE_TRANS_1PC_COMMITTING || transaction->transactionState == REMOTE_TRANS_2PC_COMMITTING || transaction->transactionState == REMOTE_TRANS_COMMITTED || @@ -920,7 +920,7 @@ CoordinatedRemoteTransactionsAbort(void) iter.cur); RemoteTransaction *transaction = &connection->remoteTransaction; - if (transaction->transactionState == REMOTE_TRANS_INVALID || + if (transaction->transactionState == REMOTE_TRANS_NOT_STARTED || transaction->transactionState == REMOTE_TRANS_1PC_ABORTING || transaction->transactionState == REMOTE_TRANS_2PC_ABORTING || transaction->transactionState == REMOTE_TRANS_ABORTED) diff --git a/src/include/distributed/remote_transaction.h b/src/include/distributed/remote_transaction.h index 39d81e326..4adf10516 100644 --- a/src/include/distributed/remote_transaction.h +++ b/src/include/distributed/remote_transaction.h @@ -26,7 +26,7 @@ struct MultiConnection; typedef enum { /* no transaction active */ - REMOTE_TRANS_INVALID = 0, + REMOTE_TRANS_NOT_STARTED = 0, /* transaction start */ REMOTE_TRANS_STARTING,