@Override
    public MemStoreSize prepare() {
      // passing the current sequence number of the wal - to allow bookkeeping in the memstore
      this.snapshot = memstore.snapshot();
      this.cacheFlushCount = snapshot.getCellsCount();
      this.cacheFlushSize = snapshot.getDataSize();
      committedFiles = new ArrayList<>(1);
      return snapshot.getMemStoreSize();
    }
This is not thread safe. The caller should have a lock on the region or the store. If
necessary, the lock can be added with the patch provided in HBASE-10087
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java