@Test
  public void testReplaceOfflineMemberAndRestartCreateColocatedPRLate() throws Exception {
    addIgnoredException(PartitionOfflineException.class);
    addIgnoredException(RegionDestroyedException.class);

    // Create the PRs on three members
    for (VM vm : toArray(vm0, vm1, vm2)) {
      vm.invoke(() -> {
        createCache();
        createDiskStore(diskStoreName1);
        createPR_withPersistence(regionName, diskStoreName1, 0, 1, DEFAULT_STARTUP_RECOVERY_DELAY);
      });
    }

    for (VM vm : toArray(vm0, vm1, vm2)) {
      vm.invoke(() -> createChildPR_withPersistence_andRecovery(regionName, childRegionName1,
          diskStoreName1, 0, 1, DEFAULT_STARTUP_RECOVERY_DELAY));
    }

    // Create some buckets.
    vm0.invoke(() -> {
      createData(regionName, "a");
      createData(childRegionName1, "a");
    });

    // Close one of the members to trigger redundancy recovery.
    vm2.invoke(this::closeCache);

    // Wait until redundancy is recovered.
    vm0.invoke(() -> {
      waitForRedundancyRecovery(regionName, 1);
      waitForRedundancyRecovery(childRegionName1, 1);

      createData(regionName, "b");
      createData(childRegionName1, "b");
    });

    // Close the remaining members.
    for (VM vm : toArray(vm0, vm1)) {
      vm.invoke(this::closeCache);
    }

    // Recreate the parent region. Try to make sure that the member with the latest copy of the
    // buckets is the one that decides to throw away it's copy by starting it last.
    for (VM vm : toArray(vm2, vm1, vm0)) {
      vm.invoke(() -> {
        createCache();
        createDiskStore(diskStoreName1);
        createPR_withPersistence(regionName, diskStoreName1, 0, 1,
            DEFAULT_STARTUP_RECOVERY_DELAY);
      });
    }

    // Recreate the child region.
    for (VM vm : toArray(vm2, vm1, vm0)) {
      addAsync(vm.invokeAsync(() -> createChildPR_withPersistence_andRecovery(regionName,
          childRegionName1, diskStoreName1, 0, 1, DEFAULT_STARTUP_RECOVERY_DELAY)));
    }
    awaitAllAsync();

    vm0.invoke(() -> {
      // Validate the data
      validateData(regionName, "b");
      validateData(childRegionName1, "b");

      // Make sure we can actually use the buckets in the child region.
      createData(childRegionName1, "c");

      waitForRedundancyRecovery(regionName, 1);
      waitForRedundancyRecovery(childRegionName1, 1);
    });

    // Make sure we don't have any extra buckets after the restart
    int parentRegionBucketCount = vm0.invoke(() -> getBucketIds(regionName).size());
    parentRegionBucketCount += vm1.invoke(() -> getBucketIds(regionName).size());
    parentRegionBucketCount += vm2.invoke(() -> getBucketIds(regionName).size());

    assertThat(parentRegionBucketCount).isEqualTo(2 * NUM_BUCKETS_TO_CREATE);

    int childRegionBucketCount = vm0.invoke(() -> getBucketIds(childRegionName1).size());
    childRegionBucketCount += vm1.invoke(() -> getBucketIds(childRegionName1).size());
    childRegionBucketCount += vm2.invoke(() -> getBucketIds(childRegionName1).size());

    assertThat(childRegionBucketCount).isEqualTo(2 * NUM_BUCKETS_TO_CREATE);
  }
Testing what happens we we recreate colocated persistent PRs by creating one PR everywhere and
then the other PR everywhere.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/partitioned/PersistentColocatedPartitionedRegionDistributedTest.java