index = new HFileBlockIndex.ByteArrayKeyBlockIndexReader(1); } else { index = new HFileBlockIndex.CellBasedKeyBlockIndexReader(comparator, 1);
/** * @return the first key in the file. May be null if file has no entries. Note * that this is not the first row key, but rather the byte form of the * first KeyValue. */ @Override public Optional<Cell> getFirstKey() { if (dataBlockIndexReader == null) { throw new BlockIndexNotLoadedException(); } return dataBlockIndexReader.isEmpty() ? Optional.empty() : Optional.of(dataBlockIndexReader.getRootBlockKey(0)); }
/** * @return Midkey for this file. We work with block boundaries only so * returned midkey is an approximation only. * @throws IOException */ @Override public Optional<Cell> midKey() throws IOException { return Optional.ofNullable(dataBlockIndexReader.midkey()); }
new HFileBlockIndex.CellBasedKeyBlockIndexReader(comparator, trailer.getNumDataIndexLevels()); HFileBlockIndex.BlockIndexReader metaBlockIndexReader =
new HFileBlockIndex.CellBasedKeyBlockIndexReader( CellComparatorImpl.COMPARATOR, numLevels, brw);
new HFileBlockIndex.CellBasedKeyBlockIndexReader(comparator, trailer.getNumDataIndexLevels()); HFileBlockIndex.BlockIndexReader metaBlockIndexReader =
dataBlockIndexReader = new HFileBlockIndex.CellBasedKeyBlockIndexReader(comparator, trailer.getNumDataIndexLevels(), this); metaBlockIndexReader = new HFileBlockIndex.ByteArrayKeyBlockIndexReader(1); dataBlockIndexReader.readMultiLevelIndexRoot( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount());
boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding) throws IOException { int rootLevelIndex = rootBlockContainingKey(key); if (rootLevelIndex < 0 || rootLevelIndex >= blockOffsets.length) { return null; index = locateNonRootIndexEntry(buffer, key, comparator); if (index == -1) { byte[] nonRootIndexedKey = getNonRootIndexedKey(buffer, index + 1); if (nonRootIndexedKey != null) { tmpNextIndexKV.setKey(nonRootIndexedKey, 0, nonRootIndexedKey.length);
new HFileBlockIndex.CellBasedKeyBlockIndexReader( CellComparatorImpl.COMPARATOR, numLevels, brw);
/** * @return Last key as cell in the file. May be null if file has no entries. Note that * this is not the last row key, but it is the Cell representation of the last * key */ @Override public Optional<Cell> getLastKey() { return dataBlockIndexReader.isEmpty() ? Optional.empty() : Optional.of(lastKeyCell); }
/** * @return the total heap size of data and meta block indexes in bytes. Does * not take into account non-root blocks of a multilevel data index. */ @Override public long indexSize() { return (dataBlockIndexReader != null ? dataBlockIndexReader.heapSize() : 0) + ((metaBlockIndexReader != null) ? metaBlockIndexReader.heapSize() : 0); }