@Override public long getDataSize() { return this.memStoreSizing.getDataSize(); }
@Override public long getMemStoreDataSize() { return memStoreSizing.getDataSize(); }
/** * @return True if its worth doing a flush before we put up the close flag. */ private boolean worthPreFlushing() { return this.memStoreSizing.getDataSize() > this.conf.getLong("hbase.hregion.preclose.flush.size", 1024 * 1024 * 5); }
public boolean pushHead(MutableSegment segment) { // Record the ImmutableSegment' heap overhead when initialing MemStoreSizing memstoreAccounting = new NonThreadSafeMemStoreSizing(); ImmutableSegment immutableSegment = SegmentFactory.instance(). createImmutableSegment(segment, memstoreAccounting); if (region != null) { region.addMemStoreSize(memstoreAccounting.getDataSize(), memstoreAccounting.getHeapSize(), memstoreAccounting.getOffHeapSize(), memstoreAccounting.getCellsCount()); } synchronized (pipeline){ boolean res = addFirst(immutableSegment); readOnlyCopy = new LinkedList<>(pipeline); return res; } }
protected void resetActive() { // Record the MutableSegment' heap overhead when initialing MemStoreSizing memstoreAccounting = new NonThreadSafeMemStoreSizing(); // Reset heap to not include any keys active = SegmentFactory.instance().createMutableSegment(conf, comparator, memstoreAccounting); // regionServices can be null when testing if (regionServices != null) { regionServices.addMemStoreSize(memstoreAccounting.getDataSize(), memstoreAccounting.getHeapSize(), memstoreAccounting.getOffHeapSize(), memstoreAccounting.getCellsCount()); } timeOfOldestEdit = Long.MAX_VALUE; }
int flushCount = 0; long tmp = 0; long remainingSize = this.memStoreSizing.getDataSize(); while (remainingSize > 0) { try { tmp = this.memStoreSizing.getDataSize(); if (tmp >= remainingSize) { failedfFlushCount++; if (!canFlush) { decrMemStoreSize(this.memStoreSizing.getMemStoreSize()); } else if (this.memStoreSizing.getDataSize() != 0) { LOG.error("Memstore data size is {}", this.memStoreSizing.getDataSize());
protected void writeMiniBatchOperationsToMemStore( final MiniBatchOperationInProgress<Mutation> miniBatchOp, final long writeNumber) throws IOException { MemStoreSizing memStoreAccounting = new NonThreadSafeMemStoreSizing(); visitBatchOperations(true, miniBatchOp.getLastIndexExclusive(), (int index) -> { // We need to update the sequence id for following reasons. // 1) If the op is in replay mode, FSWALEntry#stampRegionSequenceId won't stamp sequence id. // 2) If no WAL, FSWALEntry won't be used // we use durability of the original mutation for the mutation passed by CP. if (isInReplay() || getMutation(index).getDurability() == Durability.SKIP_WAL) { region.updateSequenceId(familyCellMaps[index].values(), writeNumber); } applyFamilyMapToMemStore(familyCellMaps[index], memStoreAccounting); return true; }); // update memStore size region.incMemStoreSize(memStoreAccounting.getDataSize(), memStoreAccounting.getHeapSize(), memStoreAccounting.getOffHeapSize(), memStoreAccounting.getCellsCount()); }
if (this.memStoreSizing.getDataSize() <= 0) { if (this.memStoreSizing.getDataSize() <= 0) {
/** * Creates a snapshot of the current memstore. * Snapshot must be cleared by call to {@link #clearSnapshot(long)} */ @Override public MemStoreSnapshot snapshot() { // If snapshot currently has entries, then flusher failed or didn't call // cleanup. Log a warning. if (!this.snapshot.isEmpty()) { LOG.warn("Snapshot called again without clearing previous. " + "Doing nothing. Another ongoing flush or did we fail last attempt?"); } else { this.snapshotId = EnvironmentEdgeManager.currentTime(); if (!getActive().isEmpty()) { // Record the ImmutableSegment' heap overhead when initialing MemStoreSizing memstoreAccounting = new NonThreadSafeMemStoreSizing(); ImmutableSegment immutableSegment = SegmentFactory.instance(). createImmutableSegment(getActive(), memstoreAccounting); // regionServices can be null when testing if (regionServices != null) { regionServices.addMemStoreSize(memstoreAccounting.getDataSize(), memstoreAccounting.getHeapSize(), memstoreAccounting.getOffHeapSize(), memstoreAccounting.getCellsCount()); } this.snapshot = immutableSegment; resetActive(); } } return new MemStoreSnapshot(this.snapshotId, this.snapshot); }
assertTrue("HeapSize should always bigger or equal than data size", sizeChangeForFirstCell.getHeapSize() >= sizeChangeForFirstCell .getDataSize()); assertTrue("HeapSize should always bigger or equal than data size", sizeChangeForSecondCell.getHeapSize() >= sizeChangeForSecondCell .getDataSize()); } else { assertTrue("OffHeapSize should always bigger or equal than data size", sizeChangeForFirstCell.getOffHeapSize() >= sizeChangeForFirstCell .getDataSize()); assertTrue("OffHeapSize should always bigger or equal than data size", sizeChangeForSecondCell.getOffHeapSize() >= sizeChangeForSecondCell .getDataSize());