HBASE-20006 TestRestoreSnapshotFromClientWithRegionReplicas is flakey
Signed-off-by: Ted Yu <yuzhihong@gmail.com> Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
parent
24eb141bac
commit
22e7ae0311
|
@ -157,13 +157,12 @@ public class StoreFileInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Store File Info from an HFileLink
|
* Create a Store File Info from an HFileLink
|
||||||
* @param conf the {@link Configuration} to use
|
* @param conf The {@link Configuration} to use
|
||||||
* @param fs The current file system to use.
|
* @param fs The current file system to use
|
||||||
* @param fileStatus The {@link FileStatus} of the file
|
* @param fileStatus The {@link FileStatus} of the file
|
||||||
*/
|
*/
|
||||||
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
|
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
|
||||||
final HFileLink link)
|
final HFileLink link) {
|
||||||
throws IOException {
|
|
||||||
this.fs = fs;
|
this.fs = fs;
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
// initialPath can be null only if we get a link.
|
// 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
|
* Create a Store File Info from an HFileLink
|
||||||
* @param conf
|
* @param conf The {@link Configuration} to use
|
||||||
* @param fs
|
* @param fs The current file system to use
|
||||||
* @param fileStatus
|
* @param fileStatus The {@link FileStatus} of the file
|
||||||
* @param reference
|
* @param reference The reference instance
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
|
public StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus,
|
||||||
final Reference reference)
|
final Reference reference) {
|
||||||
throws IOException {
|
|
||||||
this.fs = fs;
|
this.fs = fs;
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
this.initialPath = fileStatus.getPath();
|
this.initialPath = fileStatus.getPath();
|
||||||
|
@ -192,6 +189,24 @@ public class StoreFileInfo {
|
||||||
this.link = null;
|
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.
|
* Sets the region coprocessor env.
|
||||||
* @param coprocessorHost
|
* @param coprocessorHost
|
||||||
|
|
|
@ -128,15 +128,28 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// else create a store file link. The link file does not exists on filesystem though.
|
// else create a store file link. The link file does not exists on filesystem though.
|
||||||
HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(),
|
if (HFileLink.isHFileLink(path) || StoreFileInfo.isHFile(path)) {
|
||||||
regionInfoForFs.getEncodedName(), familyName, path.getName());
|
HFileLink link = HFileLink
|
||||||
|
.build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName,
|
||||||
if (StoreFileInfo.isReference(path)) {
|
path.getName());
|
||||||
|
return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
|
||||||
|
} else if (StoreFileInfo.isReference(path)) {
|
||||||
Reference reference = Reference.read(fs, path);
|
Reference reference = Reference.read(fs, path);
|
||||||
|
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);
|
return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
|
throw new IOException("path=" + path + " doesn't look like a valid StoreFile");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,12 +25,10 @@ import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
|
|
||||||
|
|
||||||
@Ignore // Disabled because flakey. See HBASE-20006.
|
|
||||||
@Category({LargeTests.class, ClientTests.class})
|
@Category({LargeTests.class, ClientTests.class})
|
||||||
public class TestRestoreSnapshotFromClientWithRegionReplicas extends
|
public class TestRestoreSnapshotFromClientWithRegionReplicas extends
|
||||||
TestRestoreSnapshotFromClient {
|
TestRestoreSnapshotFromClient {
|
||||||
|
|
|
@ -1578,7 +1578,7 @@ public class TestHRegionReplayEvents {
|
||||||
.addStoreFlushes(StoreFlushDescriptor.newBuilder()
|
.addStoreFlushes(StoreFlushDescriptor.newBuilder()
|
||||||
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
||||||
.setStoreHomeDir("/store_home_dir")
|
.setStoreHomeDir("/store_home_dir")
|
||||||
.addFlushOutput("/foo/baz/bar")
|
.addFlushOutput("/foo/baz/123")
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
@ -1593,8 +1593,8 @@ public class TestHRegionReplayEvents {
|
||||||
.setEncodedRegionName(
|
.setEncodedRegionName(
|
||||||
UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getEncodedNameAsBytes()))
|
UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getEncodedNameAsBytes()))
|
||||||
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
||||||
.addCompactionInput("/foo")
|
.addCompactionInput("/123")
|
||||||
.addCompactionOutput("/bar")
|
.addCompactionOutput("/456")
|
||||||
.setStoreHomeDir("/store_home_dir")
|
.setStoreHomeDir("/store_home_dir")
|
||||||
.setRegionName(UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getRegionName()))
|
.setRegionName(UnsafeByteOperations.unsafeWrap(primaryRegion.getRegionInfo().getRegionName()))
|
||||||
.build()
|
.build()
|
||||||
|
@ -1617,7 +1617,7 @@ public class TestHRegionReplayEvents {
|
||||||
.addStores(StoreDescriptor.newBuilder()
|
.addStores(StoreDescriptor.newBuilder()
|
||||||
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
||||||
.setStoreHomeDir("/store_home_dir")
|
.setStoreHomeDir("/store_home_dir")
|
||||||
.addStoreFile("/foo")
|
.addStoreFile("/123")
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
@ -1634,7 +1634,7 @@ public class TestHRegionReplayEvents {
|
||||||
.addStores(StoreDescriptor.newBuilder()
|
.addStores(StoreDescriptor.newBuilder()
|
||||||
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
.setFamilyName(UnsafeByteOperations.unsafeWrap(families[0]))
|
||||||
.setStoreHomeDir("/store_home_dir")
|
.setStoreHomeDir("/store_home_dir")
|
||||||
.addStoreFile("/foo")
|
.addStoreFile("/123")
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue