HBASE-20006 TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Signed-off-by: Ted Yu <yuzhihong@gmail.com> Signed-off-by: Sean Busbey <busbey@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
This commit is contained in:
parent
03eb3d24b6
commit
8a244e51d7
|
@ -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();
|
||||
|
@ -180,6 +177,24 @@ public class StoreFileInfo {
|
|||
this.link = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue