Donal Evans created GEODE-7980:
----------------------------------

             Summary: Incorrect member count in rebalance output when 
rebalancing colocated regions 
                 Key: GEODE-7980
                 URL: https://issues.apache.org/jira/browse/GEODE-7980
             Project: Geode
          Issue Type: Bug
            Reporter: Donal Evans


When colocated regions are present during rebalance, incorrect member counts 
are reported in the rebalance results:

 
{code:java}
[vm0] [info 2020/04/10 11:28:50.895 PDT <RebalanceCommand1> tid=0x56] 
Rebalanced partition regions /childRegion
 [vm0] Total bytes in all redundant bucket copies created during this rebalance 
= 0
 [vm0] Total time (in milliseconds) spent creating redundant bucket copies 
during this rebalance = 0
 [vm0] Total number of redundant copies created during this rebalance = 0
 [vm0] Total bytes in buckets moved during this rebalance = 0
 [vm0] Total time (in milliseconds) spent moving buckets during this rebalance 
= 0
 [vm0] Total number of buckets moved during this rebalance = 0
 [vm0] Total time (in milliseconds) spent switching the primary state of 
buckets during this rebalance = 0
 [vm0] Total primaries transferred during this rebalance = 0
 [vm0] Total time (in milliseconds) for this rebalance = 0
 [vm0] Total number of members in system on which rebalance is executed = 0
[vm0] [info 2020/04/10 11:28:50.896 PDT <RebalanceCommand1> tid=0x56] 
Rebalanced partition regions /parentRegion
 [vm0] Total bytes in all redundant bucket copies created during this rebalance 
= 0
 [vm0] Total time (in milliseconds) spent creating redundant bucket copies 
during this rebalance = 0
 [vm0] Total number of redundant copies created during this rebalance = 0
 [vm0] Total bytes in buckets moved during this rebalance = 18426
 [vm0] Total time (in milliseconds) spent moving buckets during this rebalance 
= 2715
 [vm0] Total number of buckets moved during this rebalance = 132
 [vm0] Total time (in milliseconds) spent switching the primary state of 
buckets during this rebalance = 0
 [vm0] Total primaries transferred during this rebalance = 0
 [vm0] Total time (in milliseconds) for this rebalance = 5506
 [vm0] Total number of members in system on which rebalance is executed = 4
{code}
 

 

A test to reproduce the issue is provided below.
{code:java}
public class RebalanceMembersColocationTest {

  public static final String PARENT_REGION_NAME = "parentRegion";
  public static final String CHILD_REGION_NAME = "childRegion";
  @Rule
  public ClusterStartupRule cluster = new ClusterStartupRule();

  @Rule
  public GfshCommandRule gfsh = new GfshCommandRule();

  @Test
  public void testRebalanceResultOutputMemberCountWIthColocatedRegions() throws 
Exception {
    MemberVM locator = cluster.startLocatorVM(0);

    MemberVM server1 = cluster.startServerVM(1, locator.getPort());
    MemberVM server2 = cluster.startServerVM(2, locator.getPort());

    server1.invoke(() -> {
      Region<Object, Object> parentRegion = 
Objects.requireNonNull(ClusterStartupRule.getCache())
          
.createRegionFactory(RegionShortcut.PARTITION).create(PARENT_REGION_NAME);

      IntStream.range(0, 500).forEach(i -> parentRegion.put("key" + i, "value" 
+ 1));

      PartitionAttributesImpl attributes = new PartitionAttributesImpl();
      attributes.setColocatedWith(PARENT_REGION_NAME);

      Region<Object, Object> childRegion = 
Objects.requireNonNull(ClusterStartupRule.getCache())
          
.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(attributes)
          .create(CHILD_REGION_NAME);

      IntStream.range(0, 500).forEach(i -> childRegion.put("key" + i, "value" + 
1));
    });

    server2.invoke(() -> {
      Objects.requireNonNull(ClusterStartupRule.getCache())
          
.createRegionFactory(RegionShortcut.PARTITION).create(PARENT_REGION_NAME);

      PartitionAttributesImpl attributes = new PartitionAttributesImpl();
      attributes.setColocatedWith(PARENT_REGION_NAME);

      Objects.requireNonNull(ClusterStartupRule.getCache())
          
.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(attributes)
          .create(CHILD_REGION_NAME);
    });

    locator.waitUntilRegionIsReadyOnExactlyThisManyServers("/" + 
PARENT_REGION_NAME, 2);
    locator.waitUntilRegionIsReadyOnExactlyThisManyServers("/" + 
CHILD_REGION_NAME, 2);

    gfsh.connectAndVerify(locator);

    Map<String, List<String>> rebalanceResult = 
gfsh.executeAndAssertThat("rebalance")
        .statusIsSuccess().hasTableSection().getActual().getContent();

    assertThat(rebalanceResult.get("Value").get(9)).isEqualTo("2");
  }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to