You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by ml...@apache.org on 2015/12/10 10:53:06 UTC

incubator-hawq git commit: HAWQ-241: Remove MirroredLock related codes

Repository: incubator-hawq
Updated Branches:
  refs/heads/master b845551ed -> 4b60c6c77


HAWQ-241: Remove  MirroredLock related codes


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/4b60c6c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/4b60c6c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/4b60c6c7

Branch: refs/heads/master
Commit: 4b60c6c77e9def4aaef86468940f79d920de3c85
Parents: b845551
Author: Ming LI <ml...@pivotal.io>
Authored: Thu Dec 10 17:14:28 2015 +0800
Committer: Ming LI <ml...@pivotal.io>
Committed: Thu Dec 10 17:14:28 2015 +0800

----------------------------------------------------------------------
 src/backend/access/transam/clog.c           |  80 +---------
 src/backend/access/transam/multixact.c      |  91 -----------
 src/backend/access/transam/subtrans.c       |  48 ------
 src/backend/access/transam/twophase.c       |  21 ---
 src/backend/access/transam/varsup.c         |   4 -
 src/backend/access/transam/xact.c           |  28 ----
 src/backend/cdb/cdbappendonlystoragewrite.c |  11 --
 src/backend/cdb/cdbpersistentfilesysobj.c   |  11 --
 src/backend/commands/dbcommands.c           |  11 --
 src/backend/commands/tablecmds.c            |  10 --
 src/backend/storage/smgr/smgr.c             |  11 --
 src/include/cdb/cdbpersistentstore.h        | 184 -----------------------
 12 files changed, 1 insertion(+), 509 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/access/transam/clog.c
----------------------------------------------------------------------
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 9bdbb6b..abdc707 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -99,8 +99,6 @@ char *XidStatus_Name(XidStatus status)
 void
 TransactionIdSetStatus(TransactionId xid, XidStatus status)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno = TransactionIdToPage(xid);
 	int			byteno = TransactionIdToByte(xid);
 	int			bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT;
@@ -113,8 +111,6 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
 		   status == TRANSACTION_STATUS_ABORTED ||
 		   status == TRANSACTION_STATUS_SUB_COMMITTED);
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
 
 	slotno = SimpleLruReadPage(ClogCtl, pageno, xid);
@@ -148,8 +144,6 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
 	ClogCtl->shared->page_dirty[slotno] = true;
 
 	LWLockRelease(CLogControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -161,8 +155,6 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
 XidStatus
 TransactionIdGetStatus(TransactionId xid)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno = TransactionIdToPage(xid);
 	int			byteno = TransactionIdToByte(xid);
 	int			bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT;
@@ -170,8 +162,6 @@ TransactionIdGetStatus(TransactionId xid)
 	char	   *byteptr;
 	XidStatus	status;
 
-	MIRRORED_LOCK;		// Since reading can cause eviction of another page (which requires writing).
-
 	/* lock is acquired by SimpleLruReadPage_ReadOnly */
 
 	slotno = SimpleLruReadPage_ReadOnly(ClogCtl, pageno, xid, NULL);
@@ -181,8 +171,6 @@ TransactionIdGetStatus(TransactionId xid)
 
 	LWLockRelease(CLogControlLock);
 
-	MIRRORED_UNLOCK;
-
 	return status;
 }
 
@@ -200,8 +188,6 @@ TransactionIdGetStatus(TransactionId xid)
 XidStatus
 InRecoveryTransactionIdGetStatus(TransactionId xid, bool *valid)
 {
-  MIRRORED_LOCK_DECLARE;
-
   int                     pageno = TransactionIdToPage(xid);
   int                     byteno = TransactionIdToByte(xid);
   int                     bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT;
@@ -209,7 +195,7 @@ InRecoveryTransactionIdGetStatus(TransactionId xid, bool *valid)
   char       *byteptr;
   XidStatus       status;
 
-  MIRRORED_LOCK;          // Since reading can cause eviction of another page (which requires writing).                                        
+  // Since reading can cause eviction of another page (which requires writing).                                        
 
   /* lock is acquired by SimpleLruReadPage_ReadOnly */
 
@@ -218,7 +204,6 @@ InRecoveryTransactionIdGetStatus(TransactionId xid, bool *valid)
   if (valid != NULL && *valid == false)
     {
     /* The returned slotno is invalid. */ 
-    MIRRORED_UNLOCK
     return TRANSACTION_STATUS_IN_PROGRESS;
     }
 
@@ -227,9 +212,6 @@ InRecoveryTransactionIdGetStatus(TransactionId xid, bool *valid)
   status = (*byteptr >> bshift) & CLOG_XACT_BITMASK;
 
   LWLockRelease(CLogControlLock);
-
-  MIRRORED_UNLOCK;
-
   return status;
 }
 
@@ -243,8 +225,6 @@ CLOGScanForPrevStatus(
 	TransactionId 			*indexXid,
 	XidStatus				*status)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	TransactionId highXid;
 	int pageno;
 	TransactionId lowXid;
@@ -262,8 +242,6 @@ CLOGScanForPrevStatus(
 	if (highXid < FirstNormalTransactionId)
 		return false;
 
-	MIRRORED_LOCK;
-
 	while (true)
 	{
 		pageno = TransactionIdToPage(highXid);
@@ -284,8 +262,6 @@ CLOGScanForPrevStatus(
 		{
 			LWLockRelease(CLogControlLock);
 
-			MIRRORED_UNLOCK;
-
 			*indexXid = InvalidTransactionId;
 			*status = TRANSACTION_STATUS_IN_PROGRESS;	// Set it to something.
 			return false;
@@ -304,8 +280,6 @@ CLOGScanForPrevStatus(
 			{
 				LWLockRelease(CLogControlLock);
 
-				MIRRORED_UNLOCK;
-
 				*indexXid = xid;
 				return true;
 			}
@@ -315,8 +289,6 @@ CLOGScanForPrevStatus(
 
 		if (lowXid == FirstNormalTransactionId)
 		{
-			MIRRORED_UNLOCK;
-
 			*indexXid = InvalidTransactionId;
 			*status = TRANSACTION_STATUS_IN_PROGRESS;	// Set it to something.
 			return false;
@@ -325,8 +297,6 @@ CLOGScanForPrevStatus(
 		highXid = lowXid - 1;	// Go to last xid of previous page.
 	}
 
-	MIRRORED_UNLOCK;
-
 	return false;	// We'll never reach this.
 }
 
@@ -382,12 +352,8 @@ CLOGShmemInit(void)
 void
 BootStrapCLOG(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			slotno;
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
 
 	/* Create and zero the first page of the commit log */
@@ -398,8 +364,6 @@ BootStrapCLOG(void)
 	Assert(!ClogCtl->shared->page_dirty[slotno]);
 
 	LWLockRelease(CLogControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -414,19 +378,13 @@ BootStrapCLOG(void)
 static int
 ZeroCLOGPage(int pageno, bool writeXlog)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			slotno;
 
-	MIRRORED_LOCK;
-
 	slotno = SimpleLruZeroPage(ClogCtl, pageno);
 
 	if (writeXlog)
 		WriteZeroPageXlogRec(pageno);
 
-	MIRRORED_UNLOCK;
-
 	return slotno;
 }
 
@@ -437,13 +395,10 @@ ZeroCLOGPage(int pageno, bool writeXlog)
 void
 StartupCLOG(void)
 {
-	MIRRORED_LOCK_DECLARE;
 
 	TransactionId xid = ShmemVariableCache->nextXid;
 	int			pageno = TransactionIdToPage(xid);
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
 
 	/*
@@ -482,8 +437,6 @@ StartupCLOG(void)
 	}
 
 	LWLockRelease(CLogControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -492,14 +445,8 @@ StartupCLOG(void)
 void
 ShutdownCLOG(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/* Flush dirty CLOG pages to disk */
 	SimpleLruFlush(ClogCtl, false);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -508,14 +455,8 @@ ShutdownCLOG(void)
 void
 CheckPointCLOG(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/* Flush dirty CLOG pages to disk */
 	SimpleLruFlush(ClogCtl, true);
-
-	MIRRORED_UNLOCK;
 }
 
 
@@ -530,8 +471,6 @@ CheckPointCLOG(void)
 void
 ExtendCLOG(TransactionId newestXact)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno;
 
 	/*
@@ -544,16 +483,12 @@ ExtendCLOG(TransactionId newestXact)
 
 	pageno = TransactionIdToPage(newestXact);
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
 
 	/* Zero the page and make an XLOG entry about it */
 	ZeroCLOGPage(pageno, true);
 
 	LWLockRelease(CLogControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 
@@ -575,8 +510,6 @@ ExtendCLOG(TransactionId newestXact)
 void
 TruncateCLOG(TransactionId oldestXact)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			cutoffPage;
 
 	/*
@@ -585,12 +518,9 @@ TruncateCLOG(TransactionId oldestXact)
 	 */
 	cutoffPage = TransactionIdToPage(oldestXact);
 
-	MIRRORED_LOCK;
-
 	/* Check to see if there's any files that could be removed */
 	if (!SlruScanDirectory(ClogCtl, cutoffPage, false))
 	{
-		MIRRORED_UNLOCK;
 		return;					/* nothing to remove */
 	}
 
@@ -599,8 +529,6 @@ TruncateCLOG(TransactionId oldestXact)
 
 	/* Now we can remove the old CLOG segment(s) */
 	SimpleLruTruncate(ClogCtl, cutoffPage, false);
-
-	MIRRORED_UNLOCK;
 }
 
 
@@ -676,12 +604,8 @@ WriteTruncateXlogRec(int pageno)
 void
 clog_redo(XLogRecPtr beginLoc, XLogRecPtr lsn, XLogRecord *record)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
-	MIRRORED_LOCK;
-
 	if (info == CLOG_ZEROPAGE)
 	{
 		int			pageno;
@@ -713,8 +637,6 @@ clog_redo(XLogRecPtr beginLoc, XLogRecPtr lsn, XLogRecord *record)
 	}
 	else
 		elog(PANIC, "clog_redo: unknown op code %u", info);
-
-	MIRRORED_UNLOCK;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/access/transam/multixact.c
----------------------------------------------------------------------
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index c8e9f13..4d41150 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -647,8 +647,6 @@ ConditionalMultiXactIdWait(MultiXactId multi)
 static MultiXactId
 CreateMultiXactId(int nxids, TransactionId *xids)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	MultiXactId multi;
 	MultiXactOffset offset;
 	XLogRecData rdata[2];
@@ -674,8 +672,6 @@ CreateMultiXactId(int nxids, TransactionId *xids)
 		return multi;
 	}
 
-	MIRRORED_LOCK;
-
 	/*
 	 * Assign the MXID and offsets range to use, and make sure there is space
 	 * in the OFFSETs and MEMBERs files.  NB: this routine does
@@ -717,8 +713,6 @@ CreateMultiXactId(int nxids, TransactionId *xids)
 	/* Done with critical section */
 	END_CRIT_SECTION();
 
-	MIRRORED_UNLOCK;
-
 	/* Store the new MultiXactId in the local cache, too */
 	mXactCachePut(multi, nxids, xids);
 
@@ -737,8 +731,6 @@ static void
 RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
 				   int nxids, TransactionId *xids)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno;
 	int			prev_pageno;
 	int			entryno;
@@ -746,8 +738,6 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
 	MultiXactOffset *offptr;
 	int			i;
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(MultiXactOffsetControlLock, LW_EXCLUSIVE);
 
 	pageno = MultiXactIdToOffsetPage(multi);
@@ -798,8 +788,6 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
 	}
 
 	LWLockRelease(MultiXactMemberControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -820,8 +808,6 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
 static MultiXactId
 GetNewMultiXactId(int nxids, MultiXactOffset *offset)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	MultiXactId result;
 	MultiXactOffset nextOffset;
 
@@ -830,8 +816,6 @@ GetNewMultiXactId(int nxids, MultiXactOffset *offset)
 	/* MultiXactIdSetOldestMember() must have been called already */
 	Assert(MultiXactIdIsValid(OldestMemberMXactId[MyBackendId]));
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(MultiXactGenLock, LW_EXCLUSIVE);
 
 	/* Handle wraparound of the nextMXact counter */
@@ -886,8 +870,6 @@ GetNewMultiXactId(int nxids, MultiXactOffset *offset)
 
 	LWLockRelease(MultiXactGenLock);
 
-	MIRRORED_UNLOCK;
-
 	debug_elog4(DEBUG2, "GetNew: returning %u offset %u", result, *offset);
 	return result;
 }
@@ -903,8 +885,6 @@ GetNewMultiXactId(int nxids, MultiXactOffset *offset)
 int
 GetMultiXactIdMembers(MultiXactId multi, TransactionId **xids)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno;
 	int			prev_pageno;
 	int			entryno;
@@ -975,8 +955,6 @@ GetMultiXactIdMembers(MultiXactId multi, TransactionId **xids)
 		return -1;
 	}
 
-	MIRRORED_LOCK;
-
 	/*
 	 * Find out the offset at which we need to start reading MultiXactMembers
 	 * and the number of members in the multixact.	We determine the latter as
@@ -1104,8 +1082,6 @@ retry:
 
 	LWLockRelease(MultiXactMemberControlLock);
 
-	MIRRORED_UNLOCK;
-
 	/*
 	 * Copy the result into the local cache.
 	 */
@@ -1367,12 +1343,8 @@ MultiXactShmemInit(void)
 void
 BootStrapMultiXact(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			slotno;
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(MultiXactOffsetControlLock, LW_EXCLUSIVE);
 
 	/* Create and zero the first page of the offsets log */
@@ -1394,8 +1366,6 @@ BootStrapMultiXact(void)
 	Assert(!MultiXactMemberCtl->shared->page_dirty[slotno]);
 
 	LWLockRelease(MultiXactMemberControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -1410,19 +1380,13 @@ BootStrapMultiXact(void)
 static int
 ZeroMultiXactOffsetPage(int pageno, bool writeXlog)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			slotno;
 
-	MIRRORED_LOCK;
-
 	slotno = SimpleLruZeroPage(MultiXactOffsetCtl, pageno);
 
 	if (writeXlog)
 		WriteMZeroPageXlogRec(pageno, XLOG_MULTIXACT_ZERO_OFF_PAGE);
 
-	MIRRORED_UNLOCK;
-
 	return slotno;
 }
 
@@ -1432,19 +1396,13 @@ ZeroMultiXactOffsetPage(int pageno, bool writeXlog)
 static int
 ZeroMultiXactMemberPage(int pageno, bool writeXlog)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			slotno;
 
-	MIRRORED_LOCK;
-
 	slotno = SimpleLruZeroPage(MultiXactMemberCtl, pageno);
 
 	if (writeXlog)
 		WriteMZeroPageXlogRec(pageno, XLOG_MULTIXACT_ZERO_MEM_PAGE);
 
-	MIRRORED_UNLOCK;
-
 	return slotno;
 }
 
@@ -1461,15 +1419,11 @@ ZeroMultiXactMemberPage(int pageno, bool writeXlog)
 void
 StartupMultiXact(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	MultiXactId multi = MultiXactState->nextMXact;
 	MultiXactOffset offset = MultiXactState->nextOffset;
 	int			pageno;
 	int			entryno;
 
-	MIRRORED_LOCK;
-
 	/* Clean up offsets state */
 	LWLockAcquire(MultiXactOffsetControlLock, LW_EXCLUSIVE);
 
@@ -1530,8 +1484,6 @@ StartupMultiXact(void)
 
 	LWLockRelease(MultiXactMemberControlLock);
 
-	MIRRORED_UNLOCK;
-
 	/*
 	 * Initialize lastTruncationPoint to invalid, ensuring that the first
 	 * checkpoint will try to do truncation.
@@ -1545,15 +1497,9 @@ StartupMultiXact(void)
 void
 ShutdownMultiXact(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/* Flush dirty MultiXact pages to disk */
 	SimpleLruFlush(MultiXactOffsetCtl, false);
 	SimpleLruFlush(MultiXactMemberCtl, false);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -1564,10 +1510,6 @@ MultiXactGetCheckptMulti(bool is_shutdown __attribute__((unused)) ,
 						 MultiXactId *nextMulti,
 						 MultiXactOffset *nextMultiOffset)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	LWLockAcquire(MultiXactGenLock, LW_SHARED);
 
 	*nextMulti = MultiXactState->nextMXact;
@@ -1575,8 +1517,6 @@ MultiXactGetCheckptMulti(bool is_shutdown __attribute__((unused)) ,
 
 	LWLockRelease(MultiXactGenLock);
 
-	MIRRORED_UNLOCK;
-
 	debug_elog4(DEBUG2, "MultiXact: checkpoint is nextMulti %u, nextOffset %u",
 				*nextMulti, *nextMultiOffset);
 }
@@ -1587,10 +1527,6 @@ MultiXactGetCheckptMulti(bool is_shutdown __attribute__((unused)) ,
 void
 CheckPointMultiXact(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/* Flush dirty MultiXact pages to disk */
 	SimpleLruFlush(MultiXactOffsetCtl, true);
 	SimpleLruFlush(MultiXactMemberCtl, true);
@@ -1605,8 +1541,6 @@ CheckPointMultiXact(void)
 	 */
 	if (!InRecovery)
 		TruncateMultiXact();
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -1662,8 +1596,6 @@ MultiXactAdvanceNextMXact(MultiXactId minMulti,
 static void
 ExtendMultiXactOffset(MultiXactId multi)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno;
 
 	/*
@@ -1676,16 +1608,12 @@ ExtendMultiXactOffset(MultiXactId multi)
 
 	pageno = MultiXactIdToOffsetPage(multi);
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(MultiXactOffsetControlLock, LW_EXCLUSIVE);
 
 	/* Zero the page and make an XLOG entry about it */
 	ZeroMultiXactOffsetPage(pageno, true);
 
 	LWLockRelease(MultiXactOffsetControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -1698,10 +1626,6 @@ ExtendMultiXactOffset(MultiXactId multi)
 static void
 ExtendMultiXactMember(MultiXactOffset offset, int nmembers)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/*
 	 * It's possible that the members span more than one page of the members
 	 * file, so we loop to ensure we consider each page.  The coding is not
@@ -1734,8 +1658,6 @@ ExtendMultiXactMember(MultiXactOffset offset, int nmembers)
 		offset += (MULTIXACT_MEMBERS_PER_PAGE - entryno);
 		nmembers -= (MULTIXACT_MEMBERS_PER_PAGE - entryno);
 	}
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -1750,8 +1672,6 @@ ExtendMultiXactMember(MultiXactOffset offset, int nmembers)
 static void
 TruncateMultiXact(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	MultiXactId nextMXact;
 	MultiXactOffset nextOffset;
 	MultiXactId oldestMXact;
@@ -1765,8 +1685,6 @@ TruncateMultiXact(void)
 	 * OldestVisibleMXactId[] entries, or nextMXact if none are valid.
 	 */
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(MultiXactGenLock, LW_SHARED);
 
 	/*
@@ -1806,7 +1724,6 @@ TruncateMultiXact(void)
 	 */
 	if (MultiXactState->lastTruncationPoint == oldestMXact)
 	{
-		MIRRORED_UNLOCK;
 		return;
 	}
 	
@@ -1857,8 +1774,6 @@ TruncateMultiXact(void)
 	 * since only one backend does checkpoints at a time.
 	 */
 	MultiXactState->lastTruncationPoint = oldestMXact;
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -1953,12 +1868,8 @@ WriteMZeroPageXlogRec(int pageno, uint8 info)
 void
 multixact_redo(XLogRecPtr beginLoc __attribute__((unused)), XLogRecPtr lsn __attribute__((unused)), XLogRecord *record)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	uint8		info = record->xl_info & ~XLR_INFO_MASK;
 
-	MIRRORED_LOCK;
-
 	if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE)
 	{
 		int			pageno;
@@ -2022,8 +1933,6 @@ multixact_redo(XLogRecPtr beginLoc __attribute__((unused)), XLogRecPtr lsn __att
 	}
 	else
 		elog(PANIC, "multixact_redo: unknown op code %u", info);
-
-	MIRRORED_UNLOCK;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/access/transam/subtrans.c
----------------------------------------------------------------------
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 2750eea..6e98e5b 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -68,8 +68,6 @@ static bool SubTransPagePrecedes(int page1, int page2);
 static void
 SubTransGetData(TransactionId xid, SubTransData* subData)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno = TransactionIdToPage(xid);
 	int			entryno = TransactionIdToEntry(xid);
 	int			slotno;
@@ -86,8 +84,6 @@ SubTransGetData(TransactionId xid, SubTransData* subData)
 		return;
 	}
 
-	MIRRORED_LOCK;
-
 	/* lock is acquired by SimpleLruReadPage_ReadOnly */
 
 	slotno = SimpleLruReadPage_ReadOnly(SubTransCtl, pageno, xid, NULL);
@@ -104,8 +100,6 @@ SubTransGetData(TransactionId xid, SubTransData* subData)
 
 	LWLockRelease(SubtransControlLock);
 
-	MIRRORED_UNLOCK;
-
 	return;
 }
 
@@ -115,8 +109,6 @@ SubTransGetData(TransactionId xid, SubTransData* subData)
 void
 SubTransSetParent(TransactionId xid, TransactionId parent)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			pageno = TransactionIdToPage(xid);
 	int			entryno = TransactionIdToEntry(xid);
 	int			slotno;
@@ -136,8 +128,6 @@ SubTransSetParent(TransactionId xid, TransactionId parent)
 		subData.topMostParent = InvalidTransactionId;
 	}
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE);
 
 	slotno = SimpleLruReadPage(SubTransCtl, pageno, xid);
@@ -154,8 +144,6 @@ SubTransSetParent(TransactionId xid, TransactionId parent)
 	SubTransCtl->shared->page_dirty[slotno] = true;
 
 	LWLockRelease(SubtransControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -218,12 +206,8 @@ SUBTRANSShmemInit(void)
 void
 BootStrapSUBTRANS(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			slotno;
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE);
 
 	/* Create and zero the first page of the subtrans log */
@@ -234,8 +218,6 @@ BootStrapSUBTRANS(void)
 	Assert(!SubTransCtl->shared->page_dirty[slotno]);
 
 	LWLockRelease(SubtransControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -249,16 +231,10 @@ BootStrapSUBTRANS(void)
 static int
 ZeroSUBTRANSPage(int pageno)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int result;
 
-	MIRRORED_LOCK;
-
 	result = SimpleLruZeroPage(SubTransCtl, pageno);
 
-	MIRRORED_UNLOCK;
-
 	return result;
 }
 
@@ -272,8 +248,6 @@ ZeroSUBTRANSPage(int pageno)
 void
 StartupSUBTRANS(TransactionId oldestActiveXID)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			startPage;
 	int			endPage;
 
@@ -284,8 +258,6 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	 * the new page without regard to whatever was previously on disk.
 	 */
 
-	MIRRORED_LOCK;
-
 	LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE);
 
 	startPage = TransactionIdToPage(oldestActiveXID);
@@ -299,8 +271,6 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	(void) ZeroSUBTRANSPage(startPage);
 
 	LWLockRelease(SubtransControlLock);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -309,10 +279,6 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 void
 ShutdownSUBTRANS(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/*
 	 * Flush dirty SUBTRANS pages to disk
 	 *
@@ -320,8 +286,6 @@ ShutdownSUBTRANS(void)
 	 * it merely as a debugging aid.
 	 */
 	SimpleLruFlush(SubTransCtl, false);
-
-	MIRRORED_UNLOCK;
 }
 
 /*
@@ -330,10 +294,6 @@ ShutdownSUBTRANS(void)
 void
 CheckPointSUBTRANS(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
-	MIRRORED_LOCK;
-
 	/*
 	 * Flush dirty SUBTRANS pages to disk
 	 *
@@ -342,8 +302,6 @@ CheckPointSUBTRANS(void)
 	 * the checkpoint process and not by backends.
 	 */
 	SimpleLruFlush(SubTransCtl, true);
-
-	MIRRORED_UNLOCK;
 }
 
 
@@ -393,8 +351,6 @@ ExtendSUBTRANS(TransactionId newestXact)
 void
 TruncateSUBTRANS(TransactionId oldestXact)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	int			cutoffPage;
 
 	/*
@@ -403,11 +359,7 @@ TruncateSUBTRANS(TransactionId oldestXact)
 	 */
 	cutoffPage = TransactionIdToPage(oldestXact);
 
-	MIRRORED_LOCK;
-
 	SimpleLruTruncate(SubTransCtl, cutoffPage, false);
-
-	MIRRORED_UNLOCK;
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/access/transam/twophase.c
----------------------------------------------------------------------
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index f7b1104..48fe2a6 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1153,8 +1153,6 @@ StartPrepare(GlobalTransaction gxact)
  */
 void EndPrepare(GlobalTransaction gxact)
 {
-        MIRRORED_LOCK_DECLARE;
-
         CHECKPOINT_START_LOCK_DECLARE;
 
         TransactionId       xid = gxact->proc.xid;
@@ -1166,14 +1164,6 @@ void EndPrepare(GlobalTransaction gxact)
         RegisterTwoPhaseRecord(TWOPHASE_RM_END_ID, 0, NULL, 0);
 
         /*
-         * The MirroredLock will cover BOTH mirrored writes to the pg_twophase directory
-         * and the Prepared XLOG record.
-         *
-         * The lock order is: MirroredLock then CheckpointStartLock.
-         */
-        MIRRORED_LOCK;
-
-        /*
          * We have to lock out checkpoint start here, too; otherwise a checkpoint
          * starting immediately after the WAL record is inserted could complete
          * without fsync'ing our state file.  (This is essentially the same kind
@@ -1232,8 +1222,6 @@ void EndPrepare(GlobalTransaction gxact)
          */
         CHECKPOINT_START_UNLOCK;
 
-        MIRRORED_UNLOCK;
-
 #ifdef FAULT_INJECTOR
         FaultInjector_InjectFaultIfSet(
                         EndPreparedTwoPhaseSleep,
@@ -1293,7 +1281,6 @@ PrepareDecrAppendOnlyCommitWork(char *gid)
 bool
 FinishPreparedTransaction(const char *gid, bool isCommit, bool raiseErrorIfNotFound)
 {
-        MIRRORED_LOCK_DECLARE;
 	CHECKPOINT_START_LOCK_DECLARE;
 
         GlobalTransaction gxact;
@@ -1430,12 +1417,6 @@ FinishPreparedTransaction(const char *gid, bool isCommit, bool raiseErrorIfNotFo
         // NOTE: work.
         START_CRIT_SECTION();
 
-        /*
-         * Use the MirroredLock to cover both the XLOG of the {COMMIT|ABORT} PREPARED
-         * record and the removal the of the two phase file from the pg_twophase directory.
-         */
-        MIRRORED_LOCK;
-
 	/*
 	 * We have to lock out checkpoint start here when updating persistent relation information
 	 * like Appendonly segment's committed EOF. Otherwise there might be a window betwwen
@@ -1512,8 +1493,6 @@ FinishPreparedTransaction(const char *gid, bool isCommit, bool raiseErrorIfNotFo
 
 	CHECKPOINT_START_UNLOCK;
 
-        MIRRORED_UNLOCK;
-
         END_CRIT_SECTION();
 
         /* Need to figure out the memory allocation and deallocationfor "buffer". For now, just let it leak. */

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/access/transam/varsup.c
----------------------------------------------------------------------
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 1103e84..fadefd5 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -55,8 +55,6 @@ GetNewTransactionId(bool isSubXact, bool setProcXid)
 {
 	TransactionId xid;
 
-	MIRRORED_LOCK_DECLARE;
-
 	/*
 	 * During bootstrap initialization, we return the special bootstrap
 	 * transaction id.
@@ -68,7 +66,6 @@ GetNewTransactionId(bool isSubXact, bool setProcXid)
 		return BootstrapTransactionId;
 	}
 
-	MIRRORED_LOCK;
 	LWLockAcquire(XidGenLock, LW_EXCLUSIVE);
 
 	xid = ShmemVariableCache->nextXid;
@@ -197,7 +194,6 @@ GetNewTransactionId(bool isSubXact, bool setProcXid)
 	}
 
 	LWLockRelease(XidGenLock);
-	MIRRORED_UNLOCK;
 
 	return xid;
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/access/transam/xact.c
----------------------------------------------------------------------
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index eb232a6..fda64bd 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -943,8 +943,6 @@ AtSubStart_ResourceOwner(void)
 void
 RecordTransactionCommit(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	CHECKPOINT_START_LOCK_DECLARE;
 
 	int32						persistentCommitSerializeLen;
@@ -1011,8 +1009,6 @@ RecordTransactionCommit(void)
 			 *
 			 * The lock order is: MirroredLock then CheckpointStartLock.
 			 */
-			MIRRORED_LOCK;
-				
 			CHECKPOINT_START_LOCK;
 		}
 
@@ -1167,8 +1163,6 @@ RecordTransactionCommit(void)
 		if (madeTCentries)
 		{
 			CHECKPOINT_START_UNLOCK;
-
-			MIRRORED_UNLOCK;
 		}
 
 		END_CRIT_SECTION();
@@ -2249,8 +2243,6 @@ StartTransaction(void)
 void
 CommitTransaction(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	CHECKPOINT_START_LOCK_DECLARE;
 
 	TransactionState s = CurrentTransactionState;
@@ -2330,14 +2322,7 @@ CommitTransaction(void)
 		/*
 		 * We need to ensure the recording of the [distributed-]commit record and the
 		 * persistent post-commit work will be done either before or after a checkpoint.
-		 *
-		 * When we use CheckpointStartLock, we make sure we already have the
-		 * MirroredLock first.
-		 *
-		 * The lock order is: MirroredLock then CheckpointStartLock.
 		 */
-		MIRRORED_LOCK;
-			
 		CHECKPOINT_START_LOCK;
 	}
 
@@ -2444,8 +2429,6 @@ CommitTransaction(void)
 	if (willHaveObjectsFromSmgr)
 	{
 		CHECKPOINT_START_UNLOCK;
-		
-		MIRRORED_UNLOCK;
 	}
 	
 	AtEOXact_MultiXact();
@@ -2735,8 +2718,6 @@ PrepareTransaction(void)
 void
 AbortTransaction(void)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	CHECKPOINT_START_LOCK_DECLARE;
 
 	TransactionState s = CurrentTransactionState;
@@ -2833,14 +2814,7 @@ AbortTransaction(void)
 		/*
 		 * We need to ensure the recording of the abort record and the
 		 * persistent post-abort work will be done either before or after a checkpoint.
-		 *
-		 * When we use CheckpointStartLock, we make sure we already have the
-		 * MirroredLock first.
-		 *
-		 * The lock order is: MirroredLock then CheckpointStartLock.
 		 */
-		MIRRORED_LOCK;
-			
 		CHECKPOINT_START_LOCK;
 	}
 
@@ -2899,8 +2873,6 @@ AbortTransaction(void)
 	if (willHaveObjectsFromSmgr)
 	{
 		CHECKPOINT_START_UNLOCK;
-		
-		MIRRORED_UNLOCK;
 	}
 	
 	AtEOXact_MultiXact();

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/cdb/cdbappendonlystoragewrite.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbappendonlystoragewrite.c b/src/backend/cdb/cdbappendonlystoragewrite.c
index 12019e1..c740115 100644
--- a/src/backend/cdb/cdbappendonlystoragewrite.c
+++ b/src/backend/cdb/cdbappendonlystoragewrite.c
@@ -633,8 +633,6 @@ void AppendOnlyStorageWrite_TransactionFlushAndCloseFile(
 
 	int64						*fileLen_uncompressed)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	RelFileNode relFileNode;
 	int32 segmentFileNum;
 
@@ -655,19 +653,10 @@ void AppendOnlyStorageWrite_TransactionFlushAndCloseFile(
 
 	startEof = storageWrite->startEof;
 
-	/*
-	 * Use the MirroredLock here to cover the flush (and close) and evaluation below whether
-	 * we must catchup the mirror.
-	 */
-	MIRRORED_LOCK;
-
 	AppendOnlyStorageWrite_FlushAndCloseFile(
 										storageWrite,
 										newLogicalEof,
 										fileLen_uncompressed);
-
-	MIRRORED_UNLOCK;
-
 }
 
 // -----------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/cdb/cdbpersistentfilesysobj.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbpersistentfilesysobj.c b/src/backend/cdb/cdbpersistentfilesysobj.c
index 5b3b36d..1f0b6f7 100644
--- a/src/backend/cdb/cdbpersistentfilesysobj.c
+++ b/src/backend/cdb/cdbpersistentfilesysobj.c
@@ -2242,8 +2242,6 @@ void PersistentFileSysObj_PreparedEndXactAction(
 
 	int								prepareAppendOnlyIntentCount)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	PersistentFileSysObjStateChangeResult *stateChangeResults;
 
 	int i;
@@ -2264,13 +2262,6 @@ void PersistentFileSysObj_PreparedEndXactAction(
 					palloc0(persistentObjects->typed.fileSysActionInfosCount * sizeof(PersistentFileSysObjStateChangeResult));
 
 	/*
-	 * We need to do the transition to 'Aborting Create' or 'Drop Pending' and perform
-	 * the file-system drop while under one acquistion of the MirroredLock.  Otherwise,
-	 * we could race with resynchronize's ReDrop.
-	 */
-	MIRRORED_LOCK;
-
-	/*
 	 * We need to complete this work, or let Crash Recovery complete it.
 	 */
 	START_CRIT_SECTION();
@@ -2572,8 +2563,6 @@ jumpoverinjectfaultexit:
 
 	PersistentFileSysObj_FlushXLog();
 
-	MIRRORED_UNLOCK;
-
 	END_CRIT_SECTION();
 
 	pfree(stateChangeResults);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/commands/dbcommands.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 34caa61..ca3a86f 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -373,8 +373,6 @@ static void copy_append_only_segment_file(
 	int64			persistentSerialNum,
 	char			*buffer)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	char srcFileName[MAXPGPATH];
 	char dstFileName[MAXPGPATH];
 	char extension[12];
@@ -484,12 +482,6 @@ static void copy_append_only_segment_file(
 		bufferLen = (Size) Min(2*BLCKSZ, endOffset - readOffset);						
 	}
 
-	/*
-	 * Use the MirroredLock here to cover the flush (and close) and evaluation below whether
-	 * we must catchup the mirror.
-	 */
-	MIRRORED_LOCK;
-
 	MirroredAppendOnly_FlushAndClose(
 							&mirroredDstOpen,
 							&primaryError);
@@ -500,9 +492,6 @@ static void copy_append_only_segment_file(
 				 errdetail("%s", HdfsGetLastError())));
 
 	FileClose(srcFile);
-	
-	MIRRORED_UNLOCK;
-
 }
 
 // -----------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/commands/tablecmds.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index fe48e09..bbfecfc 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -10603,8 +10603,6 @@ copy_append_only_data(
 	
 	char			*buffer)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	char srcFileName[MAXPGPATH];
 	char dstFileName[MAXPGPATH];
 	char extension[12];
@@ -10709,12 +10707,6 @@ copy_append_only_data(
 		bufferLen = (Size) Min(2*BLCKSZ, endOffset - readOffset); 					
 	}
 	
-	/*
-	 * Use the MirroredLock here to cover the flush (and close) and evaluation below whether
-	 * we must catchup the mirror.
-	 */
-	MIRRORED_LOCK;
-
 	MirroredAppendOnly_FlushAndClose(
 							&mirroredDstOpen,
 							&primaryError
@@ -10731,8 +10723,6 @@ copy_append_only_data(
 
 	FileClose(srcFile);
 
-	MIRRORED_UNLOCK;
-
 	if (Debug_persistent_print)
 		elog(Persistent_DebugPrintLevel(), 
 			 "ALTER TABLE SET TABLESPACE: Copied Append-Only segment file #%d EOF " INT64_FORMAT,

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/backend/storage/smgr/smgr.c
----------------------------------------------------------------------
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index 108dbe2..f47fa4f 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -1307,8 +1307,6 @@ smgrDoDeleteActions(
 	int					*listCount,
 	bool				forCommit)
 {
-	MIRRORED_LOCK_DECLARE;
-
 	CHECKPOINT_START_LOCK_DECLARE;
 
 	PendingDelete *current;
@@ -1342,13 +1340,6 @@ smgrDoDeleteActions(
 	 */
 
 	/*
-	 * We need to do the transition to 'Aborting Create' or 'Drop Pending' and perform
-	 * the file-system drop while under one acquistion of the MirroredLock.  Otherwise,
-	 * we could race with resynchronize's ReDrop.
-	 */
-	MIRRORED_LOCK;
-
-	/*
 	 * The logic will eventually obtain a CheckpointStartLock in PersistentRelation_Dropped(),
 	 * but functions called from this function my obtain Exclusive locks before the
 	 * CheckpointStartLock is obtained. This could cause a potential deadlock in the future.
@@ -1619,8 +1610,6 @@ smgrDoDeleteActions(
 
 	CHECKPOINT_START_UNLOCK;
 
-	MIRRORED_UNLOCK;
-
 	if (stateChangeResults != NULL)
 		pfree(stateChangeResults);
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4b60c6c7/src/include/cdb/cdbpersistentstore.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/cdbpersistentstore.h b/src/include/cdb/cdbpersistentstore.h
index 649bd4f..139eba8 100644
--- a/src/include/cdb/cdbpersistentstore.h
+++ b/src/include/cdb/cdbpersistentstore.h
@@ -148,187 +148,6 @@ inline static bool PersistentStore_IsZeroTid(
 	return (ItemPointerCompare(testTid, &zeroTid) == 0);
 }
 
-
-#ifdef USE_ASSERT_CHECKING
-
-typedef struct MirroredLockLocalVars
-{
-	bool mirroredLockIsHeldByMe;
-
-	bool specialResyncManagerFlag;
-
-	bool mirroredVariablesSet;
-} MirroredLockLocalVars;
-
-#define MIRRORED_LOCK_DECLARE \
-	MirroredLockLocalVars mirroredLockLocalVars = {false, false, false};
-#else
-
-typedef struct MirroredLockLocalVars
-{
-	bool mirroredLockIsHeldByMe;
-
-	bool specialResyncManagerFlag;
-} MirroredLockLocalVars;
-
-#define MIRRORED_LOCK_DECLARE \
-	MirroredLockLocalVars mirroredLockLocalVars = {false, false};
-#endif
-
-#ifdef USE_ASSERT_CHECKING
-#define MIRRORED_LOCK \
-	{ \
-		mirroredLockLocalVars.mirroredLockIsHeldByMe = LWLockHeldByMe(MirroredLock); \
-		mirroredLockLocalVars.specialResyncManagerFlag = false; \
-		mirroredLockLocalVars.mirroredVariablesSet = true; \
-		\
-		if (!mirroredLockLocalVars.mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockLocalVars.specialResyncManagerFlag) \
-			{ \
-				LWLockAcquire(MirroredLock , LW_SHARED); \
-			} \
-			else \
-			{ \
-				HOLD_INTERRUPTS(); \
-			} \
-		} \
-		\
-		Assert(InterruptHoldoffCount > 0); \
-	}
-#else
-#define MIRRORED_LOCK \
-	{ \
-		mirroredLockLocalVars.mirroredLockIsHeldByMe = LWLockHeldByMe(MirroredLock); \
-		mirroredLockLocalVars.specialResyncManagerFlag = false; \
-		\
-		if (!mirroredLockLocalVars.mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockLocalVars.specialResyncManagerFlag) \
-			{ \
-				LWLockAcquire(MirroredLock , LW_SHARED); \
-			} \
-			else \
-			{ \
-				HOLD_INTERRUPTS(); \
-			} \
-		} \
-		\
-	}
-#endif
-
-#ifdef USE_ASSERT_CHECKING
-#define MIRRORED_UNLOCK \
-	{ \
-		Assert(mirroredLockLocalVars.mirroredVariablesSet); \
-		Assert(InterruptHoldoffCount > 0); \
-		\
-		if (!mirroredLockLocalVars.mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockLocalVars.specialResyncManagerFlag) \
-			{ \
-				LWLockRelease(MirroredLock); \
-			} \
-			else \
-			{ \
-				RESUME_INTERRUPTS(); \
-			} \
-		} \
-	}
-#else
-#define MIRRORED_UNLOCK \
-	{ \
-		if (!mirroredLockLocalVars.mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockLocalVars.specialResyncManagerFlag) \
-			{ \
-				LWLockRelease(MirroredLock); \
-			} \
-			else \
-			{ \
-				RESUME_INTERRUPTS(); \
-			} \
-		} \
-	}
-#endif
-
-#ifdef USE_ASSERT_CHECKING
-#define MIRRORED_LOCK_BY_REF \
-	{ \
-		mirroredLockByRefVars->mirroredLockIsHeldByMe = LWLockHeldByMe(MirroredLock); \
-		mirroredLockByRefVars->specialResyncManagerFlag = false; \
-		mirroredLockByRefVars->mirroredVariablesSet = true; \
-		\
-		if (!mirroredLockByRefVars->mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockByRefVars->specialResyncManagerFlag) \
-			{ \
-				LWLockAcquire(MirroredLock , LW_SHARED); \
-			} \
-			else \
-			{ \
-				HOLD_INTERRUPTS(); \
-			} \
-		} \
-		\
-		Assert(InterruptHoldoffCount > 0); \
-	}
-#else
-#define MIRRORED_LOCK_BY_REF \
-	{ \
-		mirroredLockByRefVars->mirroredLockIsHeldByMe = LWLockHeldByMe(MirroredLock); \
-		mirroredLockByRefVars->specialResyncManagerFlag = false; \
-		\
-		if (!mirroredLockByRefVars->mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockByRefVars->specialResyncManagerFlag) \
-			{ \
-				LWLockAcquire(MirroredLock , LW_SHARED); \
-			} \
-			else \
-			{ \
-				HOLD_INTERRUPTS(); \
-			} \
-		} \
-		\
-	}
-#endif
-
-#ifdef USE_ASSERT_CHECKING
-#define MIRRORED_UNLOCK_BY_REF \
-	{ \
-		Assert(mirroredLockByRefVars->mirroredVariablesSet); \
-		Assert(InterruptHoldoffCount > 0); \
-		\
-		if (!mirroredLockByRefVars->mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockByRefVars->specialResyncManagerFlag) \
-			{ \
-				LWLockRelease(MirroredLock); \
-			} \
-			else \
-			{ \
-				RESUME_INTERRUPTS(); \
-			} \
-		} \
-	}
-#else
-#define MIRRORED_UNLOCK_BY_REF \
-	{ \
-		if (!mirroredLockByRefVars->mirroredLockIsHeldByMe) \
-		{ \
-			if (!mirroredLockByRefVars->specialResyncManagerFlag) \
-			{ \
-				LWLockRelease(MirroredLock); \
-			} \
-			else \
-			{ \
-				RESUME_INTERRUPTS(); \
-			} \
-		} \
-	}
-#endif
-
 #ifdef USE_ASSERT_CHECKING
 
 typedef struct CheckpointStartLockLocalVars
@@ -453,13 +272,11 @@ typedef struct WritePersistentStateLockLocalVars
 } WritePersistentStateLockLocalVars;
 
 #define WRITE_PERSISTENT_STATE_ORDERED_LOCK_DECLARE \
-	MIRRORED_LOCK_DECLARE; \
 	CHECKPOINT_START_LOCK_DECLARE; \
 	WritePersistentStateLockLocalVars writePersistentStateLockLocalVars;
 
 #define WRITE_PERSISTENT_STATE_ORDERED_LOCK \
 	{ \
-		MIRRORED_LOCK; \
 		CHECKPOINT_START_LOCK; \
 		writePersistentStateLockLocalVars.persistentObjLockIsHeldByMe = LWLockHeldByMe(PersistentObjLock); \
 		if (!writePersistentStateLockLocalVars.persistentObjLockIsHeldByMe) \
@@ -471,7 +288,6 @@ typedef struct WritePersistentStateLockLocalVars
 
 #define WRITE_PERSISTENT_STATE_ORDERED_UNLOCK \
 	{ \
-		MIRRORED_UNLOCK; \
 		CHECKPOINT_START_UNLOCK; \
 		if (!writePersistentStateLockLocalVars.persistentObjLockIsHeldByMe) \
 		{ \