anton-vinogradov commented on a change in pull request #8575: URL: https://github.com/apache/ignite/pull/8575#discussion_r561957476
########## File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/snapshot_test/UuidDataLoaderApplication.java ########## @@ -0,0 +1,46 @@ +/* + * 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.snapshot_test; + +import java.util.UUID; +import com.fasterxml.jackson.databind.JsonNode; +import org.apache.ignite.IgniteDataStreamer; +import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication; + +/** + * Loading random uuids to cache. + */ +public class UuidDataLoaderApplication extends IgniteAwareApplication { + /** {@inheritDoc} */ + @Override public void run(JsonNode jNode) { + String cacheName = jNode.get("cacheName").asText(); + + long size = jNode.get("size").asLong(); Review comment: On, now we have "amount". Amount of what? ########## File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/snapshot_test/UuidDataLoaderApplication.java ########## @@ -0,0 +1,46 @@ +/* + * 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.snapshot_test; + +import java.util.UUID; +import com.fasterxml.jackson.databind.JsonNode; +import org.apache.ignite.IgniteDataStreamer; +import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication; + +/** + * Loading random uuids to cache. + */ +public class UuidDataLoaderApplication extends IgniteAwareApplication { + /** {@inheritDoc} */ + @Override public void run(JsonNode jNode) { + String cacheName = jNode.get("cacheName").asText(); + + long size = jNode.get("size").asLong(); + + int dataSize = jNode.get("dataSize").asInt(); + + markInitialized(); Review comment:  Line 87 is empty. ########## File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/snapshot_test/UuidDataLoaderApplication.java ########## @@ -0,0 +1,46 @@ +/* + * 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.snapshot_test; + +import java.util.UUID; +import com.fasterxml.jackson.databind.JsonNode; +import org.apache.ignite.IgniteDataStreamer; +import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication; + +/** + * Loading random uuids to cache. + */ +public class UuidDataLoaderApplication extends IgniteAwareApplication { + /** {@inheritDoc} */ + @Override public void run(JsonNode jNode) { + String cacheName = jNode.get("cacheName").asText(); + + long size = jNode.get("size").asLong(); + + int dataSize = jNode.get("dataSize").asInt(); + + markInitialized(); Review comment: Let me ask again, what is the reason to have dedicated "initialized" and "finished" states? Why not only the markSyncExecutionComplete() used? ########## File path: modules/ducktests/tests/ignitetest/services/utils/control_utility.py ########## @@ -127,6 +131,65 @@ def tx_kill(self, **kwargs): res = self.__parse_tx_list(output) return res if res else output + def validate_indexes(self): + """ + Validate indexes. + """ + data = self.__run("--cache validate_indexes") + + assert ('no issues found.' in data), data + + def idle_verify(self): + """ + Idle verify. + """ + data = self.__run("--cache idle_verify") + + assert ('idle_verify check has finished, no conflicts have been found.' in data), data + + def idle_verify_dump(self, node=None): + """ + Idle verify dump. Review comment: "Node where will be dump file" Could you please specify an action in this sentence? ########## File path: modules/ducktests/tests/ignitetest/services/utils/control_utility.py ########## @@ -127,6 +131,65 @@ def tx_kill(self, **kwargs): res = self.__parse_tx_list(output) return res if res else output + def validate_indexes(self): + """ + Validate indexes. + """ + data = self.__run("--cache validate_indexes") + + assert ('no issues found.' in data), data + + def idle_verify(self): + """ + Idle verify. + """ + data = self.__run("--cache idle_verify") + + assert ('idle_verify check has finished, no conflicts have been found.' in data), data + + def idle_verify_dump(self, node=None): + """ + Idle verify dump. + """ + data = self.__run("--cache idle_verify --dump", node=node) + + assert ('VisorIdleVerifyDumpTask successfully' in data), data + + return re.search(r'/.*.txt', data).group(0) + + def snapshot_create(self, snapshot_name: str, sync_mode: bool = True, timeout_sec: int = 60): Review comment: Could you please answer my questions? ########## File path: modules/ducktests/tests/ignitetest/services/utils/control_utility.py ########## @@ -127,6 +131,65 @@ def tx_kill(self, **kwargs): res = self.__parse_tx_list(output) return res if res else output + def validate_indexes(self): + """ + Validate indexes. + """ + data = self.__run("--cache validate_indexes") + + assert ('no issues found.' in data), data + + def idle_verify(self): + """ + Idle verify. + """ + data = self.__run("--cache idle_verify") + + assert ('idle_verify check has finished, no conflicts have been found.' in data), data + + def idle_verify_dump(self, node=None): + """ + Idle verify dump. + """ + data = self.__run("--cache idle_verify --dump", node=node) + + assert ('VisorIdleVerifyDumpTask successfully' in data), data + + return re.search(r'/.*.txt', data).group(0) + + def snapshot_create(self, snapshot_name: str, sync_mode: bool = True, timeout_sec: int = 60): + """ + Create snapshot. + """ + res = self.__run(f"--snapshot create {snapshot_name}") + + if ("Command [SNAPSHOT] finished with code: 0" in res) & sync_mode: + self.await_snapshot(snapshot_name, timeout_sec) + + def await_snapshot(self, snapshot_name: str, timeout_sec=60): + """ + Waiting for the snapshot to complete. + """ + delta_time = datetime.now() + timedelta(seconds=timeout_sec) + + while datetime.now() < delta_time: + for node in self._cluster.nodes: + mbean = JmxClient(node).find_mbean('snapshot') + start_time = int(list(mbean.LastSnapshotStartTime)[0]) + end_time = int(list(mbean.LastSnapshotEndTime)[0]) + err_msg = list(mbean.LastSnapshotErrorMessage)[0] + name = list(mbean.LastSnapshotName)[0] + + if (snapshot_name == name) and (0 < start_time < end_time) and (err_msg == ''): Review comment: 1. Suggest answering the question. 2. That's the exact situation I'm talking about. Another snapshot in progress means we doing something wrong. ########## File path: modules/ducktests/tests/ignitetest/services/utils/control_utility.py ########## @@ -127,6 +131,65 @@ def tx_kill(self, **kwargs): res = self.__parse_tx_list(output) return res if res else output + def validate_indexes(self): + """ + Validate indexes. + """ + data = self.__run("--cache validate_indexes") + + assert ('no issues found.' in data), data + + def idle_verify(self): + """ + Idle verify. + """ + data = self.__run("--cache idle_verify") + + assert ('idle_verify check has finished, no conflicts have been found.' in data), data + + def idle_verify_dump(self, node=None): + """ + Idle verify dump. + """ + data = self.__run("--cache idle_verify --dump", node=node) + + assert ('VisorIdleVerifyDumpTask successfully' in data), data + + return re.search(r'/.*.txt', data).group(0) + + def snapshot_create(self, snapshot_name: str, sync_mode: bool = True, timeout_sec: int = 60): + """ + Create snapshot. + """ + res = self.__run(f"--snapshot create {snapshot_name}") + + if ("Command [SNAPSHOT] finished with code: 0" in res) & sync_mode: + self.await_snapshot(snapshot_name, timeout_sec) + + def await_snapshot(self, snapshot_name: str, timeout_sec=60): + """ + Waiting for the snapshot to complete. + """ + delta_time = datetime.now() + timedelta(seconds=timeout_sec) + + while datetime.now() < delta_time: + for node in self._cluster.nodes: + mbean = JmxClient(node).find_mbean('snapshot') + start_time = int(list(mbean.LastSnapshotStartTime)[0]) + end_time = int(list(mbean.LastSnapshotEndTime)[0]) + err_msg = list(mbean.LastSnapshotErrorMessage)[0] + name = list(mbean.LastSnapshotName)[0] + + if (snapshot_name == name) and (0 < start_time < end_time) and (err_msg == ''): + return + + time.sleep(1) + + raise TimeoutError(f'LastSnapshotName={name}, ' + f'LastSnapshotStartTime={start_time}, ' + f'LastSnapshotEndTime={end_time}, ' + f'LastSnapshotErrorMessage={err_msg}') Review comment: Did not understand the answer. ########## File path: modules/ducktests/tests/ignitetest/services/utils/control_utility.py ########## @@ -248,12 +311,15 @@ def __parse_cluster_state(output): return ClusterState(state=state, topology_version=topology, baseline=baseline) - def __run(self, cmd): - node = random.choice(self.__alives()) + def __run(self, cmd, node=None): + if node is None: + node = random.choice(self.__alives()) self.logger.debug(f"Run command {cmd} on node {node.name}") - raw_output = node.account.ssh_capture(self.__form_cmd(node, cmd), allow_fail=True) + node_ip = socket.gethostbyname(node.account.hostname) Review comment: >> node.account.externally_routable_ip is hostname so, what the difference between "hostname" (node.account.externally_routable_ip) and node.account.hostname? ########## File path: modules/ducktests/tests/ignitetest/services/utils/control_utility.py ########## @@ -248,12 +311,15 @@ def __parse_cluster_state(output): return ClusterState(state=state, topology_version=topology, baseline=baseline) - def __run(self, cmd): - node = random.choice(self.__alives()) + def __run(self, cmd, node=None): + if node is None: + node = random.choice(self.__alives()) self.logger.debug(f"Run command {cmd} on node {node.name}") - raw_output = node.account.ssh_capture(self.__form_cmd(node, cmd), allow_fail=True) + node_ip = socket.gethostbyname(node.account.hostname) Review comment: > node.account.externally_routable_ip is hostname so, what the difference between "hostname" (node.account.externally_routable_ip) and node.account.hostname? ########## File path: modules/ducktests/tests/ignitetest/tests/suites/slow_suite.yml ########## @@ -15,3 +15,6 @@ discovery: - ../discovery_test.py + +snapshot: + - ../snapshot_test.py Review comment: Do we really need so long checks? Why it takes so long? Do we check snapshots properly? Why Dev is so slow? @Mmuzaf Could you please check this? Seems we have Dev 5 times slower than 2.9.0 ########## File path: modules/ducktests/tests/ignitetest/tests/snapshot_test.py ########## @@ -0,0 +1,119 @@ +# 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 snapshot test. +""" +from ducktape.mark.resource import cluster + +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.cache import CacheConfiguration +from ignitetest.services.utils.ignite_configuration.data_storage import DataRegionConfiguration +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +from ignitetest.utils import ignite_versions +from ignitetest.utils.ignite_test import IgniteTest +from ignitetest.utils.version import IgniteVersion, V_2_9_0, DEV_BRANCH + + +# pylint: disable=W0223 +class SnapshotTest(IgniteTest): + """ + Test Snapshot. + """ + NUM_NODES = 4 + + SNAPSHOT_NAME = "test_snapshot" + + CACHE_NAME = "TEST_CACHE" + + @cluster(num_nodes=NUM_NODES) + @ignite_versions(str(DEV_BRANCH), str(V_2_9_0)) Review comment: Why LATEST_2_9? Will it be latest after the 2.10 release? ########## File path: modules/ducktests/tests/ignitetest/tests/snapshot_test.py ########## @@ -0,0 +1,119 @@ +# 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 snapshot test. +""" +from ducktape.mark.resource import cluster + +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.cache import CacheConfiguration +from ignitetest.services.utils.ignite_configuration.data_storage import DataRegionConfiguration +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +from ignitetest.utils import ignite_versions +from ignitetest.utils.ignite_test import IgniteTest +from ignitetest.utils.version import IgniteVersion, V_2_9_0, DEV_BRANCH + + +# pylint: disable=W0223 +class SnapshotTest(IgniteTest): + """ + Test Snapshot. + """ + NUM_NODES = 4 + + SNAPSHOT_NAME = "test_snapshot" + + CACHE_NAME = "TEST_CACHE" + + @cluster(num_nodes=NUM_NODES) + @ignite_versions(str(DEV_BRANCH), str(V_2_9_0)) + def snapshot_test(self, ignite_version): + """ + Basic snapshot test. + """ + data_storage = DataStorageConfiguration(default=DataRegionConfiguration(persistent=True)) + + ignite_config = IgniteConfiguration( + version=IgniteVersion(ignite_version), + data_storage=data_storage, + metric_exporter='org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi', + caches=[CacheConfiguration(name=self.CACHE_NAME, cache_mode='REPLICATED', + indexed_types=['java.util.UUID', 'byte[]'])] + ) + + num_nodes = len(self.test_context.cluster) Review comment: any reason to have a dedicated variable? ########## File path: modules/ducktests/tests/ignitetest/tests/snapshot_test.py ########## @@ -0,0 +1,119 @@ +# 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 snapshot test. +""" +from ducktape.mark.resource import cluster + +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.cache import CacheConfiguration +from ignitetest.services.utils.ignite_configuration.data_storage import DataRegionConfiguration +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +from ignitetest.utils import ignite_versions +from ignitetest.utils.ignite_test import IgniteTest +from ignitetest.utils.version import IgniteVersion, V_2_9_0, DEV_BRANCH + + +# pylint: disable=W0223 +class SnapshotTest(IgniteTest): + """ + Test Snapshot. + """ + NUM_NODES = 4 + + SNAPSHOT_NAME = "test_snapshot" + + CACHE_NAME = "TEST_CACHE" + + @cluster(num_nodes=NUM_NODES) + @ignite_versions(str(DEV_BRANCH), str(V_2_9_0)) + def snapshot_test(self, ignite_version): + """ + Basic snapshot test. + """ + data_storage = DataStorageConfiguration(default=DataRegionConfiguration(persistent=True)) + + ignite_config = IgniteConfiguration( + version=IgniteVersion(ignite_version), + data_storage=data_storage, + metric_exporter='org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi', + caches=[CacheConfiguration(name=self.CACHE_NAME, cache_mode='REPLICATED', + indexed_types=['java.util.UUID', 'byte[]'])] + ) + + num_nodes = len(self.test_context.cluster) + + service = IgniteService(self.test_context, ignite_config, num_nodes=num_nodes - 1, startup_timeout_sec=180) Review comment: Could you please answer the question I asked? ########## File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/snapshot_test/UuidDataLoaderApplication.java ########## @@ -0,0 +1,46 @@ +/* + * 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.snapshot_test; + +import java.util.UUID; +import com.fasterxml.jackson.databind.JsonNode; +import org.apache.ignite.IgniteDataStreamer; +import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication; + +/** + * Loading random uuids to cache. + */ +public class UuidDataLoaderApplication extends IgniteAwareApplication { Review comment: Don't see tests where it runs repeatedly. ########## File path: modules/ducktests/tests/ignitetest/services/ignite.py ########## @@ -38,10 +38,47 @@ def __init__(self, context, config, num_nodes, jvm_opts=None, startup_timeout_se super().__init__(context, config, num_nodes, startup_timeout_sec, shutdown_timeout_sec, modules=modules, jvm_opts=jvm_opts) + @property + def database_dir(self): + """ + :return: path to database directory + """ + return os.path.join(self.work_dir, "db") + + @property + def snapshots_dir(self): + """ + :return: path to snapshots directory + """ + return os.path.join(self.work_dir, "snapshots") + def clean_node(self, node): node.account.kill_java_processes(self.APP_SERVICE_CLASS, clean_shutdown=False, allow_fail=True) node.account.ssh("rm -rf -- %s" % self.persistent_root, allow_fail=False) + def rename_database(self, new_name: str): Review comment: Seems you changed `mv` to `cp`, what the reason to perform a so heavy operation? ---------------------------------------------------------------- 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]
