Example #1
0
   static INT32 _rtnParseQueryMeta( const BSONObj &meta, const CHAR *&scanType,
                                    const CHAR *&indexName, INT32 &indexLID,
                                    INT32 &direction, BSONObj &blockObj )
   {
      INT32 rc = SDB_OK ;
      BSONElement ele ;

      rc = rtnGetStringElement( meta, FIELD_NAME_SCANTYPE, &scanType ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_SCANTYPE, rc ) ;

      if ( 0 == ossStrcmp( scanType, VALUE_NAME_IXSCAN ) )
      {
         ele = meta.getField( FIELD_NAME_INDEXBLOCKS ) ;

         rc = rtnGetStringElement( meta, FIELD_NAME_INDEXNAME, &indexName ) ;
         PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                      FIELD_NAME_INDEXNAME, rc ) ;

         rc = rtnGetIntElement( meta, FIELD_NAME_INDEXLID, indexLID ) ;
         PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                      FIELD_NAME_INDEXLID, rc ) ;

         rc = rtnGetIntElement( meta, FIELD_NAME_DIRECTION, direction ) ;
         PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                      FIELD_NAME_DIRECTION, rc ) ;
      }
      else if ( 0 == ossStrcmp( scanType, VALUE_NAME_TBSCAN ) )
      {
         ele = meta.getField( FIELD_NAME_DATABLOCKS ) ;
      }
      else
      {
         PD_LOG( PDERROR, "Query meta[%s] scan type error",
                 meta.toString().c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      if ( Array != ele.type() )
      {
         PD_LOG( PDERROR, "Block field[%s] type error",
                 ele.toString().c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      blockObj = ele.embeddedObject() ;

   done:
      return rc ;
   error:
      goto done ;
   }
Example #2
0
   static INT32 _checkDstGroupInCSDomain( const CHAR * groupName,
                                          const CHAR * clFullName,
                                          BOOLEAN & existed,
                                          pmdEDUCB *cb )
   {
      INT32 rc = SDB_OK ;
      CHAR szSpace [ DMS_COLLECTION_SPACE_NAME_SZ + 1 ]  = {0} ;
      CHAR szCollection [ DMS_COLLECTION_NAME_SZ + 1 ] = {0} ;

      existed = FALSE ;

      BSONObj csObj ;
      BOOLEAN csExist = FALSE ;

      const CHAR *domainName = NULL ;

      rc = catResolveCollectionName( clFullName, ossStrlen( clFullName ),
                                     szSpace, DMS_COLLECTION_SPACE_NAME_SZ,
                                     szCollection, DMS_COLLECTION_NAME_SZ ) ;
      PD_RC_CHECK( rc, PDERROR, "Resolve collection name[%s] failed, rc: %d",
                   clFullName, rc ) ;

      rc = catCheckSpaceExist( szSpace, csExist, csObj, cb ) ;
      PD_RC_CHECK( rc, PDWARNING, "Check collection space[%s] exist failed, "
                   "rc: %d", szSpace, rc ) ;
      PD_CHECK( csExist, SDB_DMS_CS_NOTEXIST, error, PDWARNING,
                "Collection space[%s] is not exist", szSpace ) ;

      rc = rtnGetStringElement( csObj, CAT_DOMAIN_NAME, &domainName ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         existed = TRUE ;
         rc = SDB_OK ;
         goto done ;
      }
      else if ( SDB_OK == rc )
      {
         BSONObj domainObj ;
         map<string, INT32> groups ;
         rc = catGetDomainObj( domainName, domainObj, cb ) ;
         PD_RC_CHECK( rc, PDERROR, "Get domain[%s] failed, rc: %d",
                      domainName, rc ) ;

         rc = catGetDomainGroups( domainObj,  groups ) ;
         PD_RC_CHECK( rc, PDERROR, "Failed to get groups from domain info[%s], "
                      "rc: %d", domainObj.toString().c_str(), rc ) ;

         if ( groups.find( groupName ) != groups.end() )
         {
            existed = TRUE ;
         }
      }

   done:
      return rc ;
   error:
      goto done ;
   }
Example #3
0
   INT32 catSplitReady( const BSONObj & splitInfo, const CHAR * clFullName,
                        clsCatalogSet * cataSet, INT32 & groupID,
                        clsTaskMgr &taskMgr, pmdEDUCB * cb, INT16 w,
                        UINT64 *pTaskID )
   {
      INT32 rc = SDB_OK ;

      BSONObj bKey ;
      BSONObj eKey ;
      BOOLEAN usePercent = FALSE ;
      FLOAT64 percent = 0.0 ;
      const CHAR* sourceName = NULL ;
      const CHAR* dstName = NULL ;
      groupID = CAT_INVALID_GROUPID ;
      INT32 sourceID = CAT_INVALID_GROUPID ;
      BOOLEAN dstInCSDomain = FALSE ;

      rc = rtnGetObjElement( splitInfo, CAT_SPLITVALUE_NAME, bKey ) ;
      if ( SDB_FIELD_NOT_EXIST == rc ||
           ( SDB_OK == rc && bKey.isEmpty() ) )
      {
         usePercent = TRUE ;
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                   CAT_SPLITVALUE_NAME, rc ) ;

      percent = splitInfo.getField( CAT_SPLITPERCENT_NAME ).numberDouble() ;

      if ( !usePercent )
      {
         rc = rtnGetObjElement( splitInfo, CAT_SPLITENDVALUE_NAME, eKey ) ;
         if ( SDB_FIELD_NOT_EXIST == rc )
         {
            rc = SDB_OK ;
         }
         PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                      CAT_SPLITENDVALUE_NAME, rc ) ;
      }
      else
      {
         PD_CHECK( percent > 0.0 && percent <= 100.0, SDB_INVALIDARG, error,
                   PDERROR, "Split percent value[%f] error", percent ) ;
         PD_CHECK( cataSet->isHashSharding(), SDB_SYS, error,
                   PDERROR, "Split by percent must be hash sharding" ) ;
      }

      rc = rtnGetStringElement( splitInfo, CAT_SOURCE_NAME, &sourceName ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                   CAT_SOURCE_NAME, rc ) ;
      rc = catGroupNameValidate( sourceName, FALSE ) ;
      PD_RC_CHECK( rc, PDERROR, "Source group name[%s] is not valid, rc: %d",
                   sourceName, rc ) ;

      rc = rtnGetStringElement( splitInfo, CAT_TARGET_NAME, &dstName ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                   CAT_TARGET_NAME, rc ) ;
      rc = catGroupNameValidate( dstName, FALSE ) ;
      PD_RC_CHECK( rc, PDERROR, "Target group name[%s] is not valid, rc: %d",
                   dstName, rc ) ;

      PD_CHECK( 0 != ossStrcmp( dstName, sourceName ), SDB_INVALIDARG, error,
                PDERROR, "Target group name can not the same with source group"
                " name" ) ;

      rc = _checkDstGroupInCSDomain( dstName, clFullName, dstInCSDomain, cb ) ;
      PD_RC_CHECK( rc, PDWARNING, "Check destination group in collection space"
                   "domain failed, rc: %d", rc ) ;
      PD_CHECK( dstInCSDomain, SDB_CAT_GROUP_NOT_IN_DOMAIN, error, PDWARNING,
                "Split target group[%s] is not in collection space domain",
                dstName ) ;

      rc = catGroupName2ID( sourceName, sourceID, cb ) ;
      PD_RC_CHECK( rc, PDERROR, "Group name[%s] to id failed, rc: %d",
                   sourceName, rc ) ;

      PD_CHECK( isGroupInCataSet( sourceID, *cataSet ),
                SDB_CL_NOT_EXIST_ON_GROUP,
                error, PDWARNING, "The collection[%s] does not exist on source "
                "group[%s]", clFullName, sourceName ) ;

      rc = catGroupName2ID( dstName, groupID, cb ) ;
      PD_RC_CHECK( rc, PDERROR, "Group name[%s] to id failed, rc: %d",
                   dstName, rc ) ;

      if ( !usePercent  )
      {
         rc = _checkSplitKey( bKey, *cataSet, sourceID, FALSE, FALSE ) ;
         PD_RC_CHECK( rc, PDERROR, "Check split key failed, rc: %d", rc ) ;

         rc = _checkSplitKey( eKey, *cataSet, sourceID, TRUE, TRUE ) ;
         PD_RC_CHECK( rc, PDERROR, "Check split end key failed, rc: %d", rc ) ;
      }

      {
         BSONObj match ;
         BSONObj taskObj ;
         BOOLEAN conflict = FALSE ;
         clsSplitTask splitTask( taskMgr.getTaskID() ) ;
         if ( usePercent )
         {
            rc = splitTask.calcHashPartition( *cataSet, sourceID, percent,
                                              bKey, eKey ) ;
            PD_RC_CHECK( rc, PDERROR, "Calc hash percent partition split key "
                         "falied, rc: %d", rc ) ;
         }
         rc = splitTask.init( clFullName, sourceID, sourceName, groupID,
                              dstName, bKey, eKey, percent, *cataSet ) ;
         PD_RC_CHECK( rc, PDERROR, "Init split task failed, rc: %d", rc ) ;

         match = splitTask.toBson( CLS_SPLIT_MASK_CLNAME ) ;
         rc = catSplitCheckConflict( match, splitTask, conflict, cb ) ;
         PD_RC_CHECK( rc, PDERROR, "Check task conflict failed, rc: %d", rc ) ;
         PD_CHECK( FALSE == conflict, SDB_CLS_MUTEX_TASK_EXIST, error, PDERROR,
                   "Exist task not compatible with the new task" ) ;

         taskObj = splitTask.toBson( CLS_MASK_ALL ) ;
         rc = catAddTask( taskObj, cb, w ) ;
         PD_RC_CHECK( rc, PDERROR, "Add split task failed, rc: %d", rc ) ;

         if ( pTaskID )
         {
            *pTaskID = splitTask.taskID() ;
         }
      }

   done:
      return rc ;
   error:
      goto done ;
   }
Example #4
0
   INT32 catSplitPrepare( const BSONObj &splitInfo, const CHAR *clFullName,
                          clsCatalogSet *cataSet, INT32 &groupID,
                          pmdEDUCB *cb )
   {
      INT32 rc = SDB_OK ;

      BSONObj splitQuery ;
      BOOLEAN existQuery = TRUE ;
      FLOAT64 percent = 0.0 ;
      const CHAR* sourceName = NULL ;
      const CHAR* dstName = NULL ;
      groupID = CAT_INVALID_GROUPID ;
      BOOLEAN dstInCSDomain = FALSE ;

      rc = rtnGetObjElement( splitInfo, CAT_SPLITQUERY_NAME, splitQuery ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         existQuery = FALSE ;
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc , PDERROR, "Failed to get field[%s], rc: %d",
                   CAT_SPLITQUERY_NAME, rc ) ;

      percent = splitInfo.getField( CAT_SPLITPERCENT_NAME ).numberDouble() ;

      rc = rtnGetStringElement( splitInfo, CAT_SOURCE_NAME, &sourceName ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                   CAT_SOURCE_NAME, rc ) ;
      rc = catGroupNameValidate( sourceName, FALSE ) ;
      PD_RC_CHECK( rc, PDERROR, "Source group name[%s] is not valid, rc: %d",
                   sourceName, rc ) ;

      rc = rtnGetStringElement( splitInfo, CAT_TARGET_NAME, &dstName ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to get field[%s], rc: %d",
                   CAT_TARGET_NAME, rc ) ;
      rc = catGroupNameValidate( dstName, FALSE ) ;
      PD_RC_CHECK( rc, PDERROR, "Target group name[%s] is not valid, rc: %d",
                   dstName, rc ) ;

      PD_CHECK( 0 != ossStrcmp( dstName, sourceName ), SDB_INVALIDARG, error,
                PDERROR, "Target group name can not the same with source group"
                " name" ) ;

      rc = _checkDstGroupInCSDomain( dstName, clFullName, dstInCSDomain, cb ) ;
      PD_RC_CHECK( rc, PDWARNING, "Check destination group in collection space"
                   "domain failed, rc: %d", rc ) ;
      PD_CHECK( dstInCSDomain, SDB_CAT_GROUP_NOT_IN_DOMAIN, error, PDWARNING,
                "Split target group[%s] is not in collection space domain",
                dstName ) ;

      if ( FALSE == existQuery )
      {
         PD_CHECK( percent > 0.0 && percent <= 100.0, SDB_INVALIDARG, error,
                   PDERROR, "Split percent value[%f] error", percent ) ;
      }

      rc = catGroupName2ID( sourceName, groupID, cb ) ;
      PD_RC_CHECK( rc, PDERROR, "Group name[%s] to id failed, rc: %d",
                   sourceName, rc ) ;

      PD_CHECK( isGroupInCataSet( groupID, *cataSet ), SDB_CL_NOT_EXIST_ON_GROUP,
                error, PDWARNING, "The collection[%s] does not exist on source "
                "group[%s]", clFullName, sourceName ) ;

   done:
      return rc ;
   error:
      goto done ;
   }
Example #5
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNBACKUP, "rtnBackup" )
   INT32 rtnBackup( pmdEDUCB *cb, const CHAR *path, const CHAR *backupName,
                    BOOLEAN ensureInc, BOOLEAN rewrite, const CHAR *desp,
                    const BSONObj &option )
   {
      INT32 rc  = SDB_OK ;
      PD_TRACE_ENTRY ( SDB_RTNBACKUP ) ;
      string bkpath ;
      INT32 maxDataFileSize = 0 ;

      barBKOfflineLogger logger ;

      BOOLEAN isSubDir        = FALSE ;
      BOOLEAN enableDateDir   = FALSE ;
      BOOLEAN backupLog       = FALSE ;
      const CHAR *prefix      = NULL ;
      BOOLEAN compressed      = TRUE ;
      const CHAR *pCompType   = VALUE_NAME_SNAPPY ;
      UTIL_COMPRESSOR_TYPE compType = UTIL_COMPRESSOR_INVALID ;

      rc = rtnGetBooleanElement( option, FIELD_NAME_ISSUBDIR, isSubDir ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_ISSUBDIR, rc ) ;

      rc = rtnGetIntElement( option, FIELD_NAME_MAX_DATAFILE_SIZE,
                             maxDataFileSize ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_MAX_DATAFILE_SIZE, rc ) ;

      rc = rtnGetBooleanElement( option, FIELD_NAME_ENABLE_DATEDIR,
                                 enableDateDir ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_ENABLE_DATEDIR, rc ) ;

      rc = rtnGetStringElement( option, FIELD_NAME_PREFIX, &prefix ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_PREFIX, rc ) ;

      rc = rtnGetBooleanElement( option, FIELD_NAME_BACKUP_LOG, backupLog ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_BACKUP_LOG, rc ) ;

      rc = rtnGetBooleanElement( option, FIELD_NAME_COMPRESSED, compressed ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_COMPRESSED, rc ) ;

      rc = rtnGetStringElement( option, FIELD_NAME_COMPRESSIONTYPE,
                                &pCompType ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_COMPRESSIONTYPE, rc ) ;

      compType = utilString2CompressType( pCompType ) ;
      if ( UTIL_COMPRESSOR_INVALID == compType ||
           UTIL_COMPRESSOR_LZW == compType )
      {
         PD_LOG( PDERROR, "Field[%s]'s value[%s] is invalid, only support: %s",
                 FIELD_NAME_COMPRESSIONTYPE, pCompType,
                 "snappy/lz4/zlib" ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      if ( maxDataFileSize < BAR_MIN_DATAFILE_SIZE ||
           maxDataFileSize > BAR_MAX_DATAFILE_SIZE )
      {
         maxDataFileSize = BAR_DFT_DATAFILE_SIZE ;
      }

      if ( isSubDir && path )
      {
         bkpath = rtnFullPathName( pmdGetOptionCB()->getBkupPath(), path ) ;
      }
      else if ( path && 0 != path[0] )
      {
         bkpath = path ;
      }
      else
      {
         bkpath = pmdGetOptionCB()->getBkupPath() ;
      }

      if ( enableDateDir )
      {
         bkpath = rtnFullPathName( bkpath, _rtnMakeDateDirName() ) ;
      }

      rc = logger.init( bkpath.c_str(), backupName, maxDataFileSize, prefix,
                        ensureInc ? BAR_BACKUP_OP_TYPE_INC :
                        BAR_BACKUP_OP_TYPE_FULL, rewrite, desp ) ;
      PD_RC_CHECK( rc, PDERROR, "Init off line backup logger failed, rc: %d",
                   rc ) ;
      logger.setBackupLog( backupLog ) ;
      logger.enableCompress( compressed, compType ) ;

      rc = logger.backup( cb ) ;
      PD_RC_CHECK( rc, PDERROR, "Off line backup failed, rc: %d", rc ) ;

   done:
      PD_TRACE_EXITRC ( SDB_RTNBACKUP, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Example #6
0
   INT32 rtnRemoveBackup( pmdEDUCB *cb, const CHAR *path,
                          const CHAR *backupName,
                          const BSONObj &option )
   {
      INT32 rc = SDB_OK ;
      pmdKRCB *krcb = pmdGetKRCB () ;

      BOOLEAN isSubDir        = FALSE ;
      const CHAR *prefix      = NULL ;
      string bkpath ;
      INT32 incID             = -1 ;

      barBackupMgr bkMgr( krcb->getGroupName() ) ;

      rc = rtnGetBooleanElement( option, FIELD_NAME_ISSUBDIR, isSubDir ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_ISSUBDIR, rc ) ;

      rc = rtnGetStringElement( option, FIELD_NAME_PREFIX, &prefix ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_PREFIX, rc ) ;

      rc = rtnGetIntElement( option, FIELD_NAME_ID, incID ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_ID, rc ) ;

      if ( isSubDir && path )
      {
         bkpath = rtnFullPathName( pmdGetOptionCB()->getBkupPath(), path ) ;
      }
      else if ( path && 0 != path[0] )
      {
         bkpath = path ;
      }
      else
      {
         bkpath = pmdGetOptionCB()->getBkupPath() ;
      }

      rc = bkMgr.init( bkpath.c_str(), backupName, prefix ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to init backup manager, rc: %d", rc ) ;

      rc = bkMgr.drop( incID ) ;
      PD_RC_CHECK( rc, PDERROR, "Failed to drop backup[%s], ID:%d, rc: %d",
                   bkMgr.backupName(), incID, rc ) ;

   done:
      return rc ;
   error:
      goto done ;
   }
Example #7
0
   INT32 rtnDumpBackups( const BSONObj &hint, rtnContextDump *context )
   {
      INT32 rc = SDB_OK ;
      pmdKRCB *krcb = pmdGetKRCB () ;
      const CHAR *pPath = NULL ;
      const CHAR *backupName = NULL ;
      BOOLEAN isSubDir        = FALSE ;
      const CHAR *prefix      = NULL ;
      string bkpath ;
      BOOLEAN detail = FALSE ;
      barBackupMgr bkMgr( krcb->getGroupName() ) ;
      vector < BSONObj >  vecBackup ;
      UINT32 index = 0 ;

      rc = rtnGetStringElement( hint, FIELD_NAME_PATH, &pPath ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_PATH, rc ) ;

      rc = rtnGetStringElement( hint, FIELD_NAME_NAME, &backupName ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_NAME, rc ) ;
      rc = rtnGetBooleanElement( hint, FIELD_NAME_DETAIL, detail ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_DETAIL, rc ) ;

      rc = rtnGetBooleanElement( hint, FIELD_NAME_ISSUBDIR, isSubDir ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_ISSUBDIR, rc ) ;

      rc = rtnGetStringElement( hint, FIELD_NAME_PREFIX, &prefix ) ;
      if ( SDB_FIELD_NOT_EXIST == rc )
      {
         rc = SDB_OK ;
      }
      PD_RC_CHECK( rc, PDWARNING, "Failed to get field[%s], rc: %d",
                   FIELD_NAME_PREFIX, rc ) ;

      if ( isSubDir && pPath )
      {
         bkpath = rtnFullPathName( pmdGetOptionCB()->getBkupPath(), pPath ) ;
      }
      else if ( pPath && 0 != pPath[0] )
      {
         bkpath = pPath ;
      }
      else
      {
         bkpath = pmdGetOptionCB()->getBkupPath() ;
      }

      rc = bkMgr.init( bkpath.c_str(), backupName, prefix ) ;
      PD_RC_CHECK( rc, PDWARNING, "Init backup manager failed, rc: %d", rc ) ;

      rc = bkMgr.list( vecBackup, detail ) ;
      PD_RC_CHECK( rc, PDWARNING, "List backup failed, rc: %d", rc ) ;

      while ( index < vecBackup.size() )
      {
         rc = context->monAppend( vecBackup[index] ) ;
         PD_RC_CHECK( rc, PDERROR, "Add to obj[%s] to context failed, "
                      "rc: %d", vecBackup[index].toString().c_str(), rc ) ;
         ++index ;
      }

   done:
      return rc ;
   error:
      goto done ;
   }