@Test
  public void testClearInteractionWithUpdateOperation_Bug37606() throws Exception {
    DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
    diskRegionProperties.setOverflow(false);
    diskRegionProperties.setRolling(false);
    diskRegionProperties.setDiskDirs(diskDirs);
    diskRegionProperties.setPersistBackup(true);
    diskRegionProperties.setRegionName(regionName);

    DiskStoreFactory diskStoreFactory = toDiskStoreFactory(diskRegionProperties);

    createDiskStoreWithSizeInBytes(diskStoreName, diskStoreFactory);

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

    region.create("key1", "value1");

    AtomicReference<Future<Void>> doPutFuture = new AtomicReference<>();
    LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
    CacheObserverHolder.setInstance(new CacheObserverAdapter() {
      @Override
      public void beforeDiskClear() {
        LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
        doPutFuture.set(executorServiceRule.runAsync(() -> {
          try {
            region.put("key1", "value1");
          } catch (AssertionError | Exception e) {
            errorCollector.addError(e);
          }
        }));
      }
    });

    region.clear();
    awaitFuture(doPutFuture);

    // We expect 1 entry to exist, because the clear was triggered before the update
    assertThat(region.size()).isEqualTo(1);

    // close and recreate region and the entry should still exist
    region.close();
    Region<String, String> region2 =
        createRegion(regionName, diskStoreName, true, true, false, false, 0);
    assertThat(region2.size()).isEqualTo(1);
  }
Regression test for TRAC #37606: A cleared entry may still get logged into the Oplog due to a
very small window of race condition

<p>
Similar test in case of 'update'
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionJUnitTest.java