HBASE-7418 HFileLink flaky test (Matteo Bertozzi)
git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290@1445803 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
98cc234a18
commit
4005c5f48c
|
@ -56,9 +56,7 @@ public class TestHFileLinkCleaner {
|
||||||
public void testHFileLinkCleaning() throws Exception {
|
public void testHFileLinkCleaning() throws Exception {
|
||||||
Configuration conf = TEST_UTIL.getConfiguration();
|
Configuration conf = TEST_UTIL.getConfiguration();
|
||||||
conf.set(HConstants.HBASE_DIR, TEST_UTIL.getDataTestDir().toString());
|
conf.set(HConstants.HBASE_DIR, TEST_UTIL.getDataTestDir().toString());
|
||||||
conf.set(HFileCleaner.MASTER_HFILE_CLEANER_PLUGINS,
|
conf.set(HFileCleaner.MASTER_HFILE_CLEANER_PLUGINS, HFileLinkCleaner.class.getName());
|
||||||
"org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner," +
|
|
||||||
"org.apache.hadoop.hbase.master.cleaner.HFileLinkCleaner");
|
|
||||||
Path rootDir = FSUtils.getRootDir(conf);
|
Path rootDir = FSUtils.getRootDir(conf);
|
||||||
FileSystem fs = FileSystem.get(conf);
|
FileSystem fs = FileSystem.get(conf);
|
||||||
|
|
||||||
|
@ -100,14 +98,12 @@ public class TestHFileLinkCleaner {
|
||||||
HFileCleaner cleaner = new HFileCleaner(1000, server, conf, fs, archiveDir);
|
HFileCleaner cleaner = new HFileCleaner(1000, server, conf, fs, archiveDir);
|
||||||
|
|
||||||
// Link backref cannot be removed
|
// Link backref cannot be removed
|
||||||
Thread.sleep(ttl * 2);
|
|
||||||
cleaner.chore();
|
cleaner.chore();
|
||||||
assertTrue(fs.exists(linkBackRef));
|
assertTrue(fs.exists(linkBackRef));
|
||||||
assertTrue(fs.exists(hfilePath));
|
assertTrue(fs.exists(hfilePath));
|
||||||
|
|
||||||
// Link backref can be removed
|
// Link backref can be removed
|
||||||
fs.rename(new Path(rootDir, tableLinkName), new Path(archiveDir, tableLinkName));
|
fs.rename(new Path(rootDir, tableLinkName), new Path(archiveDir, tableLinkName));
|
||||||
Thread.sleep(ttl * 2);
|
|
||||||
cleaner.chore();
|
cleaner.chore();
|
||||||
assertFalse("Link should be deleted", fs.exists(linkBackRef));
|
assertFalse("Link should be deleted", fs.exists(linkBackRef));
|
||||||
|
|
||||||
|
|
|
@ -171,12 +171,16 @@ public class TestStoreFile extends HBaseTestCase {
|
||||||
|
|
||||||
public void testHFileLink() throws IOException {
|
public void testHFileLink() throws IOException {
|
||||||
final String columnFamily = "f";
|
final String columnFamily = "f";
|
||||||
|
|
||||||
|
Configuration testConf = new Configuration(this.conf);
|
||||||
|
FSUtils.setRootDir(testConf, this.testDir);
|
||||||
|
|
||||||
HRegionInfo hri = new HRegionInfo(Bytes.toBytes("table-link"));
|
HRegionInfo hri = new HRegionInfo(Bytes.toBytes("table-link"));
|
||||||
Path storedir = new Path(new Path(FSUtils.getRootDir(conf),
|
Path storedir = new Path(new Path(this.testDir,
|
||||||
new Path(hri.getTableNameAsString(), hri.getEncodedName())), columnFamily);
|
new Path(hri.getTableNameAsString(), hri.getEncodedName())), columnFamily);
|
||||||
|
|
||||||
// Make a store file and write data to it.
|
// Make a store file and write data to it.
|
||||||
StoreFile.Writer writer = new StoreFile.WriterBuilder(conf, cacheConf,
|
StoreFile.Writer writer = new StoreFile.WriterBuilder(testConf, cacheConf,
|
||||||
this.fs, 8 * 1024)
|
this.fs, 8 * 1024)
|
||||||
.withOutputDir(storedir)
|
.withOutputDir(storedir)
|
||||||
.build();
|
.build();
|
||||||
|
@ -184,13 +188,13 @@ public class TestStoreFile extends HBaseTestCase {
|
||||||
writeStoreFile(writer);
|
writeStoreFile(writer);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
Path dstPath = new Path(FSUtils.getRootDir(conf), new Path("test-region", columnFamily));
|
Path dstPath = new Path(this.testDir, new Path("test-region", columnFamily));
|
||||||
HFileLink.create(conf, this.fs, dstPath, hri, storeFilePath.getName());
|
HFileLink.create(testConf, this.fs, dstPath, hri, storeFilePath.getName());
|
||||||
Path linkFilePath = new Path(dstPath,
|
Path linkFilePath = new Path(dstPath,
|
||||||
HFileLink.createHFileLinkName(hri, storeFilePath.getName()));
|
HFileLink.createHFileLinkName(hri, storeFilePath.getName()));
|
||||||
|
|
||||||
// Try to open store file from link
|
// Try to open store file from link
|
||||||
StoreFile hsf = new StoreFile(this.fs, linkFilePath, conf, cacheConf,
|
StoreFile hsf = new StoreFile(this.fs, linkFilePath, testConf, cacheConf,
|
||||||
StoreFile.BloomType.NONE, NoOpDataBlockEncoder.INSTANCE);
|
StoreFile.BloomType.NONE, NoOpDataBlockEncoder.INSTANCE);
|
||||||
assertTrue(hsf.isLink());
|
assertTrue(hsf.isLink());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue