@Override
    protected void preCommitWritersInternal() throws IOException {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Stopping with " + cellsInCurrentWriter + " kvs in last writer"
          + ((this.sourceScanner == null)
            ? ""
            : ("; observed estimated " + this.sourceScanner.getEstimatedNumberOfKvsScanned()
              + " KVs total")));
      }
      if (lastCell != null) {
        sanityCheckRight(right, lastCell);
      }

      // When expired stripes were going to be merged into one, and if no writer was created during
      // the compaction, we need to create an empty file to preserve metadata.
      if (existingWriters.isEmpty() && 1 == targetCount) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Merge expired stripes into one, create an empty file to preserve metadata.");
        }
        boundaries.add(left);
        existingWriters.add(writerFactory.createWriter());
      }

      this.boundaries.add(right);
    }
@param targetCount The maximum count of writers that can be created.
@param targetKvs   The number of KVs to read from source before starting each new writer.
@param left        The left boundary of the first writer.
@param right       The right boundary of the last writer.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeMultiFileWriter.java