Package org.apache.accumulo.core.file.rfile.BlockIndex

Examples of org.apache.accumulo.core.file.rfile.BlockIndex.BlockIndexEntry


    BlockIndexEntry[] indexEntries = blockIndex.getIndexEntries();
   
    for (int i = 0; i < indexEntries.length; i++) {
      int row = Integer.parseInt(indexEntries[i].getPrevKey().getRowData().toString());
     
      BlockIndexEntry bie;
     

      bie = blockIndex.seekBlock(new Key(RFileTest.nf("", row), "cf1", "cq1"), cacheBlock);
      if (i == 0)
        Assert.assertSame(null, bie);
      else
        Assert.assertSame(indexEntries[i - 1], bie);
     
      Assert.assertSame(bie, blockIndex.seekBlock(new Key(RFileTest.nf("", row - 1), "cf1", "cq1"), cacheBlock));

      bie = blockIndex.seekBlock(new Key(RFileTest.nf("", row + 1), "cf1", "cq1"), cacheBlock);
      Assert.assertSame(indexEntries[i], bie);

      RelativeKey rk = new RelativeKey();
      rk.setPrevKey(bie.getPrevKey());
      rk.readFields(cacheBlock);
     
      Assert.assertEquals(rk.getKey(), new Key(RFileTest.nf("", row + 1), "cf1", "cq1"));

    }
View Full Code Here


    Assert.assertSame(null, blockIndex.seekBlock(new Key(RFileTest.nf("", 0), "cf1", "cq1"), cacheBlock));
    Assert.assertSame(null, blockIndex.seekBlock(new Key(RFileTest.nf("", 1), "cf1", "cq1"), cacheBlock));
   
    for (int i = 2; i < 6; i++) {
      Key seekKey = new Key(RFileTest.nf("", i), "cf1", "cq1");
      BlockIndexEntry bie = blockIndex.seekBlock(seekKey, cacheBlock);
     
      Assert.assertTrue(bie.getPrevKey().compareTo(seekKey) < 0);

      RelativeKey rk = new RelativeKey();
      rk.setPrevKey(bie.getPrevKey());
      rk.readFields(cacheBlock);
     
      Assert.assertTrue(rk.getKey().compareTo(seekKey) <= 0);
    }
    cacheBlock.close();
View Full Code Here

          Key currKey = null;

          if (currBlock.isIndexable()) {
            BlockIndex blockIndex = BlockIndex.getIndex(currBlock, indexEntry);
            if (blockIndex != null) {
              BlockIndexEntry bie = blockIndex.seekBlock(startKey, currBlock);
              if (bie != null) {
                // we are seeked to the current position of the key in the index
                // need to prime the read process and read this key from the block
                RelativeKey tmpRk = new RelativeKey();
                tmpRk.setPrevKey(bie.getPrevKey());
                tmpRk.readFields(currBlock);
                val = new Value();

                val.readFields(currBlock);
                valbs = new MByteSequence(val.get(), 0, val.getSize());
               
                // just consumed one key from the input stream, so subtract one from entries left
                entriesLeft = bie.getEntriesLeft() - 1;
                prevKey = new Key(bie.getPrevKey());
                currKey = tmpRk.getKey();
              }
            }
          }
View Full Code Here

    BlockIndexEntry[] indexEntries = blockIndex.getIndexEntries();
   
    for (int i = 0; i < indexEntries.length; i++) {
      int row = Integer.parseInt(indexEntries[i].getPrevKey().getRowData().toString());
     
      BlockIndexEntry bie;
     

      bie = blockIndex.seekBlock(new Key(RFileTest.nf("", row), "cf1", "cq1"), cacheBlock);
      if (i == 0)
        Assert.assertSame(null, bie);
      else
        Assert.assertSame(indexEntries[i - 1], bie);
     
      Assert.assertSame(bie, blockIndex.seekBlock(new Key(RFileTest.nf("", row - 1), "cf1", "cq1"), cacheBlock));

      bie = blockIndex.seekBlock(new Key(RFileTest.nf("", row + 1), "cf1", "cq1"), cacheBlock);
      Assert.assertSame(indexEntries[i], bie);

      RelativeKey rk = new RelativeKey();
      rk.setPrevKey(bie.getPrevKey());
      rk.readFields(cacheBlock);
     
      Assert.assertEquals(rk.getKey(), new Key(RFileTest.nf("", row + 1), "cf1", "cq1"));

    }
View Full Code Here

    Assert.assertSame(null, blockIndex.seekBlock(new Key(RFileTest.nf("", 0), "cf1", "cq1"), cacheBlock));
    Assert.assertSame(null, blockIndex.seekBlock(new Key(RFileTest.nf("", 1), "cf1", "cq1"), cacheBlock));
   
    for (int i = 2; i < 6; i++) {
      Key seekKey = new Key(RFileTest.nf("", i), "cf1", "cq1");
      BlockIndexEntry bie = blockIndex.seekBlock(seekKey, cacheBlock);
     
      Assert.assertTrue(bie.getPrevKey().compareTo(seekKey) < 0);

      RelativeKey rk = new RelativeKey();
      rk.setPrevKey(bie.getPrevKey());
      rk.readFields(cacheBlock);
     
      Assert.assertTrue(rk.getKey().compareTo(seekKey) <= 0);
    }
View Full Code Here

          Key currKey = null;

          if (currBlock.isIndexable()) {
            BlockIndex blockIndex = BlockIndex.getIndex(currBlock, indexEntry);
            if (blockIndex != null) {
              BlockIndexEntry bie = blockIndex.seekBlock(startKey, currBlock);
              if (bie != null) {
                // we are seeked to the current position of the key in the index
                // need to prime the read process and read this key from the block
                RelativeKey tmpRk = new RelativeKey();
                tmpRk.setPrevKey(bie.getPrevKey());
                tmpRk.readFields(currBlock);
                val = new Value();

                val.readFields(currBlock);
                valbs = new MutableByteSequence(val.get(), 0, val.getSize());
               
                // just consumed one key from the input stream, so subtract one from entries left
                entriesLeft = bie.getEntriesLeft() - 1;
                prevKey = new Key(bie.getPrevKey());
                currKey = tmpRk.getKey();
              }
            }
          }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.file.rfile.BlockIndex.BlockIndexEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.