Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6ead0f1

Browse files
committed
Aplly "Handle grab of LWLock" without tab/space clutter
1 parent 89ffc70 commit 6ead0f1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

arbiter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,11 @@ static void MtmSender(Datum arg)
709709
{
710710
int nNodes = MtmMaxNodes;
711711
int i;
712+
MtmBuffer* txBuffer;
712713

713714
MtmBackgroundWorker = true;
714715

715-
MtmBuffer* txBuffer = (MtmBuffer*)palloc0(sizeof(MtmBuffer)*nNodes);
716+
txBuffer = (MtmBuffer*)palloc0(sizeof(MtmBuffer)*nNodes);
716717
MTM_ELOG(LOG, "Start arbiter sender %d", MyProcPid);
717718
InitializeTimeouts();
718719

@@ -1154,4 +1155,3 @@ static void MtmReceiver(Datum arg)
11541155
}
11551156
proc_exit(1); /* force restart of this bgwroker */
11561157
}
1157-

multimaster.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ void MtmLock(LWLockMode mode)
341341
atexit(MtmReleaseLocks);
342342
MtmAtExitHookRegistered = true;
343343
}
344-
if (MtmLockCount != 0) {
345-
Assert(Mtm->lastLockHolder == MyProcPid);
344+
if (MtmLockCount != 0 && Mtm->lastLockHolder == MyProcPid) {
346345
MtmLockCount += 1;
347346
}
348347
else
@@ -373,9 +372,12 @@ void MtmLock(LWLockMode mode)
373372
#endif
374373
if (mode == LW_EXCLUSIVE) {
375374
Assert(MtmLockCount == 0);
375+
Assert(MyProcPid != 0);
376376
Mtm->lastLockHolder = MyProcPid;
377377
Assert(MyProcPid);
378378
MtmLockCount = 1;
379+
} else {
380+
MtmLockCount = 0;
379381
}
380382
}
381383
}

0 commit comments

Comments
 (0)