@Test
  public void testForceCompactionDoesRoll() {
    DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
    diskRegionProperties.setRegionName(regionName);
    diskRegionProperties.setRolling(false);
    diskRegionProperties.setDiskDirs(diskDirs);
    diskRegionProperties.setAllowForceCompaction(true);
    diskRegionProperties.setPersistBackup(true);

    DiskStoreFactory diskStoreFactory = toDiskStoreFactory(diskRegionProperties);

    createDiskStoreWithSizeInBytes(diskStoreName, diskStoreFactory);

    Region<String, String> region =
        createRegion(regionName, diskStoreName, true, true, false, false, 0);

    DiskStore diskStore = getDiskStore(region);

    assertThat(diskStore.forceCompaction()).isFalse();

    region.put("key1", "value1");
    region.put("key2", "value2");

    assertThat(diskStore.forceCompaction()).isFalse();

    region.remove("key1");
    region.remove("key2");

    // the following forceCompaction should go ahead and do a roll and compact it
    boolean compacted = diskStore.forceCompaction();
    assertThat(compacted).isTrue();
  }
Regression test for TRAC #40648: oplog rolling fails reading with Bad file descriptor

<p>
Same as part1 but no persistence.
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionJUnitTest.java