Skip to content

Commit

Permalink
For scenarios, such as, Bug 3697586: Server crashes when assigning di…
Browse files Browse the repository at this point in the history
…stributed transaction: Raise an ERROR instead of a crash
  • Loading branch information
tejeswarm committed Dec 26, 2024
1 parent 7341191 commit ab7c13b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/backend/distributed/transaction/backend_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,16 @@ GetCurrentDistributedTransactionId(void)
void
AssignDistributedTransactionId(void)
{
/*
* MyBackendData should always be available. However, we observed some
* crashes where certain hooks were not executed.
* Bug 3697586: Server crashes when assigning distributed transaction
*/
if (!MyBackendData)
{
ereport(ERROR, (errmsg("backend is not ready for distributed transactions")));
}

pg_atomic_uint64 *transactionNumberSequence =
&backendManagementShmemData->nextTransactionNumber;

Expand Down

0 comments on commit ab7c13b

Please sign in to comment.