@Override
    public boolean commit(MonitoredTask status) throws IOException {
      try {
        if (CollectionUtils.isEmpty(this.tempFiles)) {
          return false;
        }
        status.setStatus("Flushing " + this + ": reopening flushed file");
        List<HStoreFile> storeFiles = storeEngine.commitStoreFiles(tempFiles, false, false);
        for (HStoreFile sf : storeFiles) {
          StoreFileReader r = sf.getReader();
          if (LOG.isInfoEnabled()) {
            LOG.info("Added {}, entries={}, sequenceid={}, filesize={}", sf, r.getEntries(),
              cacheFlushSeqNum, TraditionalBinaryPrefix.long2String(r.length(), "", 1));
          }
          outputFileSize += r.length();
          storeSize.addAndGet(r.length());
          totalUncompressedBytes.addAndGet(r.getTotalUncompressedBytes());
          committedFiles.add(sf.getPath());
        }

        flushedCellsCount.addAndGet(cacheFlushCount);
        flushedCellsSize.addAndGet(cacheFlushSize);
        flushedOutputFileSize.addAndGet(outputFileSize);
        // call coprocessor after we have done all the accounting above
        for (HStoreFile sf : storeFiles) {
          if (getCoprocessorHost() != null) {
            getCoprocessorHost().postFlush(HStore.this, sf, tracker);
          }
        }
        // Add new file to store files. Clear snapshot too while we have the Store write lock.
        return completeFlush(storeFiles, snapshot.getId());
      } finally {
        if (writerCreationTracker != null) {
          HStore.this.storeFileWriterCreationTrackers.remove(writerCreationTracker);
        }
      }
    }
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