提交 694ce55f 编写于 作者: A Ashwin Agrawal 提交者: Xin Zhang

Remove filerep resync backend code.

上级 b1d4fb4d
......@@ -78,7 +78,6 @@
#include "cdb/cdbtm.h"
#include "cdb/cdbfilerep.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdbvars.h"
#include "cdb/cdbpersistentrelation.h"
#include "cdb/cdbmirroredflatfile.h"
......@@ -10067,8 +10066,6 @@ CreateCheckPoint(int flags)
{
RequestXLogSwitch();
FileRepResyncManager_ResyncFlatFiles();
UpdateControlFile();
LWLockRelease(MirroredLock);
......
......@@ -28,7 +28,6 @@ OBJS = cdbappendonlystorage.o cdbappendonlystorageformat.o \
cdbfilerepprimary.o cdbfilerepmirror.o \
cdbfilerepprimaryack.o cdbfilerepmirrorack.o \
cdbfilerepconnclient.o cdbfilerepconnserver.o \
cdbfilerepresyncmanager.o cdbfilerepresyncworker.o \
cdbfilerepresetpeerprocess.o \
cdbfts.o \
cdbglobalsequence.o \
......
......@@ -32,7 +32,6 @@
#include "cdb/cdbfilerepprimary.h"
#include "cdb/cdbfilerepprimaryack.h"
#include "cdb/cdbfilerepconnclient.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdbvars.h"
#include "storage/lwlock.h"
#include "storage/pmsignal.h"
......@@ -96,14 +95,6 @@ FileRepPrimary_GetMirrorDataLossTrackingSessionNum(int64 *sessionNum)
case DataStateNotInitialized:
return MirrorDataLossTrackingState_MirrorNotConfigured;
case DataStateInResync:
if (!FileRepResync_IsReMirrorAllowed() &&
(segmentState == SegmentStateInitialization ||
segmentState == SegmentStateInResyncTransition))
return MirrorDataLossTrackingState_MirrorDown;
else
return MirrorDataLossTrackingState_MirrorCurrentlyUpInResync;
case DataStateInSync:
return MirrorDataLossTrackingState_MirrorCurrentlyUpInSync;
......@@ -140,19 +131,19 @@ FileRepPrimary_IsMirrorDataLossOccurred(void)
int
FileRepPrimary_IntentAppendOnlyCommitWork(void)
{
return FileRepResync_IncAppendOnlyCommitCount();
return 0;
}
int
FileRepPrimary_FinishedAppendOnlyCommitWork(int count)
{
return FileRepResync_DecAppendOnlyCommitCount(count);
return 0;
}
int
FileRepPrimary_GetAppendOnlyCommitWorkCount(void)
{
return FileRepResync_GetAppendOnlyCommitCount();
return 0;
}
/*
......@@ -202,16 +193,6 @@ FileRepPrimary_IsMirroringRequired(
/* Insist(0); */
break;
case DataStateInResync:
if (!FileRepResync_IsReMirrorAllowed())
{
if (segmentState == SegmentStateInitialization ||
segmentState == SegmentStateInResyncTransition)
{
break;
}
}
/* no break */
case DataStateInSync:
/*
......
此差异已折叠。
此差异已折叠。
......@@ -27,8 +27,6 @@
#include "cdb/cdbfilerepprimaryrecovery.h"
#include "cdb/cdbfilerepmirror.h"
#include "cdb/cdbfilerepmirrorack.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdbfilerepresyncworker.h"
#include "cdb/cdbvars.h"
#include "libpq/pqsignal.h"
#include "postmaster/postmaster.h"
......@@ -150,20 +148,7 @@ FileRepSubProcess_ShutdownHandler(SIGNAL_ARGS)
if (isInTransition == TRUE &&
dataStateTransition == DataStateInChangeTracking)
{
/*
* Resync workers and manager may be waiting on lock that is
* acquired by backend process that is suspended during
* transition to Change Tracking and so FileRep backend
* shutdown may never be completed.
*/
if (fileRepProcessType == FileRepProcessTypeResyncManager)
{
FileRepResync_Cleanup();
}
else
{
LockReleaseAll(DEFAULT_LOCKMETHOD, false);
}
LockReleaseAll(DEFAULT_LOCKMETHOD, false);
/*
* We remove ourself from LW waiter list (if applicable).
......@@ -884,27 +869,6 @@ FileRepSubProcess_Main()
false, true);
break;
case FileRepProcessTypeResyncManager:
FileRepSubProcess_InitProcess();
FileRepPrimary_StartResyncManager();
ResourceOwnerRelease(CurrentResourceOwner,
RESOURCE_RELEASE_BEFORE_LOCKS,
false, true);
break;
case FileRepProcessTypeResyncWorker1:
case FileRepProcessTypeResyncWorker2:
case FileRepProcessTypeResyncWorker3:
case FileRepProcessTypeResyncWorker4:
FileRepSubProcess_InitProcess();
FileRepPrimary_StartResyncWorker();
ResourceOwnerRelease(CurrentResourceOwner,
RESOURCE_RELEASE_BEFORE_LOCKS,
false, true);
break;
default:
elog(PANIC, "unrecognized process type: %s(%d)",
statmsg, fileRepProcessType);
......
......@@ -24,8 +24,6 @@
#include "catalog/pg_tablespace.h"
#include "cdb/cdbfilerepprimary.h"
#include "cdb/cdbmirroredbufferpool.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdbfilerepresyncworker.h"
#include "cdb/cdbfilerepprimary.h"
#include "cdb/cdbpersistenttablespace.h"
#include "cdb/cdbpersistentstore.h"
......@@ -461,7 +459,7 @@ MirroredBufferPool_Open(
mirrorDataLossTrackingSessionNum,
/* create */ false,
/* mirrorOnly */ false,
/* copyToMirror */ FileRepResyncWorker_IsResyncRequest(),
/* copyToMirror */ false,
primaryError,
mirrorDataLossOccurred);
......@@ -614,8 +612,7 @@ MirroredBufferPool_Flush(
open->mirrorDataLossOccurred = FileRepPrimary_IsMirrorDataLossOccurred();
}
if (StorageManagerMirrorMode_DoPrimaryWork(open->mirrorMode) &&
!FileRepResyncWorker_IsResyncRequest())
if (StorageManagerMirrorMode_DoPrimaryWork(open->mirrorMode))
{
errno = 0;
......@@ -791,8 +788,7 @@ MirroredBufferPool_Write(
}
if (StorageManagerMirrorMode_DoPrimaryWork(open->mirrorMode) &&
!FileRepResyncWorker_IsResyncRequest())
if (StorageManagerMirrorMode_DoPrimaryWork(open->mirrorMode))
{
errno = 0;
......@@ -1553,8 +1549,7 @@ MirroredBufferPool_Truncate(
open->mirrorDataLossOccurred = FileRepPrimary_IsMirrorDataLossOccurred();
}
if (StorageManagerMirrorMode_DoPrimaryWork(open->mirrorMode) &&
!FileRepResyncWorker_IsResyncRequest())
if (StorageManagerMirrorMode_DoPrimaryWork(open->mirrorMode))
{
errno = 0;
......
......@@ -33,7 +33,6 @@
#include "cdb/cdbmirroredfilesysobj.h"
#include "cdb/cdbdirectopen.h"
#include "cdb/cdbfilerepservice.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdbresynchronizechangetracking.h"
#include "cdb/cdbmirroredbufferpool.h"
#include "cdb/cdbmirroredappendonly.h"
......@@ -4639,8 +4638,6 @@ static void PersistentFileSysObj_ScanStateAction(
}
FileRepResync_AddToTotalBlocksToSynchronize(moreBlocksToSynchronize);
if (Debug_persistent_print)
elog(Persistent_DebugPrintLevel(),
"StateAction_MarkWholeMirrorFullCopy: Mark '%s' full copy, persistent state '%s', relation storage manager '%s', number of 32k blocks " INT64_FORMAT ", old mirror existence state '%s', new mirror existence state '%s', serial number " INT64_FORMAT " at TID %s",
......@@ -4712,8 +4709,6 @@ static void PersistentFileSysObj_ScanStateAction(
// Don't hold lock during physical file-system operation.
WRITE_PERSISTENT_STATE_ORDERED_UNLOCK;
FileRepResync_SetReMirrorAllowed();
// UNDONE: Pass this in from the resync worker?
mirrorDataLossTrackingState =
FileRepPrimary_GetMirrorDataLossTrackingSessionNum(
......@@ -4728,18 +4723,9 @@ static void PersistentFileSysObj_ScanStateAction(
mirrorDataLossTrackingSessionNum,
&mirrorDataLossOccurred);
FileRepResync_ResetReMirrorAllowed();
// UNDONE: Act on mirrorDataLossOccurred
WRITE_PERSISTENT_STATE_ORDERED_LOCK;
/*
* We calculate only RelationFile objects to create for resync.
* As it seems unnecessary overhead to scan database/tablespace/etc..
* Hence only decrement for RelationFile.
*/
if (fsObjType == PersistentFsObjType_RelationFile)
FileRepResync_DecFsobjCount();
}
else
{
......@@ -4762,15 +4748,11 @@ static void PersistentFileSysObj_ScanStateAction(
DatumGetInt16(
values[Anum_gp_persistent_relation_node_relation_storage_manager - 1]);
FileRepResync_SetReMirrorAllowed();
PersistentFileSysObj_DoMirrorValidation(
&fsObjName,
relStorageMgr,
&persistentTid,
persistentSerialNum);
FileRepResync_ResetReMirrorAllowed();
}
}
break;
......@@ -4891,9 +4873,6 @@ static void PersistentFileSysObj_ScanStateAction(
*/
if (StateAction_MirrorReDrop == stateAction)
{
/* Set this flag to allow actions on mirror during resync transition */
FileRepResync_SetReMirrorAllowed();
mirrorDataLossTrackingState =
FileRepPrimary_GetMirrorDataLossTrackingSessionNum(
&mirrorDataLossTrackingSessionNum);
......@@ -4907,19 +4886,6 @@ static void PersistentFileSysObj_ScanStateAction(
mirrorDataLossTrackingState,
mirrorDataLossTrackingSessionNum,
&mirrorDataLossOccurred);
// UNDONE: Act on mirrorDataLossOccurred
FileRepResync_ResetReMirrorAllowed();
/*
* We calculate only RelationFile objects to create for resync.
* As it seems unnecessary overhead to scan database/tablespace/etc..
* Hence only decrement for RelationFile.
*/
if (fsObjType == PersistentFsObjType_RelationFile)
{
FileRepResync_DecFsobjCount();
}
}
else
{
......@@ -5256,8 +5222,6 @@ void PersistentFileSysObj_MarkSpecialScanIncremental(void)
PersistentFileSysObj_GetBufferPoolRelationTotalBlocks(
PersistentFileSysObjName_GetRelFileNodePtr(&fsObjName));
FileRepResync_AddToTotalBlocksToSynchronize(numOf32kBlocks);
if (Debug_persistent_print)
elog(Persistent_DebugPrintLevel(),
"PersistentFileSysObj_MarkSpecialScanIncremental: Mark '%s' needing special scan incremental, number of 32k blocks %d, persistent state '%s', mirror existence state '%s', serial number " INT64_FORMAT " at TID %s",
......@@ -5295,8 +5259,6 @@ void PersistentFileSysObj_MarkSpecialScanIncremental(void)
PersistentFileSysObj_GetBufferPoolRelationTotalBlocks(
PersistentFileSysObjName_GetRelFileNodePtr(&fsObjName));
FileRepResync_AddToTotalBlocksToSynchronize(numOf32kBlocks);
if (Debug_persistent_print)
elog(Persistent_DebugPrintLevel(),
"PersistentFileSysObj_MarkSpecialScanIncremental: Mark '%s' vacuumed relation as scan incremental, number of 32k blocks %d, persistent state '%s', mirror existence state '%s', serial number " INT64_FORMAT " at TID %s",
......@@ -5439,8 +5401,6 @@ void PersistentFileSysObj_MarkAppendOnlyCatchup(void)
roundedUp32kBlocks = (mirrorAppendOnlyNewEof - mirrorAppendOnlyLossEof + BLCKSZ - 1) / BLCKSZ;
FileRepResync_AddToTotalBlocksToSynchronize(roundedUp32kBlocks);
if (Debug_persistent_print)
elog(Persistent_DebugPrintLevel(),
"PersistentFileSysObj_MarkAppendOnlyCatchup: Mark '%s' Append-Only relation as needing catch-up (mirror loss EOF " INT64_FORMAT ", mirror new EOF " INT64_FORMAT ", number of 32k blocks " INT64_FORMAT "), persistent state '%s', mirror existence state '%s', serial number " INT64_FORMAT " at TID %s",
......@@ -5721,8 +5681,6 @@ void PersistentFileSysObj_MarkPageIncrementalFromChangeLog(void)
&incrementalChangeList->entries[i].persistentTid,
incrementalChangeList->entries[i].persistentSerialNum,
incrementalChangeList->entries[i].numblocks);
FileRepResync_AddToTotalBlocksToSynchronize(incrementalChangeList->entries[i].numblocks);
}
if (incrementalChangeList != NULL)
......
......@@ -41,7 +41,6 @@
#include "utils/snapmgr.h"
#include "cdb/cdbfilerep.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdbresynchronizechangetracking.h"
#include "cdb/cdbpersistentrelation.h"
#include "cdb/cdbpersistentstore.h"
......@@ -2534,9 +2533,6 @@ ChangeTracking_RecordLastChangeTrackedLoc(void)
endResyncLSN = XLogLastChangeTrackedLoc();
/* the routine stores last LSN in shared memory */
FileRepResyncManager_SetEndResyncLSN(endResyncLSN);
/*
* append "endResyncLSN" (last LSN recorded in Change Tracking log files)
* in Change Tracking meta file. "endResyncLSN" also marks the last entry
......@@ -2639,7 +2635,6 @@ ChangeTracking_RetrieveLastChangeTrackedLoc(void)
*/
if (!XLByteEQ(recptr->resync_lsn_end, DummyRecPtr))
{
FileRepResyncManager_SetEndResyncLSN(recptr->resync_lsn_end);
return recptr->resync_transition_completed;
}
}
......
......@@ -695,13 +695,6 @@ bool Gp_entry_postmaster = false;
static int Save_MppLocalProcessCounter = 0;
static DistributedTransactionTimeStamp Save_DtxStartTime = 0;
/** resync status info from cdbfilerepresyncmanager.h **/
extern struct timeval FileRepResync_GetEstimateResyncCompletionTime(void);
extern int64 FileRepResync_GetBlocksSynchronized(void);
extern int64 FileRepResync_GetTotalBlocksToSynchronize(void);
extern int FileRepResync_GetCurFsobjCount(void);
extern int FileRepResync_GetTotalFsobjCount(void);
/* changetracking size info from cdbresynchronizechangetracking.h */
extern int64 ChangeTracking_GetTotalSpaceUsedOnDisk(void);
......@@ -3083,20 +3076,18 @@ processTransitionRequest_getMirrorStatus(void)
getPrimaryMirrorStatusCodes(&pm_mode, &s_state, &d_state, &f_type);
int64 resyncNumCompleted = FileRepResync_GetBlocksSynchronized();
int64 resyncTotalToComplete = FileRepResync_GetTotalBlocksToSynchronize();
int64 changeTrackingBytesUsed = ChangeTracking_GetTotalSpaceUsedOnDisk();
int64 resyncNumCompleted = 0;
int64 resyncTotalToComplete = 0;
int64 changeTrackingBytesUsed = 0;
int fsobjCount = FileRepResync_GetCurFsobjCount();
int totalFsobjCount = FileRepResync_GetTotalFsobjCount();
int fsobjCount = 0;
int totalFsobjCount = 0;
/**
* Note: call this one AFTER calling the others above -- it will return a sentinel
* if estimates are invalid, and we want to be sure we get the sentinel
* (the system can go from valid to invalid estimates but no vice-versa)
*/
struct timeval estimateResyncCompletionTime = FileRepResync_GetEstimateResyncCompletionTime();
bool isIOSuspended = primaryMirrorIsIOSuspended();
char *databaseStatus;
......@@ -3153,7 +3144,7 @@ processTransitionRequest_getMirrorStatus(void)
resyncNumCompleted,
resyncTotalToComplete,
changeTrackingBytesUsed,
(int64)estimateResyncCompletionTime.tv_sec,
(int64)0,
totalFsobjCount,
fsobjCount);
......
......@@ -27,7 +27,6 @@
#include "cdb/cdbfilerep.h"
#include "cdb/cdbfilerepprimaryack.h"
#include "cdb/cdbfilerepprimaryrecovery.h"
#include "cdb/cdbfilerepresyncmanager.h"
#include "cdb/cdblocaldistribxact.h"
#include "cdb/cdbpersistentfilesysobj.h"
#include "cdb/cdbpersistentfilespace.h"
......@@ -180,7 +179,6 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
size = add_size(size, FileRep_ShmemSize());
size = add_size(size, FileRepAck_ShmemSize());
size = add_size(size, FileRepAckPrimary_ShmemSize());
size = add_size(size, FileRepResync_ShmemSize());
size = add_size(size, FileRepIpc_ShmemSize());
size = add_size(size, FileRepLog_ShmemSize());
}
......@@ -354,7 +352,6 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
FileRep_ShmemInit();
FileRepAck_ShmemInit();
FileRepAckPrimary_ShmemInit();
FileRepResync_ShmemInit();
FileRepIpc_ShmemInit();
FileRepLog_ShmemInit();
}
......
/*
* cdbfilerepresyncmanager.h
*
*
* Copyright 2009-2010 Greenplum Inc. All rights reserved.
*
*/
#ifndef CDBFILEREPRESYNCMANAGER_H
#define CDBFILEREPRESYNCMANAGER_H
#include "cdb/cdbfilerep.h"
#include "access/persistentfilesysobjname.h"
#include "cdb/cdbresynchronizechangetracking.h"
/*
* Resync Hash Table located in shared memory keeps
* track of files that are currently in resync.
* One entry per file.
* It has fixed MAX number of files to be resynced
*
*/
typedef struct FileRepResyncHashEntry_s {
char fileName[MAXPGPATH+1];
/*
* It identifies mirror relation path.
* It is key. It has to be first field in the structure.
*/
RelFileNode relFileNode;
int32 segmentFileNum;
PersistentFileSysRelStorageMgr relStorageMgr;
/* relationType (Buffer Pool or AppendOnly) */
MirroredRelDataSynchronizationState mirrorDataSynchronizationState;
/* relationOperation (Full, IncrPage or IncrScan) */
int64 mirrorBufpoolResyncChangedPageCount;
XLogRecPtr mirrorBufpoolResyncCkptLoc;
/* beginIncrResyncLSN */
BlockNumber mirrorBufpoolResyncCkptBlockNum;
int64 mirrorAppendOnlyLossEof;
int64 mirrorAppendOnlyNewEof;
ItemPointerData persistentTid;
int64 persistentSerialNum;
FileRepResyncState_e fileRepResyncState;
} FileRepResyncHashEntry_s;
extern Size FileRepResync_ShmemSize(void);
extern void FileRepResync_ShmemInit(void);
extern void FileRepResync_Cleanup(void);
extern void FileRepPrimary_StartResyncManager(void);
extern FileRepResyncHashEntry_s* FileRepPrimary_GetResyncEntry(ChangeTrackingRequest **request);
extern int FileRepResync_UpdateEntry(
FileRepResyncHashEntry_s* entry);
extern XLogRecPtr FileRepResync_GetEndIncrResyncLSN(void);
extern XLogRecPtr FileRepResync_GetEndFullResyncLSN(void);
extern void FileRepResyncManager_SetEndResyncLSN(
XLogRecPtr endResyncLSN);
extern int FileRepResync_IncAppendOnlyCommitCount(void);
extern int FileRepResync_DecAppendOnlyCommitCount(int count);
extern int FileRepResync_GetAppendOnlyCommitCount(void);
extern bool FileRepResync_IsReMirrorAllowed(void);
extern void FileRepResync_SetReMirrorAllowed(void);
extern void FileRepResync_ResetReMirrorAllowed(void);
extern int64 FileRepResync_GetBlocksSynchronized(void);
extern int64 FileRepResync_GetTotalBlocksToSynchronize(void);
extern void FileRepResync_SetTotalBlocksToSynchronize(int64 totalBlocksToSynchronize);
extern void FileRepResync_AddToTotalBlocksToSynchronize(int64 moreBlocksToSynchronize);
extern struct timeval FileRepResync_GetEstimateResyncCompletionTime(void);
extern void FileRepResyncManager_ResyncFlatFiles(void);
extern void FileRepResync_DecFsobjCount(void);
extern int FileRepResync_GetCurFsobjCount(void);
extern int FileRepResync_GetTotalFsobjCount(void);
#endif /* CDBFILEREPRESYNCMANAGER_H */
/*
* cdbfilerepresyncworker.h
*
* Copyright 2009-2010, Greenplum Inc. All rights reserved.
*
*/
#ifndef CDBFILEREPRESYNCWORKER_H
#define CDBFILEREPRESYNCWORKER_H
#include "c.h"
#include "storage/relfilenode.h"
#include "access/xlogdefs.h"
#include "storage/fd.h"
#include "storage/dbdirnode.h"
extern void FileRepPrimary_StartResyncWorker(void);
extern bool FileRepResyncWorker_IsResyncRequest(void);
#endif /* CDBFILEREPRESYNCWORKER_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册