Examples of PrefixTreeBlockMeta


Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

public class TestBlockMeta {

  static int BLOCK_START = 123;

  private static PrefixTreeBlockMeta createSample() {
    PrefixTreeBlockMeta m = new PrefixTreeBlockMeta();
    m.setNumMetaBytes(0);
    m.setNumKeyValueBytes(3195);

    m.setNumRowBytes(0);
    m.setNumFamilyBytes(3);
    m.setNumQualifierBytes(12345);
    m.setNumTimestampBytes(23456);
    m.setNumMvccVersionBytes(5);
    m.setNumValueBytes(34567);

    m.setNextNodeOffsetWidth(3);
    m.setFamilyOffsetWidth(1);
    m.setQualifierOffsetWidth(2);
    m.setTimestampIndexWidth(1);
    m.setMvccVersionIndexWidth(2);
    m.setValueOffsetWidth(8);
    m.setValueLengthWidth(3);

    m.setRowTreeDepth(11);
    m.setMaxRowLength(200);
    m.setMaxQualifierLength(50);

    m.setMinTimestamp(1318966363481L);
    m.setTimestampDeltaWidth(3);
    m.setMinMvccVersion(100L);
    m.setMvccVersionDeltaWidth(4);

    m.setAllSameType(false);
    m.setAllTypes(KeyValue.Type.Delete.getCode());

    m.setNumUniqueRows(88);
    m.setNumUniqueFamilies(1);
    m.setNumUniqueQualifiers(56);
    return m;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

  /**************************** helper ******************************/

  public static PrefixTreeArraySearcher ensureArraySearcherValid(ByteBuffer buffer,
      PrefixTreeArraySearcher searcher, boolean includeMvccVersion) {
    if (searcher == null) {
      PrefixTreeBlockMeta blockMeta = new PrefixTreeBlockMeta(buffer);
      searcher = new PrefixTreeArraySearcher(blockMeta, blockMeta.getRowTreeDepth(),
          blockMeta.getMaxRowLength(), blockMeta.getMaxQualifierLength());
      searcher.initOnBlock(blockMeta, buffer.array(), includeMvccVersion);
      return searcher;
    }

    PrefixTreeBlockMeta blockMeta = searcher.getBlockMeta();
    blockMeta.initOnBlock(buffer);
    if (!searcher.areBuffersBigEnough()) {
      int maxRowTreeStackNodes = Math.max(blockMeta.getRowTreeDepth(),
        searcher.getMaxRowTreeStackNodes());
      int rowBufferLength = Math.max(blockMeta.getMaxRowLength(), searcher.getRowBufferLength());
      int qualifierBufferLength = Math.max(blockMeta.getMaxQualifierLength(),
        searcher.getQualifierBufferLength());
      searcher = new PrefixTreeArraySearcher(blockMeta, maxRowTreeStackNodes, rowBufferLength,
          qualifierBufferLength);
    }
    //this is where we parse the BlockMeta
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

  /***************** construct ***********************/

  public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
    // used during cell accumulation
    this.blockMeta = new PrefixTreeBlockMeta();
    this.rowRange = new SimpleByteRange();
    this.familyRange = new SimpleByteRange();
    this.qualifierRange = new SimpleByteRange();
    this.timestamps = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.mvccVersions = new long[INITIAL_PER_CELL_ARRAY_SIZES];
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

    List<ByteRange> inputs = columns.getInputs();
    this.columnSorter = new ByteRangeTreeSet(inputs);
    this.sortedUniqueColumns = columnSorter.compile().getSortedRanges();
    List<byte[]> copies = ByteRangeUtils.copyToNewArrays(sortedUniqueColumns);
    Assert.assertTrue(Bytes.isSorted(copies));
    this.blockMeta = new PrefixTreeBlockMeta();
    this.blockMeta.setNumMetaBytes(0);
    this.blockMeta.setNumRowBytes(0);
    this.builder = new Tokenizer();
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

    return m;
  }

  @Test
  public void testStreamSerialization() throws IOException {
    PrefixTreeBlockMeta original = createSample();
    ByteArrayOutputStream os = new ByteArrayOutputStream(10000);
    original.writeVariableBytesToOutputStream(os);
    ByteBuffer buffer = ByteBuffer.wrap(os.toByteArray());
    PrefixTreeBlockMeta roundTripped = new PrefixTreeBlockMeta(buffer);
    Assert.assertTrue(original.equals(roundTripped));
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

    blockMetaWriter = encoder.getBlockMeta();
    outputBytes = os.toByteArray();

    // start reading, but save the assertions for @Test methods
    buffer = ByteBuffer.wrap(outputBytes);
    blockMetaReader = new PrefixTreeBlockMeta(buffer);

    searcher = new PrefixTreeArraySearcher(blockMetaReader, blockMetaReader.getRowTreeDepth(),
        blockMetaReader.getMaxRowLength(), blockMetaReader.getMaxQualifierLength());
    searcher.initOnBlock(blockMetaReader, outputBytes, includeMemstoreTS);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

    List<ByteRange> inputs = columns.getInputs();
    this.columnSorter = new ByteRangeTreeSet(inputs);
    this.sortedUniqueColumns = columnSorter.compile().getSortedRanges();
    List<byte[]> copies = ByteRangeTool.copyToNewArrays(sortedUniqueColumns);
    Assert.assertTrue(Bytes.isSorted(copies));
    this.blockMeta = new PrefixTreeBlockMeta();
    this.blockMeta.setNumMetaBytes(0);
    this.blockMeta.setNumRowBytes(0);
    this.builder = new Tokenizer();
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

  /***************** construct ***********************/

  public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
    // used during cell accumulation
    this.blockMeta = new PrefixTreeBlockMeta();
    this.rowRange = new ByteRange();
    this.familyRange = new ByteRange();
    this.qualifierRange = new ByteRange();
    this.timestamps = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.mvccVersions = new long[INITIAL_PER_CELL_ARRAY_SIZES];
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

  /***************** construct ***********************/

  public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
    // used during cell accumulation
    this.blockMeta = new PrefixTreeBlockMeta();
    this.rowRange = new SimpleMutableByteRange();
    this.familyRange = new SimpleMutableByteRange();
    this.qualifierRange = new SimpleMutableByteRange();
    this.timestamps = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.mvccVersions = new long[INITIAL_PER_CELL_ARRAY_SIZES];
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta

    return m;
  }

  @Test
  public void testStreamSerialization() throws IOException {
    PrefixTreeBlockMeta original = createSample();
    ByteArrayOutputStream os = new ByteArrayOutputStream(10000);
    original.writeVariableBytesToOutputStream(os);
    ByteBuffer buffer = ByteBuffer.wrap(os.toByteArray());
    PrefixTreeBlockMeta roundTripped = new PrefixTreeBlockMeta(buffer);
    Assert.assertTrue(original.equals(roundTripped));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.