You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zy...@apache.org on 2019/05/10 00:17:33 UTC
[hbase] branch branch-1 updated: HBASE-22389 Revert "HBASE-19275
TestSnapshotFileCache never worked properly" (#229)
This is an automated email from the ASF dual-hosted git repository.
zyork pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1 by this push:
new a66fafb HBASE-22389 Revert "HBASE-19275 TestSnapshotFileCache never worked properly" (#229)
a66fafb is described below
commit a66fafbad6244d0de995e52f1f670315afa82b49
Author: z-york <zy...@amazon.com>
AuthorDate: Thu May 9 17:17:28 2019 -0700
HBASE-22389 Revert "HBASE-19275 TestSnapshotFileCache never worked properly" (#229)
This reverts commit e8e4beacb039299a9e56cd355e3ada08784a7acb.
---
.../master/snapshot/TestSnapshotFileCache.java | 27 ++++++++++++----------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
index a8d36e2..1f386d3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
@@ -18,12 +18,10 @@
package org.apache.hadoop.hbase.master.snapshot;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.*;
-import com.google.common.collect.Iterables;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileStatus;
@@ -170,9 +168,7 @@ public class TestSnapshotFileCache {
// Make sure that all files are still present
for (Path path: files) {
- Iterable<FileStatus> nonSnapshotFiles = getNonSnapshotFiles(cache, path);
- assertFalse("Cache didn't find " + path.getName(),
- Iterables.contains(nonSnapshotFiles, path.getName()));
+ assertFalse("Cache didn't find " + path, contains(getNonSnapshotFiles(cache, path), path));
}
FSUtils.logFileSystemState(fs, rootDir, LOG);
@@ -183,9 +179,8 @@ public class TestSnapshotFileCache {
// The files should be in cache until next refresh
for (Path filePath: files) {
- Iterable<FileStatus> nonSnapshotFiles = getNonSnapshotFiles(cache, filePath);
- assertFalse("Cache didn't find " + filePath.getName(), Iterables.contains(nonSnapshotFiles,
- filePath.getName()));
+ assertFalse("Cache didn't find " + filePath,
+ contains(getNonSnapshotFiles(cache, filePath), filePath));
}
// then trigger a refresh
@@ -193,14 +188,22 @@ public class TestSnapshotFileCache {
// and not it shouldn't find those files
for (Path filePath: files) {
- Iterable<FileStatus> nonSnapshotFiles = getNonSnapshotFiles(cache, filePath);
- assertTrue("Cache found '" + filePath.getName() + "', but it shouldn't have.",
- !Iterables.contains(nonSnapshotFiles, filePath.getName()));
+ assertFalse("Cache found '" + filePath + "', but it shouldn't have.",
+ contains(getNonSnapshotFiles(cache, filePath), filePath));
}
}
}
- private Iterable<FileStatus> getNonSnapshotFiles(SnapshotFileCache cache, Path storeFile)
+ private static boolean contains(Iterable<FileStatus> files, Path filePath) {
+ for (FileStatus status: files) {
+ if (filePath.equals(status.getPath())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static Iterable<FileStatus> getNonSnapshotFiles(SnapshotFileCache cache, Path storeFile)
throws IOException {
return cache.getUnreferencedFiles(
Arrays.asList(FSUtils.listStatus(fs, storeFile.getParent())), null