@Test public void testDeleteBackUpInfo() throws MetaStoreException { BackUpInfo backUpInfo1 = new BackUpInfo(1, "test1", "test1", 1); metaStore.insertBackUpInfo(backUpInfo1); Assert.assertTrue(metaStore.srcInbackup("test1/dfafdsaf")); Assert.assertFalse(metaStore.srcInbackup("test2")); metaStore.deleteBackUpInfo(1); Assert.assertTrue(metaStore.listAllBackUpInfo().size() == 0); metaStore.insertBackUpInfo(backUpInfo1); metaStore.deleteAllBackUpInfo(); Assert.assertTrue(metaStore.listAllBackUpInfo().size() == 0); }
@Override public void deleteBackUpInfo(long rid) throws MetaStoreException { try { BackUpInfo backUpInfo = getBackUpInfo(rid); if (backUpInfo != null) { if (backUpInfoDao.getBySrc(backUpInfo.getSrc()).size() == 1) { if (setBackSrc != null) { setBackSrc.remove(backUpInfo.getSrc()); } } backUpInfoDao.delete(rid); } } catch (Exception e) { throw new MetaStoreException(e); } }
MetaStore implements CopyMetaService, CmdletMetaService, BackupMetaService { @Override public void deleteBackUpInfo(long rid) throws MetaStoreException { try { BackUpInfo backUpInfo = getBackUpInfo(rid); if (backUpInfo != null) { if (backUpInfoDao.getBySrc(backUpInfo.getSrc()).size() == 1) { if (setBackSrc != null) { setBackSrc.remove(backUpInfo.getSrc()); } } backUpInfoDao.delete(rid); } } catch (Exception e) { throw new MetaStoreException(e); } } }
MetaStore implements CopyMetaService, CmdletMetaService, BackupMetaService { @Override public void deleteBackUpInfo(long rid) throws MetaStoreException { try { BackUpInfo backUpInfo = getBackUpInfo(rid); if (backUpInfo != null) { if (backUpInfoDao.getBySrc(backUpInfo.getSrc()).size() == 1) { if (setBackSrc != null) { setBackSrc.remove(backUpInfo.getSrc()); } } backUpInfoDao.delete(rid); } } catch (Exception e) { throw new MetaStoreException(e); } } MetaStore(DBPool pool); }
MetaStore implements CopyMetaService, CmdletMetaService, BackupMetaService { @Override public void deleteBackUpInfo(long rid) throws MetaStoreException { try { BackUpInfo backUpInfo = getBackUpInfo(rid); if (backUpInfo != null) { if (backUpInfoDao.getBySrc(backUpInfo.getSrc()).size() == 1) { if (setBackSrc != null) { setBackSrc.remove(backUpInfo.getSrc()); } } backUpInfoDao.delete(rid); } } catch (Exception e) { throw new MetaStoreException(e); } } MetaStore(DBPool pool); Connection getConnection(); DBType getDbType(); Long queryForLong(String sql); void insertFile(FileInfo file); void insertFiles(FileInfo[] files); int updateFileStoragePolicy(String path, String policyName); FileInfo getFile(long fid); FileInfo getFile(String path); List<FileInfo> getFile(); List<FileInfo> getFilesByPrefix(String path); List<FileInfo> getFilesByPrefixInOrder(String path); List<FileInfo> getFilesByPaths(Collection<String> paths); Map<String, Long> getFileIDs(Collection<String> paths); Map<Long, String> getFilePaths(Collection<Long> ids); List<FileAccessInfo> getHotFiles(
    List<AccessCountTable> tables,
    int topNum); void updateAccessCountTableFid(long fidSrc, long fidDest); void deleteAllFileInfo(); void deleteAllEcPolicies(); void insertEcPolicies(List<ErasureCodingPolicyInfo> ecInfos); List<ErasureCodingPolicyInfo> getAllEcPolicies(); void deleteFileByPath(String path); List<AccessCountTable> getAllSortedTables(); void deleteAccessCountTable(
    AccessCountTable table); void insertAccessCountTable(
    AccessCountTable accessCountTable); void insertUpdateStoragesTable(StorageCapacity[] storages); void insertUpdateStoragesTable(List<StorageCapacity> storages); void insertUpdateStoragesTable(StorageCapacity storage); Map<String, StorageCapacity> getStorageCapacity(); void deleteStorage(String storageType); StorageCapacity getStorageCapacity(
    String type); boolean updateStoragesTable(String type,
      Long capacity, Long free); void insertStorageHistTable(StorageCapacity[] storages, long interval); List<StorageCapacity> getStorageHistoryData(String type, long interval,
      long startTime, long endTime); void deleteStorageHistoryOldRecords(String type, long interval, long beforTimeStamp); void insertCachedFiles(long fid, String path,
      long fromTime,
      long lastAccessTime, int numAccessed); void insertCachedFiles(List<CachedFileStatus> s); void deleteAllCachedFile(); boolean updateCachedFiles(Long fid,
      Long lastAccessTime,
      Integer numAccessed); void updateCachedFiles(Map<String, Long> pathToIds,
      List<FileAccessEvent> events); void deleteCachedFile(long fid); List<CachedFileStatus> getCachedFileStatus(); List<Long> getCachedFids(); CachedFileStatus getCachedFileStatus(
    long fid); void createProportionTable(AccessCountTable dest,
      AccessCountTable source); void dropTable(String tableName); void execute(String sql); void execute(List<String> statements); List<String> executeFilesPathQuery(
    String sql); List<DetailedFileAction> listFileActions(long rid,
      int size); List<DetailedFileAction> listFileActions(long rid, long start, long offset); long getNumFileAction(long rid); List<DetailedRuleInfo> listMoveRules(); List<DetailedRuleInfo> listSyncRules(); boolean insertNewRule(RuleInfo info); boolean updateRuleInfo(long ruleId, RuleState rs,
      long lastCheckTime, long checkedCount, int commandsGen); boolean updateRuleState(long ruleId, RuleState rs); RuleInfo getRuleInfo(long ruleId); List<RuleInfo> listPageRule(long start, long offset, List<String> orderBy,
      List<Boolean> desc); List<RuleInfo> getRuleInfo(); List<CmdletInfo> listPageCmdlets(long rid, long start, long offset,
      List<String> orderBy, List<Boolean> desc); long getNumCmdletsByRid(long rid); List<CmdletInfo> listPageCmdlets(long start, long offset,
      List<String> orderBy, List<Boolean> desc); void deleteAllRules(); void insertCmdlets(CmdletInfo[] commands); void insertCmdlet(CmdletInfo command); long getMaxCmdletId(); @Override CmdletInfo getCmdletById(long cid); @Override List<CmdletInfo> getCmdlets(String cidCondition,
      String ridCondition,
      CmdletState state); List<CmdletInfo> getCmdlets(CmdletState state); boolean updateCmdlet(CmdletInfo cmdletInfo); @Override boolean updateCmdlet(long cid, CmdletState state); @Override boolean updateCmdlet(long cid, String parameters, CmdletState state); @Override void deleteCmdlet(long cid); void batchDeleteCmdlet(List<Long> cids); int deleteFinishedCmdletsWithGenTimeBefore(long timestamp); int deleteKeepNewCmdlets(long num); int getNumCmdletsInTerminiatedStates(); void insertActions(ActionInfo[] actionInfos); void insertAction(ActionInfo actionInfo); List<ActionInfo> listPageAction(long start, long offset, List<String> orderBy,
      List<Boolean> desc); List<ActionInfo> searchAction(String path, long start,
      long offset, List<String> orderBy, List<Boolean> desc,
      long[] retTotalNumActions); void deleteCmdletActions(long cmdletId); void batchDeleteCmdletActions(List<Long> cmdletIds); void deleteAllActions(); void markActionFailed(long aid); void updateAction(ActionInfo actionInfo); void updateActions(ActionInfo[] actionInfos); List<ActionInfo> getNewCreatedActions(
    int size); List<ActionInfo> getNewCreatedActions(String actionName,
      int size); List<ActionInfo> getNewCreatedActions(String actionName,
      int size, boolean successful,
      boolean finished); List<ActionInfo> getNewCreatedActions(String actionName,
      int size,
      boolean finished); List<ActionInfo> getNewCreatedActions(String actionName,
      boolean successful,
      int size); List<ActionInfo> getActions(
    List<Long> aids); List<ActionInfo> getActions(String aidCondition,
                                     String cidCondition); List<ActionInfo> getActions(long rid, int size); List<ActionInfo> getActions(long rid, long start, long offset); ActionInfo getActionById(long aid); long getMaxActionId(); long getCountOfAllAction(); void insertStoragePolicy(StoragePolicy s); String getStoragePolicyName(int sid); Integer getStoragePolicyID(
    String policyName); boolean insertXattrList(Long fid,
                                 List<XAttribute> attributes); List<XAttribute> getXattrList(Long fid); @Override long insertFileDiff(FileDiff fileDiff); void insertFileDiffs(FileDiff[] fileDiffs); Long[] insertFileDiffs(List<FileDiff> fileDiffs); FileDiff getFileDiff(long did); List<FileDiff> getFileDiffsByFileName(String fileName); List<FileDiff> getFileDiffs(FileDiffState fileDiffState); @Override boolean updateFileDiff(long did,
                                FileDiffState state); boolean batchUpdateFileDiff(
    List<Long> did, List<FileDiffState> states, List<String> parameters); boolean batchUpdateFileDiff(
    List<Long> did, FileDiffState state); boolean updateFileDiff(long did,
                                FileDiffState state, String parameters); boolean updateFileDiff(long did,
                                String src); boolean updateFileDiff(FileDiff fileDiff); void updateFileDiff(List<FileDiff> fileDiffs); int getUselessFileDiffNum(); int deleteUselessFileDiff(int maxNumRecords); List<String> getSyncPath(int size); @Override List<FileDiff> getPendingDiff(); @Override List<FileDiff> getPendingDiff(long rid); @Override void deleteAllFileDiff(); void dropAllTables(); void initializeDataBase(); void checkTables(); int getTablesNum(String tableSet[]); void formatDataBase(); void aggregateTables(AccessCountTable destinationTable
    , List<AccessCountTable> tablesToAggregate); void setClusterConfig(
    ClusterConfig clusterConfig); void delClusterConfig(
    ClusterConfig clusterConfig); List<ClusterConfig> listClusterConfig(); GlobalConfig getDefaultGlobalConfigByName(
    String configName); void setGlobalConfig(
    GlobalConfig globalConfig); void insertDataNodeInfo(DataNodeInfo dataNodeInfo); void insertDataNodeInfos(DataNodeInfo[] dataNodeInfos); void insertDataNodeInfos(List<DataNodeInfo> dataNodeInfos); List<DataNodeInfo> getDataNodeInfoByUuid(String uuid); List<DataNodeInfo> getAllDataNodeInfo(); void deleteDataNodeInfo(String uuid); void deleteAllDataNodeInfo(); void insertDataNodeStorageInfo(DataNodeStorageInfo dataNodeStorageInfo); void insertDataNodeStorageInfos(
    DataNodeStorageInfo[] dataNodeStorageInfos); void insertDataNodeStorageInfos(
    List<DataNodeStorageInfo> dataNodeStorageInfos); boolean judgeTheRecordIfExist(String storageType); long getStoreCapacityOfDifferentStorageType(String storageType); long getStoreFreeOfDifferentStorageType(String storageType); List<DataNodeStorageInfo> getDataNodeStorageInfoByUuid(String uuid); List<DataNodeStorageInfo> getAllDataNodeStorageInfo(); void deleteDataNodeStorageInfo(String uuid); void deleteAllDataNodeStorageInfo(); @Override List<BackUpInfo> listAllBackUpInfo(); boolean srcInbackup(String src); @Override BackUpInfo getBackUpInfo(long rid); List<BackUpInfo> getBackUpInfoBySrc(String src); @Override void deleteAllBackUpInfo(); @Override void deleteBackUpInfo(long rid); @Override void insertBackUpInfo(
    BackUpInfo backUpInfo); List<ClusterInfo> listAllClusterInfo(); List<SystemInfo> listAllSystemInfo(); List<UserInfo> listAllUserInfo(); ClusterInfo getClusterInfoByCid(long id); SystemInfo getSystemInfoByProperty(
    String property); UserInfo getUserInfoByUserName(
      String name); boolean containSystemInfo(String property); boolean containUserInfo(String name); void deleteAllClusterInfo(); void updateSystemInfo(
    SystemInfo systemInfo); void newPassword(
      UserInfo userInfo); void updateAndInsertIfNotExist(
    SystemInfo systemInfo); void deleteClusterInfo(long cid); void deleteSystemInfo(
    String property); void insertClusterInfo(
    ClusterInfo clusterInfo); void insertSystemInfo(SystemInfo systemInfo); void insertUserInfo(UserInfo userInfo); void insertUpdateFileState(FileState fileState); void insertCompactFileStates(CompactFileState[] compactFileStates); FileState getFileState(String path); Map<String, FileState> getFileStates(List<String> paths); void deleteFileState(String filePath); void deleteCompactFileStates(List<String> paths); List<String> getSmallFilesByContainerFile(String containerFilePath); List<String> getAllContainerFiles(); synchronized void deleteAllFileState(); synchronized CompressionFileState getCompressionInfo(
      String fileName); }
MetaStore implements CopyMetaService, CmdletMetaService, BackupMetaService { @Override public void deleteBackUpInfo(long rid) throws MetaStoreException { try { BackUpInfo backUpInfo = getBackUpInfo(rid); if (backUpInfo != null) { if (backUpInfoDao.getBySrc(backUpInfo.getSrc()).size() == 1) { if (setBackSrc != null) { setBackSrc.remove(backUpInfo.getSrc()); } } backUpInfoDao.delete(rid); } } catch (Exception e) { throw new MetaStoreException(e); } } MetaStore(DBPool pool); Connection getConnection(); DBType getDbType(); Long queryForLong(String sql); void insertFile(FileInfo file); void insertFiles(FileInfo[] files); int updateFileStoragePolicy(String path, String policyName); FileInfo getFile(long fid); FileInfo getFile(String path); List<FileInfo> getFile(); List<FileInfo> getFilesByPrefix(String path); List<FileInfo> getFilesByPrefixInOrder(String path); List<FileInfo> getFilesByPaths(Collection<String> paths); Map<String, Long> getFileIDs(Collection<String> paths); Map<Long, String> getFilePaths(Collection<Long> ids); List<FileAccessInfo> getHotFiles(
    List<AccessCountTable> tables,
    int topNum); void updateAccessCountTableFid(long fidSrc, long fidDest); void deleteAllFileInfo(); void deleteAllEcPolicies(); void insertEcPolicies(List<ErasureCodingPolicyInfo> ecInfos); List<ErasureCodingPolicyInfo> getAllEcPolicies(); void deleteFileByPath(String path); List<AccessCountTable> getAllSortedTables(); void deleteAccessCountTable(
    AccessCountTable table); void insertAccessCountTable(
    AccessCountTable accessCountTable); void insertUpdateStoragesTable(StorageCapacity[] storages); void insertUpdateStoragesTable(List<StorageCapacity> storages); void insertUpdateStoragesTable(StorageCapacity storage); Map<String, StorageCapacity> getStorageCapacity(); void deleteStorage(String storageType); StorageCapacity getStorageCapacity(
    String type); boolean updateStoragesTable(String type,
      Long capacity, Long free); void insertStorageHistTable(StorageCapacity[] storages, long interval); List<StorageCapacity> getStorageHistoryData(String type, long interval,
      long startTime, long endTime); void deleteStorageHistoryOldRecords(String type, long interval, long beforTimeStamp); void insertCachedFiles(long fid, String path,
      long fromTime,
      long lastAccessTime, int numAccessed); void insertCachedFiles(List<CachedFileStatus> s); void deleteAllCachedFile(); boolean updateCachedFiles(Long fid,
      Long lastAccessTime,
      Integer numAccessed); void updateCachedFiles(Map<String, Long> pathToIds,
      List<FileAccessEvent> events); void deleteCachedFile(long fid); List<CachedFileStatus> getCachedFileStatus(); List<Long> getCachedFids(); CachedFileStatus getCachedFileStatus(
    long fid); void createProportionTable(AccessCountTable dest,
      AccessCountTable source); void dropTable(String tableName); void execute(String sql); void execute(List<String> statements); List<String> executeFilesPathQuery(
    String sql); List<DetailedFileAction> listFileActions(long rid,
      int size); List<DetailedFileAction> listFileActions(long rid, long start, long offset); long getNumFileAction(long rid); List<DetailedRuleInfo> listMoveRules(); List<DetailedRuleInfo> listSyncRules(); boolean insertNewRule(RuleInfo info); boolean updateRuleInfo(long ruleId, RuleState rs,
      long lastCheckTime, long checkedCount, int commandsGen); boolean updateRuleState(long ruleId, RuleState rs); RuleInfo getRuleInfo(long ruleId); List<RuleInfo> listPageRule(long start, long offset, List<String> orderBy,
      List<Boolean> desc); List<RuleInfo> getRuleInfo(); List<CmdletInfo> listPageCmdlets(long rid, long start, long offset,
      List<String> orderBy, List<Boolean> desc); long getNumCmdletsByRid(long rid); List<CmdletInfo> listPageCmdlets(long start, long offset,
      List<String> orderBy, List<Boolean> desc); void deleteAllRules(); void insertCmdlets(CmdletInfo[] commands); void insertCmdlet(CmdletInfo command); long getMaxCmdletId(); @Override CmdletInfo getCmdletById(long cid); @Override List<CmdletInfo> getCmdlets(String cidCondition,
      String ridCondition,
      CmdletState state); List<CmdletInfo> getCmdlets(CmdletState state); boolean updateCmdlet(CmdletInfo cmdletInfo); @Override boolean updateCmdlet(long cid, CmdletState state); @Override boolean updateCmdlet(long cid, String parameters, CmdletState state); @Override void deleteCmdlet(long cid); void batchDeleteCmdlet(List<Long> cids); int deleteFinishedCmdletsWithGenTimeBefore(long timestamp); int deleteKeepNewCmdlets(long num); int getNumCmdletsInTerminiatedStates(); void insertActions(ActionInfo[] actionInfos); void insertAction(ActionInfo actionInfo); List<ActionInfo> listPageAction(long start, long offset, List<String> orderBy,
      List<Boolean> desc); List<ActionInfo> searchAction(String path, long start,
      long offset, List<String> orderBy, List<Boolean> desc,
      long[] retTotalNumActions); void deleteCmdletActions(long cmdletId); void batchDeleteCmdletActions(List<Long> cmdletIds); void deleteAllActions(); void markActionFailed(long aid); void updateAction(ActionInfo actionInfo); void updateActions(ActionInfo[] actionInfos); List<ActionInfo> getNewCreatedActions(
    int size); List<ActionInfo> getNewCreatedActions(String actionName,
      int size); List<ActionInfo> getNewCreatedActions(String actionName,
      int size, boolean successful,
      boolean finished); List<ActionInfo> getNewCreatedActions(String actionName,
      int size,
      boolean finished); List<ActionInfo> getNewCreatedActions(String actionName,
      boolean successful,
      int size); List<ActionInfo> getActions(
    List<Long> aids); List<ActionInfo> getActions(String aidCondition,
                                     String cidCondition); List<ActionInfo> getActions(long rid, int size); List<ActionInfo> getActions(long rid, long start, long offset); ActionInfo getActionById(long aid); long getMaxActionId(); long getCountOfAllAction(); void insertStoragePolicy(StoragePolicy s); String getStoragePolicyName(int sid); Integer getStoragePolicyID(
    String policyName); boolean insertXattrList(Long fid,
                                 List<XAttribute> attributes); List<XAttribute> getXattrList(Long fid); @Override long insertFileDiff(FileDiff fileDiff); void insertFileDiffs(FileDiff[] fileDiffs); Long[] insertFileDiffs(List<FileDiff> fileDiffs); FileDiff getFileDiff(long did); List<FileDiff> getFileDiffsByFileName(String fileName); List<FileDiff> getFileDiffs(FileDiffState fileDiffState); @Override boolean updateFileDiff(long did,
                                FileDiffState state); boolean batchUpdateFileDiff(
    List<Long> did, List<FileDiffState> states, List<String> parameters); boolean batchUpdateFileDiff(
    List<Long> did, FileDiffState state); boolean updateFileDiff(long did,
                                FileDiffState state, String parameters); boolean updateFileDiff(long did,
                                String src); boolean updateFileDiff(FileDiff fileDiff); void updateFileDiff(List<FileDiff> fileDiffs); int getUselessFileDiffNum(); int deleteUselessFileDiff(int maxNumRecords); List<String> getSyncPath(int size); @Override List<FileDiff> getPendingDiff(); @Override List<FileDiff> getPendingDiff(long rid); @Override void deleteAllFileDiff(); void dropAllTables(); void initializeDataBase(); void checkTables(); int getTablesNum(String tableSet[]); void formatDataBase(); void aggregateTables(AccessCountTable destinationTable
    , List<AccessCountTable> tablesToAggregate); void setClusterConfig(
    ClusterConfig clusterConfig); void delClusterConfig(
    ClusterConfig clusterConfig); List<ClusterConfig> listClusterConfig(); GlobalConfig getDefaultGlobalConfigByName(
    String configName); void setGlobalConfig(
    GlobalConfig globalConfig); void insertDataNodeInfo(DataNodeInfo dataNodeInfo); void insertDataNodeInfos(DataNodeInfo[] dataNodeInfos); void insertDataNodeInfos(List<DataNodeInfo> dataNodeInfos); List<DataNodeInfo> getDataNodeInfoByUuid(String uuid); List<DataNodeInfo> getAllDataNodeInfo(); void deleteDataNodeInfo(String uuid); void deleteAllDataNodeInfo(); void insertDataNodeStorageInfo(DataNodeStorageInfo dataNodeStorageInfo); void insertDataNodeStorageInfos(
    DataNodeStorageInfo[] dataNodeStorageInfos); void insertDataNodeStorageInfos(
    List<DataNodeStorageInfo> dataNodeStorageInfos); boolean judgeTheRecordIfExist(String storageType); long getStoreCapacityOfDifferentStorageType(String storageType); long getStoreFreeOfDifferentStorageType(String storageType); List<DataNodeStorageInfo> getDataNodeStorageInfoByUuid(String uuid); List<DataNodeStorageInfo> getAllDataNodeStorageInfo(); void deleteDataNodeStorageInfo(String uuid); void deleteAllDataNodeStorageInfo(); @Override List<BackUpInfo> listAllBackUpInfo(); boolean srcInbackup(String src); @Override BackUpInfo getBackUpInfo(long rid); List<BackUpInfo> getBackUpInfoBySrc(String src); @Override void deleteAllBackUpInfo(); @Override void deleteBackUpInfo(long rid); @Override void insertBackUpInfo(
    BackUpInfo backUpInfo); List<ClusterInfo> listAllClusterInfo(); List<SystemInfo> listAllSystemInfo(); List<UserInfo> listAllUserInfo(); ClusterInfo getClusterInfoByCid(long id); SystemInfo getSystemInfoByProperty(
    String property); UserInfo getUserInfoByUserName(
      String name); boolean containSystemInfo(String property); boolean containUserInfo(String name); void deleteAllClusterInfo(); void updateSystemInfo(
    SystemInfo systemInfo); void newPassword(
      UserInfo userInfo); void updateAndInsertIfNotExist(
    SystemInfo systemInfo); void deleteClusterInfo(long cid); void deleteSystemInfo(
    String property); void insertClusterInfo(
    ClusterInfo clusterInfo); void insertSystemInfo(SystemInfo systemInfo); void insertUserInfo(UserInfo userInfo); void insertUpdateFileState(FileState fileState); void insertCompactFileStates(CompactFileState[] compactFileStates); FileState getFileState(String path); Map<String, FileState> getFileStates(List<String> paths); void deleteFileState(String filePath); void deleteCompactFileStates(List<String> paths); List<String> getSmallFilesByContainerFile(String containerFilePath); List<String> getAllContainerFiles(); synchronized void deleteAllFileState(); synchronized CompressionFileState getCompressionInfo(
      String fileName);  }