You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2018/04/20 16:50:42 UTC
[1/3] hbase git commit: HBASE-20006
TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Repository: hbase
Updated Branches:
refs/heads/branch-1 03eb3d24b -> 8a244e51d
refs/heads/branch-2 24eb141ba -> 22e7ae031
refs/heads/master 914de1141 -> 4e183748c
HBASE-20006 TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Signed-off-by: Ted Yu <yu...@gmail.com>
Signed-off-by: Sean Busbey <bu...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4e183748
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4e183748
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4e183748
Branch: refs/heads/master
Commit: 4e183748c7900da905fb3549634df614b471b3cb
Parents: 914de11
Author: Toshihiro Suzuki <br...@gmail.com>
Authored: Sun Mar 4 14:30:07 2018 +0900
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Apr 20 10:51:11 2018 -0500
----------------------------------------------------------------------
.../hbase/regionserver/StoreFileInfo.java | 37 ++++++++++++++------
.../hbase/util/ServerRegionReplicaUtil.java | 27 ++++++++++----
...oreSnapshotFromClientWithRegionReplicas.java | 2 --
.../regionserver/TestHRegionReplayEvents.java | 10 +++---
4 files changed, 51 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e183748/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
index e7419d5..c9f5f8d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
@@ -157,13 +157,12 @@ public class StoreFileInfo {
/**
* Create a Store File Info from an HFileLink
- * @param conf the {@link Configuration} to use
- * @param fs The current file system to use.
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
* @param fileStatus The {@link FileStatus} of the file
*/
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
- final HFileLink link)
- throws IOException {
+ final HFileLink link) {
this.fs = fs;
this.conf = conf;
// initialPath can be null only if we get a link.
@@ -175,15 +174,13 @@ public class StoreFileInfo {
/**
* Create a Store File Info from an HFileLink
- * @param conf
- * @param fs
- * @param fileStatus
- * @param reference
- * @throws IOException
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
+ * @param fileStatus The {@link FileStatus} of the file
+ * @param reference The reference instance
*/
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
- final Reference reference)
- throws IOException {
+ final Reference reference) {
this.fs = fs;
this.conf = conf;
this.initialPath = fileStatus.getPath();
@@ -193,6 +190,24 @@ public class StoreFileInfo {
}
/**
+ * Create a Store File Info from an HFileLink and a Reference
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
+ * @param fileStatus The {@link FileStatus} of the file
+ * @param reference The reference instance
+ * @param link The link instance
+ */
+ public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
+ final Reference reference, final HFileLink link) {
+ this.fs = fs;
+ this.conf = conf;
+ this.initialPath = fileStatus.getPath();
+ this.createdTimestamp = fileStatus.getModificationTime();
+ this.reference = reference;
+ this.link = link;
+ }
+
+ /**
* Sets the region coprocessor env.
* @param coprocessorHost
*/
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e183748/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
index 769d480..0609733 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
@@ -128,15 +128,28 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil {
}
// else create a store file link. The link file does not exists on filesystem though.
- HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(),
- regionInfoForFs.getEncodedName(), familyName, path.getName());
-
- if (StoreFileInfo.isReference(path)) {
+ if (HFileLink.isHFileLink(path) || StoreFileInfo.isHFile(path)) {
+ HFileLink link = HFileLink
+ .build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
+ path.getName());
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
+ } else if (StoreFileInfo.isReference(path)) {
Reference reference = Reference.read(fs, path);
- return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
+ Path referencePath = StoreFileInfo.getReferredToFile(path);
+ if (HFileLink.isHFileLink(referencePath)) {
+ // HFileLink Reference
+ HFileLink link = HFileLink.buildFromHFileLinkPattern(conf, referencePath);
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference, link);
+ } else {
+ // Reference
+ HFileLink link = HFileLink
+ .build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
+ path.getName());
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
+ }
+ } else {
+ throw new IOException("path=" + path + " doesn't look like a valid StoreFile");
}
-
- return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
}
/**
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e183748/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
index 839542a..d301098 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
@@ -25,12 +25,10 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.junit.ClassRule;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-@Ignore // Disabled because flakey. See HBASE-20006.
@Category({LargeTests.class, ClientTests.class})
public class TestRestoreSnapshotFromClientWithRegionReplicas extends
TestRestoreSnapshotFromClient {
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e183748/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
index 6e39afd..d06c1af 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
@@ -1578,7 +1578,7 @@ public class TestHRegionReplayEvents {
.addStoreFlushes(StoreFlushDescriptor.newBuilder()
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addFlushOutput("/foo/baz/bar")
+ .addFlushOutput("/foo/baz/123")
.build())
.build());
}
@@ -1593,8 +1593,8 @@ public class TestHRegionReplayEvents {
.setEncodedRegionName(
UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getEncodedNameAsBytes()))
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
- .addCompactionInput("/foo")
- .addCompactionOutput("/bar")
+ .addCompactionInput("/123")
+ .addCompactionOutput("/456")
.setStoreHomeDir("/store_home_dir")
.setRegionName(UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getRegionName()))
.build()
@@ -1617,7 +1617,7 @@ public class TestHRegionReplayEvents {
.addStores(StoreDescriptor.newBuilder()
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addStoreFile("/foo")
+ .addStoreFile("/123")
.build())
.build());
}
@@ -1634,7 +1634,7 @@ public class TestHRegionReplayEvents {
.addStores(StoreDescriptor.newBuilder()
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addStoreFile("/foo")
+ .addStoreFile("/123")
.build())
.build());
}
[3/3] hbase git commit: HBASE-20006
TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Posted by bu...@apache.org.
HBASE-20006 TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Signed-off-by: Ted Yu <yu...@gmail.com>
Signed-off-by: Sean Busbey <bu...@apache.org>
Conflicts:
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8a244e51
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8a244e51
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8a244e51
Branch: refs/heads/branch-1
Commit: 8a244e51d7c9e54c81c21930046d1758f306dfa0
Parents: 03eb3d2
Author: Toshihiro Suzuki <br...@gmail.com>
Authored: Sun Mar 4 14:30:07 2018 +0900
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Apr 20 11:34:45 2018 -0500
----------------------------------------------------------------------
.../hbase/regionserver/StoreFileInfo.java | 37 ++++++++++++++------
.../hbase/util/ServerRegionReplicaUtil.java | 27 ++++++++++----
.../regionserver/TestHRegionReplayEvents.java | 10 +++---
3 files changed, 51 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/8a244e51/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
index 12da6b7..76551e2 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
@@ -145,13 +145,12 @@ public class StoreFileInfo {
/**
* Create a Store File Info from an HFileLink
- * @param conf the {@link Configuration} to use
- * @param fs The current file system to use.
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
* @param fileStatus The {@link FileStatus} of the file
*/
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
- final HFileLink link)
- throws IOException {
+ final HFileLink link) {
this.fs = fs;
this.conf = conf;
// initialPath can be null only if we get a link.
@@ -163,15 +162,13 @@ public class StoreFileInfo {
/**
* Create a Store File Info from an HFileLink
- * @param conf
- * @param fs
- * @param fileStatus
- * @param reference
- * @throws IOException
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
+ * @param fileStatus The {@link FileStatus} of the file
+ * @param reference The reference instance
*/
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
- final Reference reference)
- throws IOException {
+ final Reference reference) {
this.fs = fs;
this.conf = conf;
this.initialPath = fileStatus.getPath();
@@ -181,6 +178,24 @@ public class StoreFileInfo {
}
/**
+ * Create a Store File Info from an HFileLink and a Reference
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
+ * @param fileStatus The {@link FileStatus} of the file
+ * @param reference The reference instance
+ * @param link The link instance
+ */
+ public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
+ final Reference reference, final HFileLink link) {
+ this.fs = fs;
+ this.conf = conf;
+ this.initialPath = fileStatus.getPath();
+ this.createdTimestamp = fileStatus.getModificationTime();
+ this.reference = reference;
+ this.link = link;
+ }
+
+ /**
* Sets the region coprocessor env.
* @param coprocessorHost
*/
http://git-wip-us.apache.org/repos/asf/hbase/blob/8a244e51/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
index 2ba1b47..2f21712 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
@@ -124,15 +124,28 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil {
}
// else create a store file link. The link file does not exists on filesystem though.
- HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(),
- regionInfoForFs.getEncodedName(), familyName, path.getName());
-
- if (StoreFileInfo.isReference(path)) {
+ if (HFileLink.isHFileLink(path) || StoreFileInfo.isHFile(path)) {
+ HFileLink link = HFileLink
+ .build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
+ path.getName());
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
+ } else if (StoreFileInfo.isReference(path)) {
Reference reference = Reference.read(fs, path);
- return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
+ Path referencePath = StoreFileInfo.getReferredToFile(path);
+ if (HFileLink.isHFileLink(referencePath)) {
+ // HFileLink Reference
+ HFileLink link = HFileLink.buildFromHFileLinkPattern(conf, referencePath);
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference, link);
+ } else {
+ // Reference
+ HFileLink link = HFileLink
+ .build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
+ path.getName());
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
+ }
+ } else {
+ throw new IOException("path=" + path + " doesn't look like a valid StoreFile");
}
-
- return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
}
/**
http://git-wip-us.apache.org/repos/asf/hbase/blob/8a244e51/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
index 3a8b557..397387a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
@@ -1538,7 +1538,7 @@ public class TestHRegionReplayEvents {
.addStoreFlushes(StoreFlushDescriptor.newBuilder()
.setFamilyName(ByteString.copyFrom(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addFlushOutput("/foo/baz/bar")
+ .addFlushOutput("/foo/baz/123")
.build())
.build());
}
@@ -1552,8 +1552,8 @@ public class TestHRegionReplayEvents {
.setEncodedRegionName(
ByteString.copyFrom(primaryRegion.getRegionInfo().getEncodedNameAsBytes()))
.setFamilyName(ByteString.copyFrom(families[0]))
- .addCompactionInput("/foo")
- .addCompactionOutput("/bar")
+ .addCompactionInput("/123")
+ .addCompactionOutput("/456")
.setStoreHomeDir("/store_home_dir")
.setRegionName(ByteString.copyFrom(primaryRegion.getRegionInfo().getRegionName()))
.build()
@@ -1575,7 +1575,7 @@ public class TestHRegionReplayEvents {
.addStores(StoreDescriptor.newBuilder()
.setFamilyName(ByteString.copyFrom(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addStoreFile("/foo")
+ .addStoreFile("/123")
.build())
.build());
}
@@ -1592,7 +1592,7 @@ public class TestHRegionReplayEvents {
.addStores(StoreDescriptor.newBuilder()
.setFamilyName(ByteString.copyFrom(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addStoreFile("/foo")
+ .addStoreFile("/123")
.build())
.build());
}
[2/3] hbase git commit: HBASE-20006
TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Posted by bu...@apache.org.
HBASE-20006 TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Signed-off-by: Ted Yu <yu...@gmail.com>
Signed-off-by: Sean Busbey <bu...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/22e7ae03
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/22e7ae03
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/22e7ae03
Branch: refs/heads/branch-2
Commit: 22e7ae0311efe8285b29faa3d819ab0fd5920ce4
Parents: 24eb141
Author: Toshihiro Suzuki <br...@gmail.com>
Authored: Sun Mar 4 14:30:07 2018 +0900
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Apr 20 11:22:49 2018 -0500
----------------------------------------------------------------------
.../hbase/regionserver/StoreFileInfo.java | 37 ++++++++++++++------
.../hbase/util/ServerRegionReplicaUtil.java | 27 ++++++++++----
...oreSnapshotFromClientWithRegionReplicas.java | 2 --
.../regionserver/TestHRegionReplayEvents.java | 10 +++---
4 files changed, 51 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/22e7ae03/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
index a1fe2d1..779ca44 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
@@ -157,13 +157,12 @@ public class StoreFileInfo {
/**
* Create a Store File Info from an HFileLink
- * @param conf the {@link Configuration} to use
- * @param fs The current file system to use.
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
* @param fileStatus The {@link FileStatus} of the file
*/
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
- final HFileLink link)
- throws IOException {
+ final HFileLink link) {
this.fs = fs;
this.conf = conf;
// initialPath can be null only if we get a link.
@@ -175,15 +174,13 @@ public class StoreFileInfo {
/**
* Create a Store File Info from an HFileLink
- * @param conf
- * @param fs
- * @param fileStatus
- * @param reference
- * @throws IOException
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
+ * @param fileStatus The {@link FileStatus} of the file
+ * @param reference The reference instance
*/
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
- final Reference reference)
- throws IOException {
+ final Reference reference) {
this.fs = fs;
this.conf = conf;
this.initialPath = fileStatus.getPath();
@@ -193,6 +190,24 @@ public class StoreFileInfo {
}
/**
+ * Create a Store File Info from an HFileLink and a Reference
+ * @param conf The {@link Configuration} to use
+ * @param fs The current file system to use
+ * @param fileStatus The {@link FileStatus} of the file
+ * @param reference The reference instance
+ * @param link The link instance
+ */
+ public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
+ final Reference reference, final HFileLink link) {
+ this.fs = fs;
+ this.conf = conf;
+ this.initialPath = fileStatus.getPath();
+ this.createdTimestamp = fileStatus.getModificationTime();
+ this.reference = reference;
+ this.link = link;
+ }
+
+ /**
* Sets the region coprocessor env.
* @param coprocessorHost
*/
http://git-wip-us.apache.org/repos/asf/hbase/blob/22e7ae03/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
index 769d480..0609733 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
@@ -128,15 +128,28 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil {
}
// else create a store file link. The link file does not exists on filesystem though.
- HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(),
- regionInfoForFs.getEncodedName(), familyName, path.getName());
-
- if (StoreFileInfo.isReference(path)) {
+ if (HFileLink.isHFileLink(path) || StoreFileInfo.isHFile(path)) {
+ HFileLink link = HFileLink
+ .build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
+ path.getName());
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
+ } else if (StoreFileInfo.isReference(path)) {
Reference reference = Reference.read(fs, path);
- return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
+ Path referencePath = StoreFileInfo.getReferredToFile(path);
+ if (HFileLink.isHFileLink(referencePath)) {
+ // HFileLink Reference
+ HFileLink link = HFileLink.buildFromHFileLinkPattern(conf, referencePath);
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference, link);
+ } else {
+ // Reference
+ HFileLink link = HFileLink
+ .build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
+ path.getName());
+ return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
+ }
+ } else {
+ throw new IOException("path=" + path + " doesn't look like a valid StoreFile");
}
-
- return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
}
/**
http://git-wip-us.apache.org/repos/asf/hbase/blob/22e7ae03/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
index 839542a..d301098 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClientWithRegionReplicas.java
@@ -25,12 +25,10 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.junit.ClassRule;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-@Ignore // Disabled because flakey. See HBASE-20006.
@Category({LargeTests.class, ClientTests.class})
public class TestRestoreSnapshotFromClientWithRegionReplicas extends
TestRestoreSnapshotFromClient {
http://git-wip-us.apache.org/repos/asf/hbase/blob/22e7ae03/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
index d66feee..dd2f4a4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
@@ -1578,7 +1578,7 @@ public class TestHRegionReplayEvents {
.addStoreFlushes(StoreFlushDescriptor.newBuilder()
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addFlushOutput("/foo/baz/bar")
+ .addFlushOutput("/foo/baz/123")
.build())
.build());
}
@@ -1593,8 +1593,8 @@ public class TestHRegionReplayEvents {
.setEncodedRegionName(
UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getEncodedNameAsBytes()))
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
- .addCompactionInput("/foo")
- .addCompactionOutput("/bar")
+ .addCompactionInput("/123")
+ .addCompactionOutput("/456")
.setStoreHomeDir("/store_home_dir")
.setRegionName(UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getRegionName()))
.build()
@@ -1617,7 +1617,7 @@ public class TestHRegionReplayEvents {
.addStores(StoreDescriptor.newBuilder()
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addStoreFile("/foo")
+ .addStoreFile("/123")
.build())
.build());
}
@@ -1634,7 +1634,7 @@ public class TestHRegionReplayEvents {
.addStores(StoreDescriptor.newBuilder()
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
.setStoreHomeDir("/store_home_dir")
- .addStoreFile("/foo")
+ .addStoreFile("/123")
.build())
.build());
}