HAWQ-507. Remove useless code for cdbpersistentrelfile.c
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/7c8fc376 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/7c8fc376 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/7c8fc376 Branch: refs/heads/master Commit: 7c8fc376bb539f743bdb7b7ae834b0d5eda35e30 Parents: 3a43c16 Author: doli <[email protected]> Authored: Thu Mar 10 13:56:13 2016 +0800 Committer: Ming LI <[email protected]> Committed: Wed Mar 23 10:40:43 2016 +0800 ---------------------------------------------------------------------- src/backend/cdb/cdbpersistentrelfile.c | 152 ---------------------------- src/include/cdb/cdbpersistentrelfile.h | 19 ---- 2 files changed, 171 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7c8fc376/src/backend/cdb/cdbpersistentrelfile.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/cdbpersistentrelfile.c b/src/backend/cdb/cdbpersistentrelfile.c index 2b8e3e8..fa4e023 100644 --- a/src/backend/cdb/cdbpersistentrelfile.c +++ b/src/backend/cdb/cdbpersistentrelfile.c @@ -105,16 +105,6 @@ static void PersistentRelfile_VerifyInitScan(void) // Helpers // ----------------------------------------------------------------------------- -inline static void XLogRecPtr_Zero(XLogRecPtr *xlogLoc) -{ - MemSet(xlogLoc, 0, sizeof(XLogRecPtr)); -} - -void PersistentRelfile_FlushXLog(void) -{ - PersistentFileSysObj_FlushXLog(); -} - extern void PersistentRelfile_Reset(void) { // Currently, nothing to do. @@ -145,75 +135,7 @@ int64 PersistentRelfile_CurrentMaxSerialNum(void) return value; } -static Oid persistentRelfileCheckTablespace; -static int32 persistentRelfileCheckTablespaceUseCount; -static RelFileNode persistentRelfileCheckTablespaceRelFileNode; - -static bool PersistentRelfile_CheckTablespaceScanTupleCallback( - ItemPointer persistentTid, - int64 persistentSerialNum, - Datum *values) -{ - RelFileNode relFileNode; - int32 segmentFileNum; - - PersistentFileSysRelStorageMgr relationStorageManager; - - PersistentFileSysState state; - - PersistentFileSysRelBufpoolKind relBufpoolKind; - - TransactionId parentXid; - int64 serialNum; - ItemPointerData previousFreeTid; - bool sharedStorage; - - GpPersistentRelfileNode_GetValues( - values, - &relFileNode.spcNode, - &relFileNode.dbNode, - &relFileNode.relNode, - &segmentFileNum, - &relationStorageManager, - &state, - &relBufpoolKind, - &parentXid, - &serialNum, - &previousFreeTid, - &sharedStorage); - - if (state == PersistentFileSysState_Created && - relFileNode.spcNode == persistentRelfileCheckTablespace) - { - persistentRelfileCheckTablespaceUseCount++; - if (persistentRelfileCheckTablespaceUseCount == 1) - { - memcpy(&persistentRelfileCheckTablespaceRelFileNode, &relFileNode, sizeof(RelFileNode)); - } - } - - return true; // Continue. -} - -void PersistentRelfile_CheckTablespace( - Oid tablespace, - - int32 *useCount, - - RelFileNode *exampleRelFileNode) -{ - persistentRelfileCheckTablespace = tablespace; - persistentRelfileCheckTablespaceUseCount = 0; - - MemSet(&persistentRelfileCheckTablespaceRelFileNode, 0, sizeof(RelFileNode)); - PersistentFileSysObj_Scan( - PersistentFsObjType_RelationFile, - PersistentRelfile_CheckTablespaceScanTupleCallback); - - *useCount = persistentRelfileCheckTablespaceUseCount; - memcpy(exampleRelFileNode, &persistentRelfileCheckTablespaceRelFileNode, sizeof(RelFileNode)); -} // ----------------------------------------------------------------------------- // State Change @@ -453,80 +375,6 @@ void PersistentRelfile_AddCreated( /* * Indicate the transaction commited and the relation is officially created. */ -void PersistentRelfile_FinishBufferPoolBulkLoad( - RelFileNode *relFileNode, - /* The tablespace, database, and relation OIDs for the created relation. */ - - ItemPointer persistentTid, - /* TID of the gp_persistent_rel_files tuple for the relation. */ - - int64 persistentSerialNum) - /* Serial number for the relation. Distinquishes the uses of the tuple. */ - -{ - WRITE_PERSISTENT_STATE_ORDERED_LOCK_DECLARE; - - PersistentFileSysObjName fsObjName; - - PersistentFileSysObjStateChangeResult stateChangeResult; - - if(RelFileNode_IsEmpty(relFileNode)) - elog(ERROR, "Invalid RelFileNode (0,0,0)"); - - if (Persistent_BeforePersistenceWork()) - { - if (Debug_persistent_print) - elog(Persistent_DebugPrintLevel(), - "Skipping persistent relation '%s' because we are before persistence work", - relpath(*relFileNode)); - - return; // The initdb process will load the persistent table once we out of bootstrap mode. - } - - PersistentRelfile_VerifyInitScan(); - - PersistentFileSysObjName_SetRelationFile( - &fsObjName, - relFileNode, - /* segmentFileNum */ 0, - is_tablespace_shared); - - // Do this check after skipping out if in bootstrap mode. - if (PersistentStore_IsZeroTid(persistentTid)) - elog(ERROR, "TID for persistent '%s' tuple for 'Created' is invalid (0,0)", - PersistentFileSysObjName_TypeAndObjectName(&fsObjName)); - - if (persistentSerialNum == 0) - elog(ERROR, "Persistent '%s' serial number for 'Created' is invalid (0)", - PersistentFileSysObjName_TypeAndObjectName(&fsObjName)); - - WRITE_PERSISTENT_STATE_ORDERED_LOCK; - - stateChangeResult = - PersistentFileSysObj_StateChange( - &fsObjName, - persistentTid, - persistentSerialNum, - PersistentFileSysState_CreatePending, - /* retryPossible */ false, - /* flushToXlog */ false, - /* oldState */ NULL, - /* verifiedActionCallback */ NULL); - - WRITE_PERSISTENT_STATE_ORDERED_UNLOCK; - - if (Debug_persistent_print) - elog(Persistent_DebugPrintLevel(), - "Persistent relation: '%s' changed state from 'Bulk Load Create Pending' to 'Create Pending', serial number " INT64_FORMAT " at TID %s (State-Change result '%s')", - PersistentFileSysObjName_ObjectName(&fsObjName), - persistentSerialNum, - ItemPointerToString(persistentTid), - PersistentFileSysObjStateChangeResult_Name(stateChangeResult)); -} - -/* - * Indicate the transaction commited and the relation is officially created. - */ void PersistentRelfile_Created( PersistentFileSysObjName *fsObjName, /* The tablespace, database, and relation OIDs for the created relation. */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7c8fc376/src/include/cdb/cdbpersistentrelfile.h ---------------------------------------------------------------------- diff --git a/src/include/cdb/cdbpersistentrelfile.h b/src/include/cdb/cdbpersistentrelfile.h index c89412b..657e939 100644 --- a/src/include/cdb/cdbpersistentrelfile.h +++ b/src/include/cdb/cdbpersistentrelfile.h @@ -44,15 +44,6 @@ extern int64 PersistentRelfile_MyHighestSerialNum(void); extern int64 PersistentRelfile_CurrentMaxSerialNum(void); -extern void PersistentRelfile_CheckTablespace( - Oid tablespace, - - int32 *useCount, - - RelFileNode *exampleRelFileNode); - -extern void PersistentRelfile_FlushXLog(void); - extern void PersistentRelfile_Reset(void); /* @@ -115,16 +106,6 @@ extern void PersistentRelfile_AddCreated( // Transaction End // ----------------------------------------------------------------------------- -void PersistentRelfile_FinishBufferPoolBulkLoad( - RelFileNode *relFileNode, - /* The tablespace, database, and relation OIDs for the created relation. */ - - ItemPointer persistentTid, - /* TID of the gp_persistent_rel_files tuple for the relation. */ - - int64 persistentSerialNum); - /* Serial number for the relation. Distinquishes the uses of the tuple. */ - /* * Indicate the transaction commited and the relation is officially created. */
