private void removeUnneededFiles() throws IOException {
    if (!conf.getBoolean("hbase.store.delete.expired.storefile", true)) {
      return;
    }
    if (getColumnFamilyDescriptor().getMinVersions() > 0) {
      LOG.debug("Skipping expired store file removal due to min version of {} being {}", this,
        getColumnFamilyDescriptor().getMinVersions());
      return;
    }
    this.storeEngine.readLock();
    Collection<HStoreFile> delSfs = null;
    try {
      synchronized (filesCompacting) {
        long cfTtl = getStoreFileTtl();
        if (cfTtl != Long.MAX_VALUE) {
          delSfs = storeEngine.getStoreFileManager()
            .getUnneededFiles(EnvironmentEdgeManager.currentTime() - cfTtl, filesCompacting);
          addToCompactingFiles(delSfs);
        }
      }
    } finally {
      this.storeEngine.readUnlock();
    }

    if (CollectionUtils.isEmpty(delSfs)) {
      return;
    }

    Collection<HStoreFile> newFiles = Collections.emptyList(); // No new files.
    replaceStoreFiles(delSfs, newFiles, true);
    refreshStoreSizeAndTotalBytes();
    LOG.info("Completed removal of " + delSfs.size() + " unnecessary (expired) file(s) in " + this
      + "; total size is " + TraditionalBinaryPrefix.long2String(storeSize.get(), "", 1));
  }
Adds the files to compacting files. filesCompacting must be locked.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java