@Override public long getEntries() { // Estimate the number of entries as half the original file; this may be wildly inaccurate. return super.getEntries() / 2; }
private static long getTotalKvCount(final Collection<HStoreFile> candidates) { long totalSize = 0; for (HStoreFile storeFile : candidates) { totalSize += storeFile.getReader().getEntries(); } return totalSize; }
/** * The FIFOCompactionPolicy only choose those TTL expired HFiles as the compaction candidates. So * if all HFiles are TTL expired, then the compaction will generate a new empty HFile. While its * max timestamp will be Long.MAX_VALUE. If not considered separately, the HFile will never be * archived because its TTL will be never expired. So we'll check the empty store file separately. * (See HBASE-21504) */ private boolean isEmptyStoreFile(HStoreFile sf) { return sf.getReader().getEntries() == 0; }
/** * @param path The pathname of the tmp file into which the store was flushed * @param logCacheFlushId * @param status * @return store file created. * @throws IOException */ private HStoreFile commitFile(Path path, long logCacheFlushId, MonitoredTask status) throws IOException { // Write-out finished successfully, move into the right spot Path dstPath = fs.commitStoreFile(getColumnFamilyName(), path); status.setStatus("Flushing " + this + ": reopening flushed file"); HStoreFile sf = createStoreFileAndReader(dstPath); StoreFileReader r = sf.getReader(); this.storeSize.addAndGet(r.length()); this.totalUncompressedBytes.addAndGet(r.getTotalUncompressedBytes()); if (LOG.isInfoEnabled()) { LOG.info("Added " + sf + ", entries=" + r.getEntries() + ", sequenceid=" + logCacheFlushId + ", filesize=" + TraditionalBinaryPrefix.long2String(r.length(), "", 1)); } return sf; }
private static HStoreFile createFile(long size) throws Exception { HStoreFile sf = mock(HStoreFile.class); when(sf.getPath()).thenReturn(new Path("moo")); StoreFileReader r = mock(StoreFileReader.class); when(r.getEntries()).thenReturn(size); when(r.length()).thenReturn(size); when(r.getBloomFilterType()).thenReturn(BloomType.NONE); when(r.getHFileReader()).thenReturn(mock(HFile.Reader.class)); when(r.getStoreFileScanner(anyBoolean(), anyBoolean(), anyBoolean(), anyLong(), anyLong(), anyBoolean())).thenReturn(mock(StoreFileScanner.class)); when(sf.getReader()).thenReturn(r); when(sf.getBulkLoadTimestamp()).thenReturn(OptionalLong.empty()); return sf; }
if (LOG.isInfoEnabled()) { LOG.info("Region: " + HStore.this.getRegionInfo().getEncodedName() + " added " + storeFile + ", entries=" + storeFile.getReader().getEntries() + ", sequenceid=" + +storeFile.getReader().getSequenceID() + ", filesize=" + TraditionalBinaryPrefix.long2String(storeFile.getReader().length(), "", 1));
long keyCount = r.getEntries(); fd.maxKeyCount += keyCount;
reader.loadFileInfo(); reader.loadBloomfilter(); assertEquals(num_unique_rows * duplicate_multiplier, reader.getEntries()); assertEquals(num_unique_rows, reader.getFilterEntries()); reader.loadFileInfo(); reader.loadBloomfilter(); assertEquals(num_unique_rows * duplicate_multiplier * num_storefiles, reader.getEntries()); assertEquals(num_unique_rows, reader.getFilterEntries());
HStoreFile sf = store.getStorefiles().iterator().next(); Assert.assertNotNull(sf); Assert.assertEquals(0, sf.getReader().getEntries()); sf = store.getStorefiles().iterator().next(); Assert.assertNotNull(sf); Assert.assertEquals(0, sf.getReader().getEntries());
private static HStoreFile createFile(long size) throws Exception { HStoreFile sf = mock(HStoreFile.class); when(sf.getPath()).thenReturn(new Path("moo")); StoreFileReader r = mock(StoreFileReader.class); when(r.getEntries()).thenReturn(size); when(r.length()).thenReturn(size); when(r.getBloomFilterType()).thenReturn(BloomType.NONE); when(r.getHFileReader()).thenReturn(mock(HFile.Reader.class)); when(r.getStoreFileScanner(anyBoolean(), anyBoolean(), anyBoolean(), anyLong(), anyLong(), anyBoolean())).thenReturn(mock(StoreFileScanner.class)); when(sf.getReader()).thenReturn(r); when(sf.getBulkLoadTimestamp()).thenReturn(OptionalLong.empty()); return sf; }
HStoreFile sf = store.getStorefiles().iterator().next(); Assert.assertNotNull(sf); Assert.assertEquals(0, sf.getReader().getEntries()); sf = store.getStorefiles().iterator().next(); Assert.assertNotNull(sf); Assert.assertEquals(0, sf.getReader().getEntries());
reader.loadFileInfo(); reader.loadBloomfilter(); assertEquals(num_unique_rows * duplicate_multiplier, reader.getEntries()); assertEquals(num_unique_rows, reader.getFilterEntries()); reader.loadFileInfo(); reader.loadBloomfilter(); assertEquals(num_unique_rows * duplicate_multiplier * num_storefiles, reader.getEntries()); assertEquals(num_unique_rows, reader.getFilterEntries());