Search in sources :

Example 11 with HFileInfo

use of org.apache.hadoop.hbase.io.hfile.HFileInfo in project hbase by apache.

the class TestHalfStoreFileReader method doTestOfScanAndReseek.

private void doTestOfScanAndReseek(Path p, FileSystem fs, Reference bottom, CacheConfig cacheConf) throws IOException {
    ReaderContext context = new ReaderContextBuilder().withFileSystemAndPath(fs, p).build();
    HFileInfo fileInfo = new HFileInfo(context, TEST_UTIL.getConfiguration());
    final HalfStoreFileReader halfreader = new HalfStoreFileReader(context, fileInfo, cacheConf, bottom, new AtomicInteger(0), TEST_UTIL.getConfiguration());
    fileInfo.initMetaAndIndex(halfreader.getHFileReader());
    halfreader.loadFileInfo();
    final HFileScanner scanner = halfreader.getScanner(false, false);
    scanner.seekTo();
    Cell curr;
    do {
        curr = scanner.getCell();
        KeyValue reseekKv = getLastOnCol(curr);
        int ret = scanner.reseekTo(reseekKv);
        assertTrue("reseek to returned: " + ret, ret > 0);
    // System.out.println(curr + ": " + ret);
    } while (scanner.next());
    int ret = scanner.reseekTo(getLastOnCol(curr));
    // System.out.println("Last reseek: " + ret);
    assertTrue(ret > 0);
    halfreader.close(true);
}
Also used : KeyValue(org.apache.hadoop.hbase.KeyValue) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ReaderContext(org.apache.hadoop.hbase.io.hfile.ReaderContext) ReaderContextBuilder(org.apache.hadoop.hbase.io.hfile.ReaderContextBuilder) HFileScanner(org.apache.hadoop.hbase.io.hfile.HFileScanner) Cell(org.apache.hadoop.hbase.Cell) HFileInfo(org.apache.hadoop.hbase.io.hfile.HFileInfo)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)11 HFileInfo (org.apache.hadoop.hbase.io.hfile.HFileInfo)11 ReaderContext (org.apache.hadoop.hbase.io.hfile.ReaderContext)11 ReaderContextBuilder (org.apache.hadoop.hbase.io.hfile.ReaderContextBuilder)11 Path (org.apache.hadoop.fs.Path)8 Test (org.junit.Test)7 KeyValue (org.apache.hadoop.hbase.KeyValue)6 FileSystem (org.apache.hadoop.fs.FileSystem)5 Scan (org.apache.hadoop.hbase.client.Scan)5 HFileContext (org.apache.hadoop.hbase.io.hfile.HFileContext)5 HFileContextBuilder (org.apache.hadoop.hbase.io.hfile.HFileContextBuilder)5 HFileScanner (org.apache.hadoop.hbase.io.hfile.HFileScanner)3 TreeSet (java.util.TreeSet)2 Cell (org.apache.hadoop.hbase.Cell)2 Get (org.apache.hadoop.hbase.client.Get)2 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1