[ https://issues.apache.org/jira/browse/GEODE-7963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17097378#comment-17097378 ]
ASF GitHub Bot commented on GEODE-7963: --------------------------------------- jujoramos commented on a change in pull request #5000: URL: https://github.com/apache/geode/pull/5000#discussion_r418545400 ########## File path: geode-core/src/distributedTest/java/org/apache/geode/management/MemberMXBeanDistributedTest.java ########## @@ -0,0 +1,109 @@ +/* + * 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.management; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; + +import java.io.Serializable; + +import javax.management.ObjectName; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import org.apache.geode.cache.Cache; +import org.apache.geode.distributed.DistributedMember; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.GfshTest; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; + +@Category({GfshTest.class}) +public class MemberMXBeanDistributedTest implements + Serializable { + + private static MemberVM locator, server1, server2, server3, server4; + + @ClassRule + public static ClusterStartupRule lsRule = new ClusterStartupRule(); + + @ClassRule + public static GfshCommandRule gfsh = new GfshCommandRule(); + + @Rule + public TestName testName = new SerializableTestName(); + + @BeforeClass + public static void before() throws Exception { + locator = lsRule.startLocatorVM(0); + server1 = lsRule.startServerVM(1, "", locator.getPort()); + server2 = lsRule.startServerVM(2, "", locator.getPort()); + server3 = lsRule.startServerVM(3, "", locator.getPort()); + server4 = lsRule.startServerVM(4, "", locator.getPort()); + + gfsh.connectAndVerify(locator); + } + + @Test + public void testBucketCount() throws InterruptedException { Review comment: The exception is never thrown, it can be deleted. ########## File path: geode-core/src/distributedTest/java/org/apache/geode/management/MemberMXBeanDistributedTest.java ########## @@ -0,0 +1,109 @@ +/* + * 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.management; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; + +import java.io.Serializable; + +import javax.management.ObjectName; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import org.apache.geode.cache.Cache; +import org.apache.geode.distributed.DistributedMember; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.GfshTest; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; + +@Category({GfshTest.class}) +public class MemberMXBeanDistributedTest implements + Serializable { + + private static MemberVM locator, server1, server2, server3, server4; + + @ClassRule + public static ClusterStartupRule lsRule = new ClusterStartupRule(); + + @ClassRule + public static GfshCommandRule gfsh = new GfshCommandRule(); + + @Rule + public TestName testName = new SerializableTestName(); + + @BeforeClass + public static void before() throws Exception { + locator = lsRule.startLocatorVM(0); + server1 = lsRule.startServerVM(1, "", locator.getPort()); + server2 = lsRule.startServerVM(2, "", locator.getPort()); + server3 = lsRule.startServerVM(3, "", locator.getPort()); + server4 = lsRule.startServerVM(4, "", locator.getPort()); + + gfsh.connectAndVerify(locator); + } + + @Test + public void testBucketCount() throws InterruptedException { + String regionName = "testCreateRegion"; + + gfsh.executeAndAssertThat("create region" + + " --name=" + regionName + + " --type=PARTITION_PERSISTENT" + + " --total-num-buckets=1000").statusIsSuccess(); + + gfsh.executeAndAssertThat("query --query=\"select * from /" + regionName + "\"") + .statusIsSuccess(); + + server1.invoke(() -> waitBucketsToInitialize(245)); + server2.invoke(() -> waitBucketsToInitialize(245)); + server3.invoke(() -> waitBucketsToInitialize(245)); + server4.invoke(() -> waitBucketsToInitialize(245)); + + for (int i = 1; i < 4; i++) { + final String tempname = "/" + regionName + i; Review comment: Unused variable, it can be deleted. ########## File path: geode-core/src/distributedTest/java/org/apache/geode/management/MemberMXBeanDistributedTest.java ########## @@ -0,0 +1,109 @@ +/* + * 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.management; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; + +import java.io.Serializable; + +import javax.management.ObjectName; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import org.apache.geode.cache.Cache; +import org.apache.geode.distributed.DistributedMember; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.GfshTest; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; + +@Category({GfshTest.class}) +public class MemberMXBeanDistributedTest implements + Serializable { + + private static MemberVM locator, server1, server2, server3, server4; + + @ClassRule + public static ClusterStartupRule lsRule = new ClusterStartupRule(); + + @ClassRule + public static GfshCommandRule gfsh = new GfshCommandRule(); + + @Rule + public TestName testName = new SerializableTestName(); + + @BeforeClass + public static void before() throws Exception { + locator = lsRule.startLocatorVM(0); + server1 = lsRule.startServerVM(1, "", locator.getPort()); + server2 = lsRule.startServerVM(2, "", locator.getPort()); + server3 = lsRule.startServerVM(3, "", locator.getPort()); + server4 = lsRule.startServerVM(4, "", locator.getPort()); + + gfsh.connectAndVerify(locator); + } + + @Test + public void testBucketCount() throws InterruptedException { + String regionName = "testCreateRegion"; + + gfsh.executeAndAssertThat("create region" + + " --name=" + regionName + + " --type=PARTITION_PERSISTENT" + + " --total-num-buckets=1000").statusIsSuccess(); + + gfsh.executeAndAssertThat("query --query=\"select * from /" + regionName + "\"") + .statusIsSuccess(); Review comment: You don't need to execute the query for buckets to get created, it's easier (and cleaner) to execute `PartitionRegionHelper.assignBucketsToPartitions(Region<?, ?> region)`. You can have a look at `PartitionedRegionAttributesMutatorDUnitTest` for examples. ########## File path: geode-core/src/distributedTest/java/org/apache/geode/management/MemberMXBeanDistributedTest.java ########## @@ -0,0 +1,109 @@ +/* + * 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.management; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; + +import java.io.Serializable; + +import javax.management.ObjectName; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; + +import org.apache.geode.cache.Cache; +import org.apache.geode.distributed.DistributedMember; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.GfshTest; +import org.apache.geode.test.junit.rules.GfshCommandRule; +import org.apache.geode.test.junit.rules.serializable.SerializableTestName; + +@Category({GfshTest.class}) +public class MemberMXBeanDistributedTest implements Review comment: The test might become flaky due to the assertions used (`waitBucketsToInitialize(X)` -> `getTotalBucketCount() >= X`). Maybe it's better to assert the total number of buckets instead?. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Total bucket and total primary bucket count per server is incorrect > ------------------------------------------------------------------- > > Key: GEODE-7963 > URL: https://issues.apache.org/jira/browse/GEODE-7963 > Project: Geode > Issue Type: Bug > Components: gfsh, statistics > Reporter: Mario Kevo > Assignee: Mario Ivanac > Priority: Major > Labels: needs-review, pull-request-available > Attachments: showMetricsCommand.txt > > > If we have more buckets per region than default value is_, show metrics_ > command per server has wrong stats for *totalBucketCount* and > *totalPrimaryCount*. Number of buckets is good if _show metric_s is executed > region by region per server. > It looks like it doesn't take last updated results when print output. > After last bucket are created it increase these two values but in output we > have a value before that increase. > To reproduce an issue: > # Run locator and 4 servers. > # create partition persistent region with total-num-buckets more than > default value > # do query (_query --query="select * from /region1"_) > # Repeat steps 2. and 3. to create and query more regions > # see result of show metrics per server and region by region per server -- This message was sent by Atlassian Jira (v8.3.4#803005)