You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2012/10/29 22:33:15 UTC

svn commit: r1403539 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java

Author: stack
Date: Mon Oct 29 21:33:15 2012
New Revision: 1403539

URL: http://svn.apache.org/viewvc?rev=1403539&view=rev
Log:
HBASE-6707 TEST org.apache.hadoop.hbase.backup.example.TestZooKeeperTableArchiveClient.testMultipleTables flaps; ADDENDUM v4 -- I FORGOT THIS BIT

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java?rev=1403539&r1=1403538&r2=1403539&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/example/TestZooKeeperTableArchiveClient.java Mon Oct 29 21:33:15 2012
@@ -243,8 +243,9 @@ public class TestZooKeeperTableArchiveCl
     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 @@ public class TestZooKeeperTableArchiveCl
       @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 @@ public class TestZooKeeperTableArchiveCl
    */
   private List<Path> 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 null;
+    }
 
     List<Path> allFiles = new ArrayList<Path>();
     for (FileStatus file : files) {