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

Commit 1fdf868

Browse files
committed
Return back error in MtmIsRecoveredNode() which was changed to warning in 85c7597. Also introduce MtmDeepUnlock()
1 parent 9ebee80 commit 1fdf868

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

multimaster.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,20 @@ void MtmUnlock(void)
395395
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
396396
}
397397

398+
void MtmDeepUnlock(void)
399+
{
400+
if (MtmLockCount > 0)
401+
Assert(Mtm->lastLockHolder == MyProcPid);
402+
403+
/* If we have no PGPROC, then lock was not obtained. */
404+
if (MyProc == NULL)
405+
return;
406+
407+
MtmLockCount = 0;
408+
Mtm->lastLockHolder = 0;
409+
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
410+
}
411+
398412
void MtmLockNode(int nodeId, LWLockMode mode)
399413
{
400414
Assert(nodeId > 0 && nodeId <= MtmMaxNodes*2);
@@ -2033,7 +2047,8 @@ bool MtmIsRecoveredNode(int nodeId)
20332047
{
20342048
if (BIT_CHECK(Mtm->disabledNodeMask, nodeId-1)) {
20352049
if (!MtmIsRecoverySession) {
2036-
MTM_ELOG(WARNING, "Node %d is marked as disabled but is not in recovery mode", nodeId);
2050+
MtmDeepUnlock();
2051+
MTM_ELOG(ERROR, "Node %d is marked as disabled but is not in recovery mode", nodeId);
20372052
}
20382053
return true;
20392054
} else {

multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ extern void MtmSendMessage(MtmArbiterMessage* msg);
399399
extern void MtmAdjustSubtransactions(MtmTransState* ts);
400400
extern void MtmLock(LWLockMode mode);
401401
extern void MtmUnlock(void);
402+
extern void MtmDeepUnlock(void);
402403
extern void MtmLockNode(int nodeId, LWLockMode mode);
403404
extern bool MtmTryLockNode(int nodeId, LWLockMode mode);
404405
extern void MtmUnlockNode(int nodeId);

0 commit comments

Comments
 (0)