From 0fd48220496c9f2d4d392bc49214f3bc051d87d3 Mon Sep 17 00:00:00 2001 From: mattl-netflix <63665634+mattl-netflix@users.noreply.github.com> Date: Wed, 23 Sep 2020 09:56:08 -0700 Subject: [PATCH] CASS-1937 cease filtering out OpsCenter keyspace. (#908) --- .../netflix/priam/backup/AbstractBackup.java | 36 +++++-------------- 1 file changed, 9 insertions(+), 27 deletions(-) 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; - } }