@Test
  public void testCompactorRegionMapDeletedForOnlyDrfOplogAfterCompactionAndRecoveryAfterRegionClose()
      throws InterruptedException {

    createDiskStore(30, 10000);
    Region<Object, Object> region = createRegion();
    DiskStoreImpl diskStore = ((InternalRegion) region).getDiskStore();

    // Create several oplog files (.crf and .drf) by executing put operations in defined range
    executePutsInRange0_299(region);
    await().untilAsserted(() -> assertThat(getCurrentNumberOfOplogs(diskStore)).isEqualTo(5));

    // Destroy every fifth entry from previous range and each time put new entry in new range.
    // This will create additional oplog files (.crf and .drf), but compaction will not be triggered
    // as threshold will not be reached. Oplog files (.drf) created in this step will contain
    // destroys for events that are located in .crf files from previous range.
    destroyEveryFifthElementInRange0_299AndEachTimePutInRange300_599(region);
    await().untilAsserted(() -> assertThat(getCurrentNumberOfOplogs(diskStore)).isEqualTo(7));

    // Destroy all events created in previous step in order to trigger automatic compaction.
    // This will trigger compaction for the files that were created in previous step.
    // Compaction will delete .crf and .krf file, but will leave .drf file because it contains
    // destroy operation for the events that are located in some older .crf files.
    destroyEveryFifthElementInRange300_599(region);

    // wait for all Oplog's to be compacted
    await().untilAsserted(() -> assertThat(isOplogToBeCompactedAvailable(diskStore)).isFalse());

    // close the region and then recreate it to trigger recovery from oplog files
    region.close();
    region = createRegion();

    // every fifth element is destroyed from range ENTRY_RANGE_1, so it is expected to have
    // ENTRY_RANGE_1 - (ENTRY_RANGE_1/5) of elements, also just in case check that every
    // fifth get operation return null
    checkThatAllRegionDataIsRecoveredFromOplogFiles(region);

    // check that unnecessary data is cleared from Oplog's
    await().untilAsserted(
        () -> assertThat(areAllUnnecessaryObjectClearedForOnlyDrfOplog(diskStore)).isTrue());
  }
Verifies that the region is recovered from Oplog's (including .drf only oplog's) when region is
closed and then recreated again in order to trigger recovery.
This test case covers the following scenario:

1. Create several Oplog files (.crf, .drf and .krf) by executing put operations
2. Execute destroy operation for every fifth entry, and each time add new entry. This will
result with few additional Oplog files. Compaction threshold will not be reached.
3. Destroy all operations created in step 2. This will trigger compaction of files that
were created in step 2. Compaction will delete only .crf and .krf files, but will not
delete .drf files because they contain destroy operations for events located in
.crf files created in step 1. Check that unnecessary objects are cleared for the
Oplog that represents orphaned .drf file (no accompanying .crf and .krf file)
4. At this step there will be Oplog objects from step 1. that will contain all files (.crf,
.drf and .krf), and Oplog objects from step 2. that will contain only .drf files.
In order to test recovery, close the region and then recreate it again.
5. Check that region is recovered correctly. Check that only events that have never been
destroyed are recovered from Oplog files.
6. Check that unnecessary objects are cleared for theOplog that represents orphaned .drf
file (no accompanying .crf and .krf file)
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionCompactorClearsObjectThatAreNoLongerNeededIntegrationTest.java