@Test
  public void testPartitionedIndexCreationDuringPersistentRecovery() throws Exception {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    VM vm1 = host.getVM(1);
    setCacheInVMs(vm0, vm1);

    int redundancy = 1;

    vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPersistentPRCreate(
        PARTITIONED_REGION_NAME, redundancy, PortfolioData.class));
    vm1.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPersistentPRCreate(
        PARTITIONED_REGION_NAME, redundancy, PortfolioData.class));


    PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);

    vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(PARTITIONED_REGION_NAME,
        portfolio, cnt, cntDest));

    // Restart a single member
    vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForCloseCache());
    setCacheInVMs(vm0);

    AsyncInvocation<Void> regionCreateFuture =
        vm0.invokeAsync(prQueryDUnitHelper.getCacheSerializableRunnableForPersistentPRCreate(
            PARTITIONED_REGION_NAME, redundancy, PortfolioData.class));
    AsyncInvocation<Void> indexCreateFuture =
        vm1.invokeAsync(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate(
            PARTITIONED_REGION_NAME, "PrIndexOnId", "p.ID", null, "p"));

    regionCreateFuture.await();
    indexCreateFuture.await();

    vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForLocalRegionCreation(
        LOCAL_REGION_NAME, PortfolioData.class));
    vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(LOCAL_REGION_NAME,
        portfolio, cnt, cntDest));
    vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRQueryAndCompareResults(
        PARTITIONED_REGION_NAME, LOCAL_REGION_NAME));
  }
Test index usage with query on a partitioned region with bucket indexes.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java