@Test
  public void testDataLossDuringQueryProcessor() throws Exception {
    datastore1.invoke(() -> {
      createPartitionedRegion();
    });
    datastore2.invoke(() -> {
      createPartitionedRegion();
    });

    Region<Integer, String> region = createPartitionedRegionAccessor();

    // Create bucket zero, one and two
    region.put(0, "zero");
    region.put(1, "one");
    region.put(2, "two");

    addIgnoredException("Data loss detected");

    DefaultQuery query = (DefaultQuery) getCache().getQueryService()
        .newQuery("select distinct * from " + region.getFullPath());
    final ExecutionContext executionContext = new QueryExecutionContext(null, getCache(), query);
    SelectResults results =
        query.getSimpleSelect().getEmptyResultSet(EMPTY_PARAMETERS, getCache(), query);

    Set<Integer> buckets = new HashSet<>();
    for (int i = 0; i < 3; i++) {
      buckets.add(i);
    }

    PartitionedRegion partitionedRegion = (PartitionedRegion) region;
    PartitionedRegionQueryEvaluator queryEvaluator =
        new PartitionedRegionQueryEvaluator(partitionedRegion.getSystem(), partitionedRegion, query,
            executionContext,
            EMPTY_PARAMETERS, results, buckets);

    DisconnectingTestHook testHook = new DisconnectingTestHook();
    assertThatThrownBy(() -> queryEvaluator.queryBuckets(testHook))
        .isInstanceOf(QueryException.class);
    assertThat(testHook.isDone()).isTrue();
  }
Test data loss (bucket 0) while the PRQueryEvaluator is processing the query loop
geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitTest.java