protected boolean checkAndAddToActiveSize(MutableSegment currActive, Cell cellToAdd,
    MemStoreSizing memstoreSizing) {
    long cellSize = MutableSegment.getCellLength(cellToAdd);
    boolean successAdd = false;
    while (true) {
      long segmentDataSize = currActive.getDataSize();
      if (!inWalReplay && segmentDataSize > inmemoryFlushSize) {
        // when replaying edits from WAL there is no need in in-memory flush regardless the size
        // otherwise size below flush threshold try to update atomically
        break;
      }
      if (currActive.compareAndSetDataSize(segmentDataSize, segmentDataSize + cellSize)) {
        if (memstoreSizing != null) {
          memstoreSizing.incMemStoreSize(cellSize, 0, 0, 0);
        }
        successAdd = true;
        break;
      }
    }

    if (!inWalReplay && currActive.getDataSize() > inmemoryFlushSize) {
      // size above flush threshold so we flush in memory
      this.tryFlushInMemoryAndCompactingAsync(currActive);
    }
    return successAdd;
  }
Check whether anything need to be done based on the current active set size. The method is
invoked upon every addition to the active set. For CompactingMemStore, flush the active set to
the read-only memory if it's size is above threshold
@param currActive     intended segment to update
@param cellToAdd      cell to be added to the segment
@param memstoreSizing object to accumulate changed size
@return true if the cell can be added to the currActive
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java