private HFileBlock getBloomBlock(int block) { HFileBlock bloomBlock; try { // We cache the block and use a positional read. bloomBlock = reader.readBlock(index.getRootBlockOffset(block), index.getRootBlockDataSize(block), true, true, false, true, BlockType.BLOOM_CHUNK, null); } catch (IOException ex) { // The Bloom filter is broken, turn it off. throw new IllegalArgumentException("Failed to load Bloom block", ex); } if (numQueriesPerChunk != null) { // Update statistics. Only used in unit tests. ++numQueriesPerChunk[block]; } return bloomBlock; }
int searchResult = BlockIndexReader.binarySearchNonRootIndex(cell, new MultiByteBuff(nonRootIndex), CellComparatorImpl.COMPARATOR); String lookupFailureMsg = "Failed to look up key #" + i + " (" (BlockIndexReader.locateNonRootIndexEntry(new MultiByteBuff(nonRootIndex), cell, CellComparatorImpl.COMPARATOR) != -1);
dataBlockIndexReader.readMultiLevelIndexRoot( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount()); Cell midkey = dataBlockIndexReader.midkey(); assertNotNull("Midkey should not be null", midkey); metaBlockIndexReader.readRootIndex( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX) .getByteStream(), trailer.getMetaIndexCount());
int blockCount = bir.getRootBlockCount(); if (bir.getRootBlockOffset(i) < offset) { fromKey = bir.getRootBlockKey(i); break; if (bir.getRootBlockOffset(i) < (offset + length)) { toKey = bir.getRootBlockKey(i); break;
int blockCount = bir.getRootBlockCount(); if (bir.getRootBlockOffset(i) < offset) { fromKey = bir.getRootBlockKey(i); break; if (bir.getRootBlockOffset(i) < (offset + length)) { toKey = bir.getRootBlockKey(i); break;
dataBlockIndexReader.readMultiLevelIndexRoot( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount()); Cell midkey = dataBlockIndexReader.midkey(); assertNotNull("Midkey should not be null", midkey); metaBlockIndexReader.readRootIndex( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX) .getByteStream(), trailer.getMetaIndexCount());
dataBlockIndexReader = new HFileBlockIndex.BlockIndexReader(comparator, trailer.getNumDataIndexLevels(), this); metaBlockIndexReader = new HFileBlockIndex.BlockIndexReader( KeyValue.RAW_COMPARATOR, 1); dataBlockIndexReader.readMultiLevelIndexRoot( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount()); metaBlockIndexReader.readRootIndex( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getMetaIndexCount());
boolean pread, boolean isCompaction) throws IOException { int rootLevelIndex = rootBlockContainingKey(key, keyOffset, keyLength); if (rootLevelIndex < 0 || rootLevelIndex >= blockOffsets.length) { return null; index = locateNonRootIndexEntry(buffer, key, keyOffset, keyLength, comparator); if (index == -1) { throw new IOException("The key " byte[] tmpNextIndexedKey = getNonRootIndexedKey(buffer, index + 1); if (tmpNextIndexedKey != null) { nextIndexedKey = tmpNextIndexedKey;
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[] tmpNextIndexedKey = getNonRootIndexedKey(buffer, index + 1); if (tmpNextIndexedKey != null) { nextIndexedKey = new KeyValue.KeyOnlyKeyValue(tmpNextIndexedKey);
int searchResult = BlockIndexReader.binarySearchNonRootIndex(cell, new MultiByteBuff(nonRootIndex), CellComparatorImpl.COMPARATOR); String lookupFailureMsg = "Failed to look up key #" + i + " (" (BlockIndexReader.locateNonRootIndexEntry(new MultiByteBuff(nonRootIndex), cell, CellComparatorImpl.COMPARATOR) != -1);
dataBlockIndexReader = new HFileBlockIndex.BlockIndexReader(comparator, trailer.getNumDataIndexLevels(), this); metaBlockIndexReader = new HFileBlockIndex.BlockIndexReader( Bytes.BYTES_RAWCOMPARATOR, 1); dataBlockIndexReader.readMultiLevelIndexRoot( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getDataIndexCount()); metaBlockIndexReader.readRootIndex( blockIter.nextBlockWithBlockType(BlockType.ROOT_INDEX), trailer.getMetaIndexCount());
throw new IOException("Block index not loaded"); if (block < 0 || block >= dataBlockIndexReader.getRootBlockCount()) { throw new IOException("Requested block is out of range: " + block + ", max: " + dataBlockIndexReader.getRootBlockCount()); long offset = dataBlockIndexReader.getRootBlockOffset(block); BlockCacheKey cacheKey = new BlockCacheKey(name, offset); synchronized (dataBlockIndexReader.getRootBlockKey(block)) { long nextOffset; if (block == dataBlockIndexReader.getRootBlockCount() - 1) { nextOffset = (metaBlockIndexReader.getRootBlockCount() == 0) ? this.trailer.getFileInfoOffset() : metaBlockIndexReader.getRootBlockOffset(0); } else { nextOffset = dataBlockIndexReader.getRootBlockOffset(block + 1); - offset, dataBlockIndexReader.getRootBlockDataSize(block), pread); passSchemaMetricsTo(hfileBlock); hfileBlock.expectType(BlockType.DATA);
int block = metaBlockIndexReader.rootBlockContainingKey(nameBytes, 0, nameBytes.length); if (block == -1) return null; long offset = metaBlockIndexReader.getRootBlockOffset(block); long nextOffset; if (block == metaBlockIndexReader.getRootBlockCount() - 1) { nextOffset = trailer.getFileInfoOffset(); } else { nextOffset = metaBlockIndexReader.getRootBlockOffset(block + 1); synchronized (metaBlockIndexReader.getRootBlockKey(block)) { nextOffset - offset, metaBlockIndexReader.getRootBlockDataSize(block), true); passSchemaMetricsTo(hfileBlock);
new CacheConfig(fs.getConf()), fs.getConf()); BlockIndexReader bir = reader.getDataBlockIndexReader(); int blockCount = bir.getRootBlockCount(); reader.close();
int block = metaBlockIndexReader.rootBlockContainingKey(mbname, 0, mbname.length); if (block == -1) return null; long blockSize = metaBlockIndexReader.getRootBlockDataSize(block); synchronized (metaBlockIndexReader.getRootBlockKey(block)) { long metaBlockOffset = metaBlockIndexReader.getRootBlockOffset(block); BlockCacheKey cacheKey = new BlockCacheKey(name, metaBlockOffset, this.isPrimaryReplicaReader());
int block = metaBlockIndexReader.rootBlockContainingKey(mbname, 0, mbname.length); if (block == -1) return null; long blockSize = metaBlockIndexReader.getRootBlockDataSize(block); long startTimeNs = System.nanoTime(); synchronized (metaBlockIndexReader.getRootBlockKey(block)) { long metaBlockOffset = metaBlockIndexReader.getRootBlockOffset(block); BlockCacheKey cacheKey = new BlockCacheKey(name, metaBlockOffset, DataBlockEncoding.NONE, BlockType.META);
new HFileBlockIndex.BlockIndexReader(comparator, 1); metaBlockIndexReader = new HFileBlockIndex.BlockIndexReader(Bytes.BYTES_RAWCOMPARATOR, 1); dataBlockIndexReader.readRootIndex(dis, trailer.getDataIndexCount()); metaBlockIndexReader.readRootIndex(dis, trailer.getMetaIndexCount());
CellComparatorImpl.COMPARATOR, numLevels, brw); indexReader.readRootIndex(blockReader.blockRange(rootIndexOffset, fileSize).nextBlockWithBlockType(BlockType.ROOT_INDEX), numRootEntries); KeyValue.KeyOnlyKeyValue keyOnlyKey = new KeyValue.KeyOnlyKeyValue(key, 0, key.length); HFileBlock b = indexReader.seekToDataBlock(keyOnlyKey, null, true, true, false, null); if (PrivateCellUtil.compare(CellComparatorImpl.COMPARATOR, keyOnlyKey, firstKeyInFile, 0,
int block = index.rootBlockContainingKey(key, keyOffset, keyLength); if (block < 0) { try { bloomBlock = reader.readBlock(index.getRootBlockOffset(block), index.getRootBlockDataSize(block), true, true, false, true, BlockType.BLOOM_CHUNK, null); } catch (IOException ex) {
if (currBlock >= reader.getDataBlockIndexReader().getRootBlockCount()) {