diff --git a/priam/src/main/java/com/netflix/priam/backup/AbstractBackup.java b/priam/src/main/java/com/netflix/priam/backup/AbstractBackup.java index c073c9a4c..b4a222d6d 100644 --- a/priam/src/main/java/com/netflix/priam/backup/AbstractBackup.java +++ b/priam/src/main/java/com/netflix/priam/backup/AbstractBackup.java @@ -144,20 +144,16 @@ protected final void initiateBackup( for (File columnFamilyDir : columnFamilyDirectories) { File backupDir = new File(columnFamilyDir, monitoringFolder); - - if (!isValidBackupDir(keyspaceDir, backupDir)) { - continue; - } - - String columnFamilyName = columnFamilyDir.getName().split("-")[0]; - if (backupRestoreUtil.isFiltered( - keyspaceDir.getName(), columnFamilyDir.getName())) { - // Clean the backup/snapshot directory else files will keep getting accumulated. - SystemUtils.cleanupDir(backupDir.getAbsolutePath(), null); - continue; + if (backupDir.exists() && backupDir.isDirectory() && backupDir.canRead()) { + String columnFamilyName = columnFamilyDir.getName().split("-")[0]; + if (backupRestoreUtil.isFiltered(keyspaceDir.getName(), columnFamilyName)) { + // Clean the backup/snapshot directory else files will keep getting + // accumulated. + SystemUtils.cleanupDir(backupDir.getAbsolutePath(), null); + } else { + processColumnFamily(keyspaceDir.getName(), columnFamilyName, backupDir); + } } - - processColumnFamily(keyspaceDir.getName(), columnFamilyName, backupDir); } // end processing all CFs for keyspace } // end processing keyspaces under the C* data dir } @@ -206,18 +202,4 @@ public static Set getBackupDirectories(IConfiguration config, String monit } return backupPaths; } - - /** Filters unwanted keyspaces */ - private boolean isValidBackupDir(File keyspaceDir, File backupDir) { - if (backupDir == null || !backupDir.isDirectory() || !backupDir.exists()) return false; - String keyspaceName = keyspaceDir.getName(); - if (BackupRestoreUtil.FILTER_KEYSPACE.contains(keyspaceName)) { - logger.debug( - "{} is not consider a valid keyspace backup directory, will be bypass.", - keyspaceName); - return false; - } - - return true; - } }