Content-Length: 304372 | pFad | http://github.com/postgrespro/postgres_cluster/commit/247bce7f93e1d54a7052e81233e0e723db6481c6

71 Do not call LWLockRelease() in MtmDeepUnlock() when MtmLockCount == 0 · postgrespro/postgres_cluster@247bce7 · GitHub
Skip to content

Commit 247bce7

Browse files
committed
Do not call LWLockRelease() in MtmDeepUnlock() when MtmLockCount == 0
1 parent 5876bfd commit 247bce7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

multimaster.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,25 +388,27 @@ void MtmUnlock(void)
388388
Assert(Mtm->lastLockHolder == MyProcPid);
389389
return;
390390
}
391-
if (MyProc == NULL) { /* If we have no PGPROC, then lock was not obtained. */
392-
return;
393-
}
391+
394392
Mtm->lastLockHolder = 0;
395-
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
393+
394+
/* If we have no PGPROC, then lock was not obtained. */
395+
if (MyProc != NULL)
396+
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
396397
}
397398

398399
void MtmDeepUnlock(void)
399400
{
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)
401+
if (MtmLockCount == 0)
405402
return;
406403

404+
Assert(Mtm->lastLockHolder == MyProcPid);
405+
407406
MtmLockCount = 0;
408407
Mtm->lastLockHolder = 0;
409-
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
408+
409+
/* If we have no PGPROC, then lock was not obtained. */
410+
if (MyProc != NULL)
411+
LWLockRelease((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID]);
410412
}
411413

412414
void MtmLockNode(int nodeId, LWLockMode mode)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/247bce7f93e1d54a7052e81233e0e723db6481c6

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy