@Test
  public void testOverflowWithRehash() throws Exception {
    try {
      final boolean[] threadCompleted = new boolean[3];
      createReplicatedRegionWithOverflow("portfolios");
      HashIndexSet.TEST_ALWAYS_REHASH = true;
      Index index = qs.createHashIndex("idHash", "p", SEPARATOR + "portfolios p");

      Thread puts = new Thread(() -> {
        for (int j = 0; j < 20; j++) {
          for (int i = 0; i < 2; i++) {
            region.put("" + i, "SOME STRING OBJECT" + i);
          }
        }
        threadCompleted[0] = true;
      });

      Thread morePuts = new Thread(() -> {
        for (int j = 0; j < 20; j++) {
          for (int i = 0; i < 1; i++) {
            region.put("" + (i + 100), "SOME OTHER STRING OBJECT" + (i + 100));
          }
        }
        threadCompleted[1] = true;
      });

      Thread evenMorePuts = new Thread(() -> {
        for (int j = 0; j < 20; j++) {
          for (int i = 0; i < 1; i++) {
            region.put("" + (i + 200), "ANOTHER STRING OBJECT" + (i + 200));
          }
        }
        threadCompleted[2] = true;
      });

      evenMorePuts.start();
      morePuts.start();
      puts.start();

      puts.join(30000);
      morePuts.join(30000);
      evenMorePuts.join(30000);
      assertTrue("Thread possibly deadlocked, thread did not complete", threadCompleted[0]);
      assertTrue("Thread possibly deadlocked, thread did not complete", threadCompleted[1]);
      assertTrue("Thread possibly deadlocked, thread did not complete", threadCompleted[2]);

      SelectResults results =
          (SelectResults) qs.newQuery("Select * FROM " + SEPARATOR + "portfolios p").execute();
      assertEquals(4, results.size());
    } finally {
      HashIndexSet.TEST_ALWAYS_REHASH = false;
    }
  }
test remove and not equals Query
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/HashIndexQueryIntegrationTest.java