Search in sources :

Example 11 with HFileSystem

use of org.apache.hadoop.hbase.fs.HFileSystem in project hbase by apache.

the class TestHRegionFileSystem method getHRegionFS.

private HRegionFileSystem getHRegionFS(Connection conn, Table table, Configuration conf) throws IOException {
    FileSystem fs = TEST_UTIL.getDFSCluster().getFileSystem();
    Path tableDir = CommonFSUtils.getTableDir(TEST_UTIL.getDefaultRootDirPath(), table.getName());
    List<Path> regionDirs = FSUtils.getRegionDirs(fs, tableDir);
    assertEquals(1, regionDirs.size());
    List<Path> familyDirs = FSUtils.getFamilyDirs(fs, regionDirs.get(0));
    assertEquals(2, familyDirs.size());
    RegionInfo hri = conn.getRegionLocator(table.getName()).getAllRegionLocations().get(0).getRegion();
    HRegionFileSystem regionFs = new HRegionFileSystem(conf, new HFileSystem(fs), tableDir, hri);
    return regionFs;
}
Also used : Path(org.apache.hadoop.fs.Path) FileSystem(org.apache.hadoop.fs.FileSystem) HFileSystem(org.apache.hadoop.hbase.fs.HFileSystem) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) HFileSystem(org.apache.hadoop.hbase.fs.HFileSystem)

Aggregations

HFileSystem (org.apache.hadoop.hbase.fs.HFileSystem)11 Path (org.apache.hadoop.fs.Path)10 FileSystem (org.apache.hadoop.fs.FileSystem)7 Configuration (org.apache.hadoop.conf.Configuration)3 HFileContext (org.apache.hadoop.hbase.io.hfile.HFileContext)3 HFileContextBuilder (org.apache.hadoop.hbase.io.hfile.HFileContextBuilder)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 ColumnFamilyDescriptorBuilder (org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder)2 CacheConfig (org.apache.hadoop.hbase.io.hfile.CacheConfig)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 DataInputStream (java.io.DataInputStream)1 DataOutputStream (java.io.DataOutputStream)1 InetSocketAddress (java.net.InetSocketAddress)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)1 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 FilterFileSystem (org.apache.hadoop.fs.FilterFileSystem)1