Rename CloseRemoteTransaction to ResetRemoteTransaction

reuse-connections-for-logical-ref-fkeys_jelte
Jelte Fennema 2022-09-19 16:50:03 +02:00
parent ab78ab82a6
commit fd8ad5f4f6
No known key found for this signature in database
4 changed files with 10 additions and 25 deletions

View File

@ -703,7 +703,7 @@ CloseConnection(MultiConnection *connection)
dlist_delete(&connection->connectionNode); dlist_delete(&connection->connectionNode);
/* same for transaction state and shard/placement machinery */ /* same for transaction state and shard/placement machinery */
CloseRemoteTransaction(connection); ResetRemoteTransaction(connection);
CloseShardPlacementAssociation(connection); CloseShardPlacementAssociation(connection);
/* we leave the per-host entry alive */ /* we leave the per-host entry alive */
@ -1458,7 +1458,7 @@ AfterXactHostConnectionHandling(ConnectionHashEntry *entry, bool isCommit)
/* /*
* reset healthy session lifespan connections. * reset healthy session lifespan connections.
*/ */
CloseRemoteTransaction(connection); ResetRemoteTransaction(connection);
UnclaimConnection(connection); UnclaimConnection(connection);

View File

@ -751,12 +751,11 @@ MarkRemoteTransactionCritical(struct MultiConnection *connection)
/* /*
* CloseRemoteTransaction handles closing a connection that, potentially, is * ResetRemoteTransaction resets the state of the transaction after the end of
* part of a coordinated transaction. This should only ever be called from * the main transaction, if the connection is being reused.
* connection_management.c, while closing a connection during a transaction.
*/ */
void void
CloseRemoteTransaction(struct MultiConnection *connection) ResetRemoteTransaction(struct MultiConnection *connection)
{ {
RemoteTransaction *transaction = &connection->remoteTransaction; RemoteTransaction *transaction = &connection->remoteTransaction;
@ -768,8 +767,9 @@ CloseRemoteTransaction(struct MultiConnection *connection)
dlist_delete(&connection->transactionNode); dlist_delete(&connection->transactionNode);
} }
/* reset per-transaction state */ /* just reset the entire state, relying on 0 being invalid/false */
ResetRemoteTransaction(connection); memset(transaction, 0, sizeof(*transaction));
ResetShardPlacementAssociation(connection); ResetShardPlacementAssociation(connection);
/* reset copy state */ /* reset copy state */
@ -777,20 +777,6 @@ CloseRemoteTransaction(struct MultiConnection *connection)
} }
/*
* ResetRemoteTransaction resets the state of the transaction after the end of
* the main transaction, if the connection is being reused.
*/
void
ResetRemoteTransaction(struct MultiConnection *connection)
{
RemoteTransaction *transaction = &connection->remoteTransaction;
/* just reset the entire state, relying on 0 being invalid/false */
memset(transaction, 0, sizeof(*transaction));
}
/* /*
* CoordinatedRemoteTransactionsPrepare PREPAREs a 2PC transaction on all * CoordinatedRemoteTransactionsPrepare PREPAREs a 2PC transaction on all
* non-failed transactions participating in the coordinated transaction. * non-failed transactions participating in the coordinated transaction.

View File

@ -370,7 +370,7 @@ SendCommandListToWorkerOutsideTransactionWithConnection(MultiConnection *workerC
} }
RemoteTransactionCommit(workerConnection); RemoteTransactionCommit(workerConnection);
CloseRemoteTransaction(workerConnection); ResetRemoteTransaction(workerConnection);
} }
@ -488,7 +488,7 @@ SendOptionalCommandListToWorkerOutsideTransactionWithConnection(
RemoteTransactionCommit(workerConnection); RemoteTransactionCommit(workerConnection);
} }
CloseRemoteTransaction(workerConnection); ResetRemoteTransaction(workerConnection);
return !failed; return !failed;
} }

View File

@ -130,7 +130,6 @@ extern void MarkRemoteTransactionCritical(struct MultiConnection *connection);
* transaction managment code. * transaction managment code.
*/ */
extern void CloseRemoteTransaction(struct MultiConnection *connection);
extern void ResetRemoteTransaction(struct MultiConnection *connection); extern void ResetRemoteTransaction(struct MultiConnection *connection);
/* perform handling for all in-progress transactions */ /* perform handling for all in-progress transactions */