mirror of https://github.com/citusdata/citus.git
Merge pull request #2568 from citusdata/fix_spinlock_use
Make sure spinlock is not left unreleased when an exception is thrownpull/2573/head
commit
1dbbc6664f
|
@ -829,9 +829,15 @@ AssignDistributedTransactionId(void)
|
|||
void
|
||||
MarkCitusInitiatedCoordinatorBackend(void)
|
||||
{
|
||||
/*
|
||||
* GetLocalGroupId may throw exception which can cause leaving spin lock
|
||||
* unreleased. Calling GetLocalGroupId function before the lock to avoid this.
|
||||
*/
|
||||
int localGroupId = GetLocalGroupId();
|
||||
|
||||
SpinLockAcquire(&MyBackendData->mutex);
|
||||
|
||||
MyBackendData->citusBackend.initiatorNodeIdentifier = GetLocalGroupId();
|
||||
MyBackendData->citusBackend.initiatorNodeIdentifier = localGroupId;
|
||||
MyBackendData->citusBackend.transactionOriginator = true;
|
||||
|
||||
SpinLockRelease(&MyBackendData->mutex);
|
||||
|
|
Loading…
Reference in New Issue