You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/02/26 09:16:47 UTC
[GitHub] [ignite] x-kreator opened a new pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
x-kreator opened a new pull request #8832:
URL: https://github.com/apache/ignite/pull/8832
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
### The Contribution Checklist
- [ ] There is a single JIRA ticket related to the pull request.
- [ ] The web-link to the pull request is attached to the JIRA ticket.
- [ ] The JIRA ticket has the _Patch Available_ state.
- [ ] The pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
- [ ] The pull request title is treated as the final commit message.
The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r583507980
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
Review comment:
The better case is to provide type (factory/generator) via test params with some default.
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+ node_count = initial_node_count
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ node_count -= 1
+
+ ignites = IgniteService(self.test_context, config=node_config, num_nodes=node_count)
+ ignites.start()
+
+ ignite = IgniteService(self.test_context, node_config._replace(discovery_spi=from_ignite_cluster(ignites)),
+ num_nodes=1)
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ ignite.start()
Review comment:
you may just start enough nodes count by ignites.start(), which is faster than starting some and 1 after, and stop node by index.
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
Review comment:
Is this generate DataModel?
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
Review comment:
We're not triggering event here, we're starting or stopping node which causes the rebalance :)
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
Review comment:
Use a test-related package instead.
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+ node_count = initial_node_count
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ node_count -= 1
+
+ ignites = IgniteService(self.test_context, config=node_config, num_nodes=node_count)
+ ignites.start()
+
+ ignite = IgniteService(self.test_context, node_config._replace(discovery_spi=from_ignite_cluster(ignites)),
+ num_nodes=1)
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ ignite.start()
+
+ # This client just put some data to the cache.
+ app_config = node_config._replace(client_mode=True, discovery_spi=from_ignite_cluster(ignites))
Review comment:
variable with single usage should be inlined
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
Review comment:
The better case is to use naming from AI.
JOIN/LEFT
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
Review comment:
Looks like a better case is to have data region settings instead of the magic enum values.
Let's have two tests instead? BTW, avoid code duplication if possible.
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
Review comment:
Looks like 60 second is not enough for real testing.
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+ node_count = initial_node_count
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ node_count -= 1
+
+ ignites = IgniteService(self.test_context, config=node_config, num_nodes=node_count)
+ ignites.start()
+
+ ignite = IgniteService(self.test_context, node_config._replace(discovery_spi=from_ignite_cluster(ignites)),
+ num_nodes=1)
Review comment:
should be relocated to if's body
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
Review comment:
AFAIR, we may avoid explicit IgniteVersion creation here.
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
Review comment:
should this replace add_node_rebalance_test.py?
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cache.getName())) {
+ for (int i = 0; i < entryCnt; i++) {
+ stmr.addData(i, newDataModel(entrySize));
+
+ if (i % 10_000 == 0)
+ log.info("Streamed " + i + " entries");
+ }
+ }
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private DataModel newDataModel(int payloadSize) {
+ String randomStr = UUID.randomUUID().toString();
+
+ byte[] payload = new byte[payloadSize - randomStr.length()];
+
+ ThreadLocalRandom.current().nextBytes(payload);
Review comment:
Not sure it's necessary to fill data with random values.
Random strings theoretically may affect rebalance speed because of JVM optimizations.
But, byte array content may be just nulls?
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594419599
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance/in_memory_test.py
##########
@@ -0,0 +1,103 @@
+# 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.
+
+"""
+Module contains in-memory rebalance tests.
+"""
+from enum import IntEnum
+
+from ducktape.mark import defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration, DataStorageConfiguration
+from ignitetest.services.utils.ignite_configuration.data_storage import DataRegionConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.tests.rebalance import preload_data, await_rebalance_start, await_rebalance_complete
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_JOIN = 0
+ NODE_LEFT = 1
+
+
+# pylint: disable=W0223
+class RebalanceInMemoryTest(IgniteTest):
+ """
+ Tests rebalance scenarios in in-memory mode.
+ """
+ NUM_NODES = 4
+
+ # pylint: disable=too-many-arguments, too-many-locals
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(trigger_event=[TriggerEvent.NODE_JOIN, TriggerEvent.NODE_LEFT],
+ backups=[1], cache_count=[1], entry_count=[15000], entry_size=[50000],
+ rebalance_thread_pool_size=[None], rebalance_batch_size=[None],
+ rebalance_batches_prefetch_count=[None], rebalance_throttle=[None])
+ def test(self, ignite_version, trigger_event,
+ backups, cache_count, entry_count, entry_size,
+ rebalance_thread_pool_size, rebalance_batch_size,
+ rebalance_batches_prefetch_count, rebalance_throttle):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event and awaits for rebalance to finish.
+ """
+ node_count = len(self.test_context.cluster) - 1
+
+ node_config = IgniteConfiguration(
+ version=IgniteVersion(ignite_version),
+ data_storage=DataStorageConfiguration(
+ default=DataRegionConfiguration(max_size=max(
+ cache_count * entry_count * entry_size * (backups + 1),
+ 512 * 1024 * 1024))),
Review comment:
Please, make a constant here `_512_MB` or `DEFAULT_DATA_REGION_SZ`
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594397391
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
Review comment:
Why do we need this message? AFAIK next line output something similar.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594426140
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594391110
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
Review comment:
Please, add javadoc.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594428850
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585265406
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+ node_count = initial_node_count
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ node_count -= 1
+
+ ignites = IgniteService(self.test_context, config=node_config, num_nodes=node_count)
+ ignites.start()
+
+ ignite = IgniteService(self.test_context, node_config._replace(discovery_spi=from_ignite_cluster(ignites)),
+ num_nodes=1)
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585264415
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
Review comment:
Can you point me to code example?
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585258527
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594397935
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
Review comment:
Can we use several threads here?
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594331412
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cache.getName())) {
+ for (int i = 0; i < entryCnt; i++) {
+ stmr.addData(i, newDataModel(entrySize));
+
+ if (i % 10_000 == 0)
+ log.info("Streamed " + i + " entries");
+ }
+ }
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private DataModel newDataModel(int payloadSize) {
+ String randomStr = UUID.randomUUID().toString();
+
+ byte[] payload = new byte[payloadSize - randomStr.length()];
+
+ ThreadLocalRandom.current().nextBytes(payload);
Review comment:
@nizhikov, any reason to spend time on this?
Random data may provide random results, a better case is to have the exact same data each time.
Incremental keys with the same values seem to be a good choice.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585259439
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594426826
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594409758
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCacheData(String cacheName, int entryCnt, int entrySize) {
+ int logStreamedEntriesQuant = (int)Math.pow(10, (int)Math.log10(entryCnt) - 1);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cacheName)) {
+ for (int i = 0, n = 0; i < entryCnt; i++) {
+ stmr.addData(i, new DataModel(entrySize));
+
+ int streamed = i + 1;
+
+ if (streamed % logStreamedEntriesQuant == 0)
+ log.info("Streamed " + streamed + " entries into " + cacheName);
+
+ n += entrySize;
+
+ if (n >= MAX_STREAMER_DATA_SIZE) {
+ n = 0;
+
+ stmr.flush();
+ }
+ }
+ }
+
+ if (entryCnt % logStreamedEntriesQuant != 0)
+ log.info("Streamed " + entryCnt + " entries into " + cacheName);
+
+ log.info(cacheName + " data generated.");
+ }
+
+ /**
+ *
Review comment:
Please, add JavaDoc.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594453533
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
Review comment:
https://issues.apache.org/jira/browse/IGNITE-14319
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#issuecomment-799497064
@x-kreator Please, resolve my comments and rerun tests.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594466286
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCacheData(String cacheName, int entryCnt, int entrySize) {
+ int logStreamedEntriesQuant = (int)Math.pow(10, (int)Math.log10(entryCnt) - 1);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cacheName)) {
+ for (int i = 0, n = 0; i < entryCnt; i++) {
+ stmr.addData(i, new DataModel(entrySize));
+
+ int streamed = i + 1;
+
+ if (streamed % logStreamedEntriesQuant == 0)
+ log.info("Streamed " + streamed + " entries into " + cacheName);
+
+ n += entrySize;
+
+ if (n >= MAX_STREAMER_DATA_SIZE) {
+ n = 0;
+
+ stmr.flush();
+ }
+ }
+ }
+
+ if (entryCnt % logStreamedEntriesQuant != 0)
+ log.info("Streamed " + entryCnt + " entries into " + cacheName);
+
+ log.info(cacheName + " data generated.");
+ }
+
+ /**
+ *
+ */
+ private static class DataModel {
+ /** Cached payload. */
+ private static byte[] cachedPayload;
+
+ /** Payload. */
+ final byte[] payload;
+
+ /**
+ * @param entrySize Entry size.
+ */
+ DataModel(int entrySize) {
+ payload = getPayload(entrySize);
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private static byte[] getPayload(int payloadSize) {
+ if (cachedPayload == null || cachedPayload.length != payloadSize) {
+ cachedPayload = new byte[payloadSize];
+
+ new Random(42).nextBytes(cachedPayload);
Review comment:
Using Random instance with constant seed guarantees that data will be same for all runs.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585265486
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+ node_count = initial_node_count
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ node_count -= 1
+
+ ignites = IgniteService(self.test_context, config=node_config, num_nodes=node_count)
+ ignites.start()
+
+ ignite = IgniteService(self.test_context, node_config._replace(discovery_spi=from_ignite_cluster(ignites)),
+ num_nodes=1)
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ ignite.start()
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594371384
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cache.getName())) {
+ for (int i = 0; i < entryCnt; i++) {
+ stmr.addData(i, newDataModel(entrySize));
+
+ if (i % 10_000 == 0)
+ log.info("Streamed " + i + " entries");
+ }
+ }
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private DataModel newDataModel(int payloadSize) {
+ String randomStr = UUID.randomUUID().toString();
+
+ byte[] payload = new byte[payloadSize - randomStr.length()];
+
+ ThreadLocalRandom.current().nextBytes(payload);
Review comment:
random test results can be only with the random data size of similar.
Random content shouldn't be related to rebalancing time (and if it does, it will be a great result of this test).
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov merged pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov merged pull request #8832:
URL: https://github.com/apache/ignite/pull/8832
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594429451
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCacheData(String cacheName, int entryCnt, int entrySize) {
+ int logStreamedEntriesQuant = (int)Math.pow(10, (int)Math.log10(entryCnt) - 1);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cacheName)) {
+ for (int i = 0, n = 0; i < entryCnt; i++) {
+ stmr.addData(i, new DataModel(entrySize));
+
+ int streamed = i + 1;
+
+ if (streamed % logStreamedEntriesQuant == 0)
+ log.info("Streamed " + streamed + " entries into " + cacheName);
+
+ n += entrySize;
+
+ if (n >= MAX_STREAMER_DATA_SIZE) {
+ n = 0;
+
+ stmr.flush();
+ }
+ }
+ }
+
+ if (entryCnt % logStreamedEntriesQuant != 0)
+ log.info("Streamed " + entryCnt + " entries into " + cacheName);
+
+ log.info(cacheName + " data generated.");
+ }
+
+ /**
+ *
+ */
+ private static class DataModel {
+ /** Cached payload. */
+ private static byte[] cachedPayload;
+
+ /** Payload. */
+ final byte[] payload;
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585258144
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
Review comment:
No, it's just generates the data by DataModel, renamed to DataGenerationApplication and moved to test related package.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585265597
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
+ """
+ Tests rebalance scenarios.
+ """
+ NUM_NODES = 10
+ PRELOAD_TIMEOUT = 60
+ REBALANCE_TIMEOUT = 60
+
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(initial_node_count=[2, 4, 8],
+ trigger_event=[TriggerEvent.NODE_ENTER, TriggerEvent.NODE_LEAVE],
+ mode=[Mode.IN_MEMORY], cache_count=[1], entry_count=[10000], entry_size=[1000])
+ def test_rebalance(self, ignite_version, initial_node_count, trigger_event,
+ mode, cache_count, entry_count, entry_size):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event (node enter or leave) and awaits for rebalance to finish.
+ """
+ node_config = IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+ node_count = initial_node_count
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ node_count -= 1
+
+ ignites = IgniteService(self.test_context, config=node_config, num_nodes=node_count)
+ ignites.start()
+
+ ignite = IgniteService(self.test_context, node_config._replace(discovery_spi=from_ignite_cluster(ignites)),
+ num_nodes=1)
+ if trigger_event is TriggerEvent.NODE_LEAVE:
+ ignite.start()
+
+ # This client just put some data to the cache.
+ app_config = node_config._replace(client_mode=True, discovery_spi=from_ignite_cluster(ignites))
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594401009
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
Review comment:
Let's use getOrCreateCache here.
For a case target cache would be statically configured.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594410737
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCacheData(String cacheName, int entryCnt, int entrySize) {
+ int logStreamedEntriesQuant = (int)Math.pow(10, (int)Math.log10(entryCnt) - 1);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cacheName)) {
+ for (int i = 0, n = 0; i < entryCnt; i++) {
+ stmr.addData(i, new DataModel(entrySize));
+
+ int streamed = i + 1;
+
+ if (streamed % logStreamedEntriesQuant == 0)
+ log.info("Streamed " + streamed + " entries into " + cacheName);
+
+ n += entrySize;
+
+ if (n >= MAX_STREAMER_DATA_SIZE) {
+ n = 0;
+
+ stmr.flush();
+ }
+ }
+ }
+
+ if (entryCnt % logStreamedEntriesQuant != 0)
+ log.info("Streamed " + entryCnt + " entries into " + cacheName);
+
+ log.info(cacheName + " data generated.");
+ }
+
+ /**
+ *
+ */
+ private static class DataModel {
+ /** Cached payload. */
+ private static byte[] cachedPayload;
+
+ /** Payload. */
+ final byte[] payload;
Review comment:
please, make it private.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594418566
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance/in_memory_test.py
##########
@@ -0,0 +1,103 @@
+# 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.
+
+"""
+Module contains in-memory rebalance tests.
+"""
+from enum import IntEnum
+
+from ducktape.mark import defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration, DataStorageConfiguration
+from ignitetest.services.utils.ignite_configuration.data_storage import DataRegionConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.tests.rebalance import preload_data, await_rebalance_start, await_rebalance_complete
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_JOIN = 0
+ NODE_LEFT = 1
+
+
+# pylint: disable=W0223
+class RebalanceInMemoryTest(IgniteTest):
+ """
+ Tests rebalance scenarios in in-memory mode.
+ """
+ NUM_NODES = 4
+
+ # pylint: disable=too-many-arguments, too-many-locals
+ @cluster(num_nodes=NUM_NODES)
+ @ignite_versions(str(DEV_BRANCH), str(LATEST))
+ @defaults(trigger_event=[TriggerEvent.NODE_JOIN, TriggerEvent.NODE_LEFT],
+ backups=[1], cache_count=[1], entry_count=[15000], entry_size=[50000],
+ rebalance_thread_pool_size=[None], rebalance_batch_size=[None],
+ rebalance_batches_prefetch_count=[None], rebalance_throttle=[None])
+ def test(self, ignite_version, trigger_event,
+ backups, cache_count, entry_count, entry_size,
+ rebalance_thread_pool_size, rebalance_batch_size,
+ rebalance_batches_prefetch_count, rebalance_throttle):
+ """
+ Test performs rebalance test which consists of following steps:
+ * Start cluster.
+ * Put data to it via IgniteClientApp.
+ * Triggering a rebalance event and awaits for rebalance to finish.
+ """
+ node_count = len(self.test_context.cluster) - 1
Review comment:
We should use all nodes in case NODE_LEFT event. Isn't 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594410586
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCacheData(String cacheName, int entryCnt, int entrySize) {
+ int logStreamedEntriesQuant = (int)Math.pow(10, (int)Math.log10(entryCnt) - 1);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cacheName)) {
+ for (int i = 0, n = 0; i < entryCnt; i++) {
+ stmr.addData(i, new DataModel(entrySize));
+
+ int streamed = i + 1;
+
+ if (streamed % logStreamedEntriesQuant == 0)
+ log.info("Streamed " + streamed + " entries into " + cacheName);
+
+ n += entrySize;
+
+ if (n >= MAX_STREAMER_DATA_SIZE) {
+ n = 0;
+
+ stmr.flush();
+ }
+ }
+ }
+
+ if (entryCnt % logStreamedEntriesQuant != 0)
+ log.info("Streamed " + entryCnt + " entries into " + cacheName);
+
+ log.info(cacheName + " data generated.");
+ }
+
+ /**
+ *
+ */
+ private static class DataModel {
+ /** Cached payload. */
+ private static byte[] cachedPayload;
+
+ /** Payload. */
+ final byte[] payload;
+
+ /**
+ * @param entrySize Entry size.
+ */
+ DataModel(int entrySize) {
+ payload = getPayload(entrySize);
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private static byte[] getPayload(int payloadSize) {
+ if (cachedPayload == null || cachedPayload.length != payloadSize) {
+ cachedPayload = new byte[payloadSize];
+
+ new Random(42).nextBytes(cachedPayload);
Review comment:
Please, use `ThreadLocalRandom` here.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585265657
##########
File path: modules/ducktests/tests/ignitetest/tests/rebalance_test.py
##########
@@ -0,0 +1,112 @@
+# 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.
+
+"""
+Module contains rebalance tests.
+"""
+
+from enum import IntEnum
+
+from ducktape.mark import matrix, defaults
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.utils import cluster, ignite_versions
+from ignitetest.utils.enum import constructible
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST
+
+
+@constructible
+class Mode(IntEnum):
+ """
+ Rebalance mode.
+ """
+ IN_MEMORY = 0
+ PERSISTENT = 1
+
+
+@constructible
+class TriggerEvent(IntEnum):
+ """
+ Rebalance trigger event.
+ """
+ NODE_ENTER = 0
+ NODE_LEAVE = 1
+
+
+# pylint: disable=W0223
+class RebalanceTest(IgniteTest):
Review comment:
Yes, done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594371384
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cache.getName())) {
+ for (int i = 0; i < entryCnt; i++) {
+ stmr.addData(i, newDataModel(entrySize));
+
+ if (i % 10_000 == 0)
+ log.info("Streamed " + i + " entries");
+ }
+ }
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private DataModel newDataModel(int payloadSize) {
+ String randomStr = UUID.randomUUID().toString();
+
+ byte[] payload = new byte[payloadSize - randomStr.length()];
+
+ ThreadLocalRandom.current().nextBytes(payload);
Review comment:
random results can be only with the random data size of similar.
Random content shouldn't be related to rebalancing time (and if it does, it will be a great result of this test).
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594448120
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/rebalance/DataGenerationApplication.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.ignite.internal.ducktest.tests.rebalance;
+
+import java.util.Random;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataGenerationApplication extends IgniteAwareApplication {
+ /** Max streamer data size. */
+ private static final long MAX_STREAMER_DATA_SIZE = 100_000_000;
+
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int backups = jsonNode.get("backups").asInt();
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Data generation started [backups=" + backups + ", cacheCount=" + cacheCnt
+ + ", entryCount=" + entryCnt + ", entrySize=" + entrySize + "]");
+
+ for (int i = 1; i <= cacheCnt; i++) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache(
+ new CacheConfiguration<Integer, DataModel>("test-cache-" + i)
+ .setBackups(backups));
+
+ generateCacheData(cache.getName(), entryCnt, entrySize);
+ }
+
+ log.info("Data generation finished.");
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCacheData(String cacheName, int entryCnt, int entrySize) {
+ int logStreamedEntriesQuant = (int)Math.pow(10, (int)Math.log10(entryCnt) - 1);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cacheName)) {
+ for (int i = 0, n = 0; i < entryCnt; i++) {
+ stmr.addData(i, new DataModel(entrySize));
+
+ int streamed = i + 1;
+
+ if (streamed % logStreamedEntriesQuant == 0)
+ log.info("Streamed " + streamed + " entries into " + cacheName);
+
+ n += entrySize;
+
+ if (n >= MAX_STREAMER_DATA_SIZE) {
+ n = 0;
+
+ stmr.flush();
+ }
+ }
+ }
+
+ if (entryCnt % logStreamedEntriesQuant != 0)
+ log.info("Streamed " + entryCnt + " entries into " + cacheName);
+
+ log.info(cacheName + " data generated.");
+ }
+
+ /**
+ *
Review comment:
done.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] x-kreator commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
x-kreator commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r585288284
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cache.getName())) {
+ for (int i = 0; i < entryCnt; i++) {
+ stmr.addData(i, newDataModel(entrySize));
+
+ if (i % 10_000 == 0)
+ log.info("Streamed " + i + " entries");
+ }
+ }
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private DataModel newDataModel(int payloadSize) {
+ String randomStr = UUID.randomUUID().toString();
+
+ byte[] payload = new byte[payloadSize - randomStr.length()];
+
+ ThreadLocalRandom.current().nextBytes(payload);
Review comment:
Can a compaction of null filled byte arrays affect rebalance speed too?
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [ignite] nizhikov commented on a change in pull request #8832: IGNITE-14228 Ducktape test of rebalance for in-memory mode
Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8832:
URL: https://github.com/apache/ignite/pull/8832#discussion_r594178708
##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/DataModelGenerationApplication.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.ducktest.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *
+ */
+public class DataModelGenerationApplication extends IgniteAwareApplication {
+ /** {@inheritDoc} */
+ @Override protected void run(JsonNode jsonNode) throws Exception {
+ int cacheCnt = jsonNode.get("cacheCount").asInt();
+ int entryCnt = jsonNode.get("entryCount").asInt();
+ int entrySize = jsonNode.get("entrySize").asInt();
+
+ log.info("Creating " + cacheCnt + " caches each with " + entryCnt + " entries of " + entrySize + " bytes.");
+
+ for (int i = 1; i <= cacheCnt; i++)
+ generateCache(i, entryCnt, entrySize);
+
+ markSyncExecutionComplete();
+ }
+
+ /**
+ * @param cacheNo Cache number.
+ * @param entryCnt Entry count.
+ * @param entrySize Entry size.
+ */
+ private void generateCache(int cacheNo, int entryCnt, int entrySize) {
+ IgniteCache<Integer, DataModel> cache = ignite.createCache("test-cache-" + cacheNo);
+
+ try (IgniteDataStreamer<Integer, DataModel> stmr = ignite.dataStreamer(cache.getName())) {
+ for (int i = 0; i < entryCnt; i++) {
+ stmr.addData(i, newDataModel(entrySize));
+
+ if (i % 10_000 == 0)
+ log.info("Streamed " + i + " entries");
+ }
+ }
+ }
+
+ /**
+ * @param payloadSize Payload size.
+ */
+ private DataModel newDataModel(int payloadSize) {
+ String randomStr = UUID.randomUUID().toString();
+
+ byte[] payload = new byte[payloadSize - randomStr.length()];
+
+ ThreadLocalRandom.current().nextBytes(payload);
Review comment:
I think we should go with the array that contains some random data not just nulls.
----------------------------------------------------------------
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:
users@infra.apache.org