@Test
  public void testConcurrentMapClearAndRegionPutOperation() {
    try {
      CacheUtils.getCache();
      isInitDone = false;
      Query q =
          qs.newQuery("SELECT DISTINCT * FROM " + SEPARATOR + "portfolio where status = 'active'");
      QueryObserverHolder.setInstance(new QueryObserverAdapter() {

        @Override
        public void afterIndexLookup(Collection coll) {
          indexUsed = true;
        }

        @Override
        public void beforeRerunningIndexCreationQuery() {
          // Spawn a separate thread here which does a put opertion on region
          Thread th = new Thread(() -> {
            // Assert that the size of region is now 0
            assertTrue(region.size() == 0);
            region.put("" + 8, new Portfolio(8));
          });
          th.start();
          ThreadUtils.join(th, 30 * 1000);
          assertTrue(region.size() == 1);
        }
      });
      SelectResults set = (SelectResults) q.execute();
      if (set.size() == 0 || !indexUsed) {
        fail("Either Size of the result set is zero or Index is not used ");
      }
      indexUsed = false;
      region.clear();
      set = (SelectResults) q.execute();
      if (set.size() != 1 || !indexUsed) {
        fail("Either Size of the result set is not one or Index is not used ");
      }
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.toString());
    } finally {
      isInitDone = false;
      CacheUtils.restartCache();
    }
  }
Needed to fix this since the key "4" was not found and the size was then redueced to 3 after
invalidating the key 3
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java