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);
/* same for transaction state and shard/placement machinery */
CloseRemoteTransaction(connection);
ResetRemoteTransaction(connection);
CloseShardPlacementAssociation(connection);
/* we leave the per-host entry alive */
@ -1458,7 +1458,7 @@ AfterXactHostConnectionHandling(ConnectionHashEntry *entry, bool isCommit)
/*
* reset healthy session lifespan connections.
*/
CloseRemoteTransaction(connection);
ResetRemoteTransaction(connection);
UnclaimConnection(connection);

View File

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

View File

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

View File

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