Index: hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java (revision 1394189) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java (working copy) @@ -243,8 +243,9 @@ assertTrue("Didn't archive files for:" + STRING_TABLE_NAME, initialCountForPrimary > 0); assertTrue("Didn't archive files for:" + otherTable, initialCountForOtherTable > 0); - // run the cleaners - CountDownLatch finished = setupCleanerWatching(delegate, cleaners, files.size()); + // run the cleaners, checking for each of the directories + files (both should be deleted and + // need to be checked) in 'otherTable' and the files (which should be retained) in the 'table' + CountDownLatch finished = setupCleanerWatching(delegate, cleaners, files.size() + 3); // run the cleaner cleaner.start(); // wait for the cleaner to check all the files @@ -335,10 +336,12 @@ @Override public Boolean answer(InvocationOnMock invocation) throws Throwable { counter[0]++; - LOG.debug(counter[0] + "/ " + expected + ") Mocking call to isFileDeletable"); - if (counter[0] > expected) finished.countDown(); - return (Boolean) invocation.callRealMethod(); + LOG.debug(counter[0] + "/ " + expected + ") Wrapping call to isFileDeletable for file: " + + invocation.getArguments()[0]); + Boolean ret = (Boolean) invocation.callRealMethod(); + if (counter[0] >= expected) finished.countDown(); + return ret; } }).when(delegateSpy).isFileDeletable(Mockito.any(Path.class)); cleaners.set(0, delegateSpy); @@ -353,7 +356,10 @@ */ private List getAllFiles(FileSystem fs, Path dir) throws IOException { FileStatus[] files = FSUtils.listStatus(fs, dir, null); - if (files == null) return null; + if (files == null) { + LOG.warn("No files under:" + dir); + return new ArrayList(); + } List allFiles = new ArrayList(); for (FileStatus file : files) { Index: hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/LongTermArchivingHFileCleaner.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/LongTermArchivingHFileCleaner.java (revision 1394189) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/LongTermArchivingHFileCleaner.java (working copy) @@ -67,7 +67,9 @@ Path table = region.getParent(); String tableName = table.getName(); - return !archiveTracker.keepHFiles(tableName); + boolean ret = !archiveTracker.keepHFiles(tableName); + LOG.debug("Archiver says to [" + (ret ? "delete" : "keep") + "] files for table:" + tableName); + return ret; } catch (IOException e) { LOG.error("Failed to lookup status of:" + file + ", keeping it just incase.", e); return false;