gesterzhou commented on a change in pull request #7440: URL: https://github.com/apache/geode/pull/7440#discussion_r826633575
########## File path: geode-core/src/distributedTest/java/org/apache/geode/internal/cache/RebalanceWhileCreatingRegionDistributedTest.java ########## @@ -0,0 +1,298 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.internal.cache; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import org.apache.logging.log4j.Logger; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.cache.PartitionAttributesFactory; +import org.apache.geode.cache.Region; +import org.apache.geode.cache.RegionFactory; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.distributed.internal.ClusterDistributionManager; +import org.apache.geode.distributed.internal.DistributionMessage; +import org.apache.geode.distributed.internal.DistributionMessageObserver; +import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.internal.membership.InternalDistributedMember; +import org.apache.geode.internal.cache.partitioned.RemoveBucketMessage; +import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.rules.ClientVM; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.DistributedBlackboard; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; + +public class RebalanceWhileCreatingRegionDistributedTest implements Serializable { + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(); + + @Rule + public SerializableTestName testName = new SerializableTestName(); + + @Rule + public DistributedBlackboard blackboard = new DistributedBlackboard(); + + private static final Logger logger = LogService.getLogger(); + + public static final String BEFORE_REMOVE_BUCKET_MESSAGE = "Before_RemoveBucketMessage"; + + public static final String AFTER_CREATE_PROXY_REGION = "After_CreateProxyRegion"; + + @Test + public void testRebalanceDuringRegionCreation() throws Exception { Review comment: tests are good. However, it will be a little bit difficult for people with less background to understand the design of the test. It's better to add some comments. There're following key points: - simulate a bucket moving scenario - When processing RemoveBucketMessage, it will calculate recipients first, at that moment another member (proxy) might have not initialized PR yet. - send DestryRegionOperation.DestroyRegionMessage to let other member to remove the profile, but the proxy will miss it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org