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

Commit 04a1922

Browse files
committed
Aplly "Handle grab of LWLock" without tab/space clutter
1 parent 2e172db commit 04a1922

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

contrib/mmts/arbiter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,11 @@ static void MtmSender(Datum arg)
714714
{
715715
int nNodes = MtmMaxNodes;
716716
int i;
717+
MtmBuffer* txBuffer;
717718

718719
MtmBackgroundWorker = true;
719720

720-
MtmBuffer* txBuffer = (MtmBuffer*)palloc0(sizeof(MtmBuffer)*nNodes);
721+
txBuffer = (MtmBuffer*)palloc0(sizeof(MtmBuffer)*nNodes);
721722
MTM_ELOG(LOG, "Start arbiter sender %d", MyProcPid);
722723
InitializeTimeouts();
723724

@@ -1159,4 +1160,3 @@ static void MtmReceiver(Datum arg)
11591160
}
11601161
proc_exit(1); /* force restart of this bgwroker */
11611162
}
1162-

contrib/mmts/multimaster.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,7 @@ void MtmLock(LWLockMode mode)
340340
atexit(MtmReleaseLocks);
341341
MtmAtExitHookRegistered = true;
342342
}
343-
if (MtmLockCount != 0) {
344-
Assert(Mtm->lastLockHolder == MyProcPid);
343+
if (MtmLockCount != 0 && Mtm->lastLockHolder == MyProcPid) {
345344
MtmLockCount += 1;
346345
}
347346
else
@@ -372,8 +371,11 @@ void MtmLock(LWLockMode mode)
372371
#endif
373372
if (mode == LW_EXCLUSIVE) {
374373
Assert(MtmLockCount == 0);
374+
Assert(MyProcPid != 0);
375375
Mtm->lastLockHolder = MyProcPid;
376376
MtmLockCount = 1;
377+
} else {
378+
MtmLockCount = 0;
377379
}
378380
}
379381
}

0 commit comments

Comments
 (0)