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

Commit 28ddd48

Browse files
committed
Return back error in MtmIsRecoveredNode() which was changed to warning in 85c7597. Also introduce MtmDeepUnlock()
1 parent 0b1ad5e commit 28ddd48

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

contrib/mmts/multimaster.c

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

397+
void MtmDeepUnlock(void)
398+
{
399+
if (MtmLockCount > 0)
400+
Assert(Mtm->lastLockHolder == MyProcPid);
401+
402+
/* If we have no PGPROC, then lock was not obtained. */
403+
if (MyProc == NULL)
404+
return;
405+
406+
MtmLockCount = 0;
407+
Mtm->lastLockHolder = 0;
408+
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
409+
}
410+
397411
void MtmLockNode(int nodeId, LWLockMode mode)
398412
{
399413
Assert(nodeId > 0 && nodeId <= MtmMaxNodes*2);
@@ -2133,7 +2147,8 @@ bool MtmIsRecoveredNode(int nodeId)
21332147
{
21342148
if (BIT_CHECK(Mtm->disabledNodeMask, nodeId-1)) {
21352149
if (!MtmIsRecoverySession) {
2136-
MTM_ELOG(WARNING, "Node %d is marked as disabled but is not in recovery mode", nodeId);
2150+
MtmDeepUnlock();
2151+
MTM_ELOG(ERROR, "Node %d is marked as disabled but is not in recovery mode", nodeId);
21372152
}
21382153
return true;
21392154
} else {

contrib/mmts/multimaster.h

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

0 commit comments

Comments
 (0)