private BlobStoreCompactor getCompactor(Log log, DiskIOScheduler ioScheduler, RemoteTokenTracker remoteTokenTracker,
      boolean enableAutoCloseLastLogSegment) throws IOException, StoreException {
    closeOrExceptionInduced = false;
    state.properties.put("store.compaction.enable.direct.io", Boolean.toString(doDirectIO));
    if (directIOWithBuffer) {
      state.properties.put(StoreConfig.storeCompactionDirectIOBufferSizeName, String.valueOf(4 * 1024 * 1024));
    }
    if (withUndelete) {
      state.properties.put("store.compaction.filter", "IndexSegmentValidEntryWithUndelete");
    }
    state.properties.put("store.auto.close.last.log.segment.enabled", Boolean.toString(enableAutoCloseLastLogSegment));
    if (enableAutoCloseLastLogSegment) {
      state.properties.put("store.compaction.policy.factory", "com.github.ambry.store.HybridCompactionPolicyFactory");
      state.properties.put("store.container.deletion.enabled", Boolean.toString(enableAutoCloseLastLogSegment));
    }
    state.properties.put("store.compaction.purge.delete.tombstone", Boolean.toString(purgeDeleteTombstone));
    StoreConfig config = new StoreConfig(new VerifiableProperties(state.properties));
    metricRegistry = new MetricRegistry();
    StoreMetrics metrics = new StoreMetrics(metricRegistry);
    BlobStoreCompactor compactor =
        new BlobStoreCompactor(tempDirStr, STORE_ID, STORE_KEY_FACTORY, config, metrics, metrics, ioScheduler,
            StoreTestUtils.DEFAULT_DISK_SPACE_ALLOCATOR, log, state.time, state.sessionId, state.incarnationId,
            accountService, remoteTokenTracker, null);
    compactor.enablePersistIndexSegmentOffsets();
    return compactor;
  }
Gets an instance of {@link BlobStoreCompactor}.
@param log the {@link Log} instance to use.
@param ioScheduler the {@link DiskIOScheduler} instance to use.
@param remoteTokenTracker the {@link RemoteTokenTracker} instance to use.
@param enableAutoCloseLastLogSegment
@return an instance of {@link BlobStoreCompactor}.
@throws IOException
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreCompactorTest.java