@Test
  public void testBug42464() {
    int[] dirSizes = new int[] {900};

    DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
    diskRegionProperties.setDiskDirsAndSizes(new File[] {diskDirs[0]}, dirSizes);
    diskRegionProperties.setMaxOplogSize(500);
    diskRegionProperties.setRolling(true);
    diskRegionProperties.setOverFlowCapacity(1);

    DiskStoreFactory diskStoreFactory = toDiskStoreFactory(diskRegionProperties);

    DiskStore diskStore = createDiskStoreWithSizeInBytes(diskStoreName, diskStoreFactory, 500);

    Region<Integer, Object> region =
        createRegion(regionName, diskStoreName, false, true, false, true, 1);

    assertThat(diskStore.getDiskDirSizes()).as("expected=" + Arrays.toString(dirSizes) + " actual="
        + Arrays.toString(diskStore.getDiskDirSizes())).isEqualTo(dirSizes);

    // One entry is kept in memory
    // since the crf max is 500 we should only be able to have 4 entries. The
    // 5th should not fit because of record overhead.
    for (int i = 0; i <= 9; i++) {
      region.getCache().getLogger().info("putting " + i);
      region.put(i, new byte[101]);
    }

    // At this point we should have two oplogs that are basically full
    // (they should each contain 4 entries) and a third oplog that
    // contains a single entry. But the 3rd one will end up also containing 4
    // entries.
    // TODO what is the max size of this 3rd oplog's crf? The first two crfs
    // will be close to 400 bytes each. So the max size of the 3rd oplog should
    // be close to 100.
    ArrayList<OverflowOplog> oplogs = toDiskStoreImpl(diskStore).testHookGetAllOverflowOplogs();
    assertThat(oplogs).hasSize(3);

    // TODO verify oplogs
    // Now make sure that further oplogs can hold 4 entries
    for (int j = 10; j <= 13; j++) {
      region.put(j, new byte[101]);
    }
    oplogs = toDiskStoreImpl(diskStore).testHookGetAllOverflowOplogs();
    assertThat(oplogs).hasSize(4);

    // now remove all entries and make sure old oplogs go away
    for (int i = 0; i <= 13; i++) {
      region.remove(i);
    }

    // give background compactor chance to remove oplogs
    oplogs = toDiskStoreImpl(diskStore).testHookGetAllOverflowOplogs();
    int retryCount = 20;
    while (oplogs.size() > 1 && retryCount > 0) {
      Wait.pause(100);
      oplogs = toDiskStoreImpl(diskStore).testHookGetAllOverflowOplogs();
      retryCount--;
    }
    assertThat(oplogs).hasSize(1);
  }
Regression test for TRAC #42464: overfilling disk directory causes rampant oplog creation

<p>
When max-dir-size is exceeded and compaction is enabled we allow oplogs to keep getting
created. Make sure that when they do they do not keep putting one op per oplog (which is caused
by bug 42464).
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionJUnitTest.java