Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise an ERROR instead of causing a crash when backend data is not init #7806

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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")));

Check warning on line 865 in src/backend/distributed/transaction/backend_data.c

View check run for this annotation

Codecov / codecov/patch

src/backend/distributed/transaction/backend_data.c#L865

Added line #L865 was not covered by tests
}

pg_atomic_uint64 *transactionNumberSequence =
&backendManagementShmemData->nextTransactionNumber;

Expand Down
Loading