use of org.apache.hadoop.hbase.util.FSTableDescriptors in project hbase by apache.
the class TestReadAndWriteRegionInfoFile method testReadAndWriteRegionInfoFile.
@Test
public void testReadAndWriteRegionInfoFile() throws IOException, InterruptedException {
RegionInfo ri = RegionInfoBuilder.FIRST_META_REGIONINFO;
// Create a region. That'll write the .regioninfo file.
FSTableDescriptors fsTableDescriptors = new FSTableDescriptors(FS, ROOT_DIR);
FSTableDescriptors.tryUpdateAndGetMetaTableDescriptor(CONF, FS, ROOT_DIR);
HRegion r = HBaseTestingUtil.createRegionAndWAL(ri, ROOT_DIR, CONF, fsTableDescriptors.get(TableName.META_TABLE_NAME));
// Get modtime on the file.
long modtime = getModTime(r);
HBaseTestingUtil.closeRegionAndWAL(r);
Thread.sleep(1001);
r = HRegion.openHRegion(ROOT_DIR, ri, fsTableDescriptors.get(TableName.META_TABLE_NAME), null, CONF);
// Ensure the file is not written for a second time.
long modtime2 = getModTime(r);
assertEquals(modtime, modtime2);
// Now load the file.
HRegionFileSystem.loadRegionInfoFileContent(r.getRegionFileSystem().getFileSystem(), r.getRegionFileSystem().getRegionDir());
HBaseTestingUtil.closeRegionAndWAL(r);
}
Aggregations