Sega76 commented on a change in pull request #8385:
URL: https://github.com/apache/ignite/pull/8385#discussion_r586420111



##########
File path: 
modules/ducktests/tests/ignitetest/tests/two_phased_rebalanced_test.py
##########
@@ -0,0 +1,298 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module contains Cellular Affinity tests.
+"""
+from typing import List
+from ducktape import errors
+from ducktape.cluster.cluster import ClusterNode
+from ducktape.mark.resource import cluster
+from ignitetest.services.utils.ignite_aware import IgniteAwareService
+
+from ignitetest.services.utils.ignite_configuration.cache import 
CacheConfiguration, Affinity
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.control_utility import ControlUtility
+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.services.utils.util import copy_file_to_dest
+from ignitetest.utils import ignite_versions
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import IgniteVersion, DEV_BRANCH, LATEST_2_9, 
LATEST_2_8
+
+NUM_NODES_CELL = 4
+
+NUM_CELL = 4
+
+ATTRIBUTE = "CELL"
+
+CACHE_NAME = "test-cache"
+
+
+# pylint: disable=W0223
+class TwoPhasedRebalancedTest(IgniteTest):
+    """
+    Two-phase rebalancing test case.
+    """
+    # pylint: disable=R0914
+    @cluster(num_nodes=NUM_NODES_CELL * NUM_CELL + 2)
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_9), str(LATEST_2_8))
+    def two_phased_rebalancing_test(self, ignite_version):
+        """
+        Test case of two-phase rebalancing.
+        Preparations.
+            1. Start 4 cells.
+            2. Load data to cache with the mentioned above affinity function 
and fix PDS size on all nodes.
+            3. Delete 80% of data and fix PDS size on all nodes.
+        Phase 1.
+            1. Stop two nodes in each cell, total a half of all nodes and 
clean PDS.
+            2. Start cleaned node with preservance of consistent id and cell 
attributes.
+            3. Wait for the rebalance to complete.
+        Phase 2.
+            Run steps 1-3 of Phase 2 on the other half of the cluster.
+        Verifications.
+            1. Check that PDS size reduced (compare to step 3)
+            2. Check data consistency (idle_verify --dump)
+        """
+        config = IgniteConfiguration(version=IgniteVersion(ignite_version),
+                                     data_storage=DataStorageConfiguration(
+                                         
default=DataRegionConfiguration(persistent=True), checkpoint_frequency=30000),
+                                     caches=[CacheConfiguration(
+                                         name=CACHE_NAME, 
backups=NUM_NODES_CELL-1, affinity=Affinity())],
+                                     
metric_exporter='org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi')
+
+        cells = self.start_cells(config)
+
+        control_utility = ControlUtility(cells[0])
+        control_utility.activate()
+
+        client_config = IgniteConfiguration(client_mode=True,
+                                            
version=IgniteVersion(ignite_version),
+                                            
discovery_spi=from_ignite_cluster(cells[0]))
+
+        streamer = IgniteApplicationService(
+            self.test_context,
+            client_config,
+            
java_class_name="org.apache.ignite.internal.ducktest.tests.snapshot_test.DataLoaderApplication",
+            params={"start": 0,
+                    "cacheName": "test-cache",
+                    "interval": 500 * 1024,
+                    "valueSizeKb": 1}
+        )
+
+        deleter = IgniteApplicationService(
+            self.test_context,
+            client_config,
+            
java_class_name="org.apache.ignite.internal.ducktest.tests.DeleteDataApplication",
+            shutdown_timeout_sec=15 * 60,
+            params={"cacheName": "test-cache",
+                    "size": 400 * 1024})
+
+        streamer.run()
+
+        node = cells[0].nodes[0]
+
+        self.await_skipping_checkpoint(node)
+
+        self.fix_pds_size(cells, "Step prepare, load data. PDS.")
+
+        deleter.run()
+
+        self.await_skipping_checkpoint(node)
+
+        dump_1 = fix_data(control_utility, node, cells[0].log_dir)
+
+        pds_before = self.fix_pds_size(cells, "After Delete 80%, PDS.")
+
+        restart_with_clean_idx_node_on_cell(cells, [0, 1])
+
+        self.fix_pds_size(cells, "After rebalancing complate on nodes 0, 1. 
PDS.")

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:
[email protected]


Reply via email to