Пример #1
0
    def __start_ignite_nodes(self,
                             version,
                             num_nodes,
                             timeout_sec=60,
                             join_cluster=None):
        config = IgniteConfiguration(
            cluster_state="INACTIVE",
            version=IgniteVersion(version),
            data_storage=DataStorageConfiguration(
                default=DataRegionConfiguration(name='persistent',
                                                persistence_enabled=True),
                regions=[
                    DataRegionConfiguration(name='in-memory',
                                            persistence_enabled=False,
                                            max_size=100 * 1024 * 1024)
                ]))

        if join_cluster:
            config._replace(discovery_spi=from_ignite_cluster(join_cluster))

        servers = IgniteService(self.test_context,
                                config=config,
                                num_nodes=num_nodes,
                                startup_timeout_sec=timeout_sec)

        servers.start()

        return servers
Пример #2
0
    def test_ssl_connection(self, ignite_version):
        """
        Test that IgniteService, IgniteApplicationService correctly start and stop with ssl configurations.
        And check ControlUtility with ssl arguments.
        """
        shared_root = get_shared_root_path(self.test_context.globals)

        server_ssl = SslParams(shared_root,
                               key_store_jks=DEFAULT_SERVER_KEYSTORE)

        server_configuration = IgniteConfiguration(
            version=IgniteVersion(ignite_version),
            ssl_params=server_ssl,
            connector_configuration=ConnectorConfiguration(
                ssl_enabled=True, ssl_params=server_ssl))

        ignite = IgniteService(self.test_context,
                               server_configuration,
                               num_nodes=2,
                               startup_timeout_sec=180)

        client_configuration = server_configuration._replace(
            client_mode=True,
            ssl_params=SslParams(shared_root,
                                 key_store_jks=DEFAULT_CLIENT_KEYSTORE),
            connector_configuration=None)

        app = IgniteApplicationService(
            self.test_context,
            client_configuration,
            java_class_name=
            "org.apache.ignite.internal.ducktest.tests.smoke_test.SimpleApplication",
            startup_timeout_sec=180)

        admin_ssl = SslParams(shared_root,
                              key_store_jks=DEFAULT_ADMIN_KEYSTORE)
        control_utility = ControlUtility(cluster=ignite, ssl_params=admin_ssl)

        ignite.start()
        app.start()

        control_utility.cluster_state()

        app.stop()
        ignite.stop()
Пример #3
0
    def test_ignite_app_start_stop(self, ignite_version):
        """
        Test that IgniteService and IgniteApplicationService correctly start and stop
        """
        server_configuration = IgniteConfiguration(
            version=IgniteVersion(ignite_version))

        ignite = IgniteService(self.test_context,
                               server_configuration,
                               num_nodes=1)

        client_configuration = server_configuration._replace(
            client_mode=True, discovery_spi=from_ignite_cluster(ignite))
        app = IgniteApplicationService(
            self.test_context,
            client_configuration,
            java_class_name=
            "org.apache.ignite.internal.ducktest.tests.smoke_test.SimpleApplication"
        )

        ignite.start()
        app.start()
        app.stop()
        ignite.stop()
Пример #4
0
    def ignite_start_stop(self, ignite_version, graceful_shutdown, nodes_num,
                          static_clients_num, temp_client, iteration_count,
                          client_work_time):
        """
        Test for starting and stopping fat clients.
        """

        servers_count = nodes_num - static_clients_num - temp_client
        current_top_v = servers_count

        # Topology version after test.
        fin_top_ver = servers_count + (2 * static_clients_num) + (
            2 * iteration_count * temp_client)

        server_cfg = IgniteConfiguration(
            version=IgniteVersion(ignite_version),
            caches=[
                CacheConfiguration(name=self.CACHE_NAME,
                                   backups=1,
                                   atomicity_mode='TRANSACTIONAL')
            ])

        ignite = IgniteService(self.test_context,
                               server_cfg,
                               num_nodes=servers_count)

        control_utility = ControlUtility(ignite)

        client_cfg = server_cfg._replace(client_mode=True)

        static_clients = IgniteApplicationService(
            self.test_context,
            client_cfg,
            java_class_name=self.JAVA_CLIENT_CLASS_NAME,
            num_nodes=static_clients_num,
            params={
                "cacheName": self.CACHE_NAME,
                "pacing": self.PACING
            })

        temp_clients = IgniteApplicationService(
            self.test_context,
            client_cfg,
            java_class_name=self.JAVA_CLIENT_CLASS_NAME,
            num_nodes=temp_client,
            params={
                "cacheName": self.CACHE_NAME,
                "pacing": self.PACING
            })

        ignite.start()

        static_clients.start()

        current_top_v += static_clients_num

        check_topology(control_utility, current_top_v)

        # Start / stop temp_clients node. Check cluster.
        for i in range(iteration_count):
            self.logger.info(f'Starting iteration: {i}.')

            temp_clients.start()

            current_top_v += temp_client

            await_event(static_clients, f'ver={current_top_v}, locNode=')

            check_topology(control_utility, current_top_v)

            await_event(temp_clients,
                        f'clients={static_clients_num + temp_client}')

            time.sleep(client_work_time)

            if graceful_shutdown:
                temp_clients.stop()
            else:
                temp_clients.kill()

            current_top_v += temp_client

        await_event(static_clients, f'ver={current_top_v}, locNode=')

        static_clients.stop()

        check_topology(control_utility, fin_top_ver)
Пример #5
0
    def test(self, ignite_version, load_type):
        """
        Tests PME-free switch scenario (node stop).
        """
        data = {}

        caches = [CacheConfiguration(name='test-cache', backups=2, atomicity_mode='TRANSACTIONAL')]

        l_type = LoadType.construct_from(load_type)

        # Checking PME (before 2.8) vs PME-free (2.8+) switch duration, but
        # focusing on switch duration (which depends on caches amount) when long_txs is false and
        # on waiting for previously started txs before the switch (which depends on txs duration) when long_txs of true.
        if l_type is LoadType.EXTRA_CACHES:
            for idx in range(1, self.EXTRA_CACHES_AMOUNT):
                caches.append(CacheConfiguration(name="cache-%d" % idx, backups=2, atomicity_mode='TRANSACTIONAL'))

        config = IgniteConfiguration(version=IgniteVersion(ignite_version), caches=caches, cluster_state="INACTIVE")

        num_nodes = len(self.test_context.cluster) - 2

        self.test_context.logger.info("Nodes amount calculated as %d." % num_nodes)

        ignites = IgniteService(self.test_context, config, num_nodes=num_nodes)

        ignites.start()

        if IgniteVersion(ignite_version) >= V_2_8_0:
            ControlUtility(ignites).disable_baseline_auto_adjust()

        ControlUtility(ignites).activate()

        client_config = config._replace(client_mode=True,
                                        discovery_spi=from_ignite_cluster(ignites, slice(0, num_nodes - 1)))

        long_tx_streamer = IgniteApplicationService(
            self.test_context,
            client_config,
            java_class_name="org.apache.ignite.internal.ducktest.tests.pme_free_switch_test.LongTxStreamerApplication",
            params={"cacheName": "test-cache"},
            startup_timeout_sec=180)

        if l_type is LoadType.LONG_TXS:
            long_tx_streamer.start()

        single_key_tx_streamer = IgniteApplicationService(
            self.test_context,
            client_config,
            java_class_name="org.apache.ignite.internal.ducktest.tests.pme_free_switch_test."
                            "SingleKeyTxStreamerApplication",
            params={"cacheName": "test-cache", "warmup": 1000},
            startup_timeout_sec=180)

        single_key_tx_streamer.start()

        ignites.stop_node(ignites.nodes[num_nodes - 1])

        single_key_tx_streamer.await_event("Node left topology", 60, from_the_beginning=True)

        if l_type is LoadType.LONG_TXS:
            time.sleep(30)  # keeping txs alive for 30 seconds.

            long_tx_streamer.stop_async()

            single_key_tx_streamer.await_event("Node left topology", 60, from_the_beginning=True)

        single_key_tx_streamer.await_event("APPLICATION_STREAMED", 60)  # waiting for streaming continuation.

        single_key_tx_streamer.stop()

        data["Worst latency (ms)"] = single_key_tx_streamer.extract_result("WORST_LATENCY")
        data["Streamed txs"] = single_key_tx_streamer.extract_result("STREAMED")
        data["Measure duration (ms)"] = single_key_tx_streamer.extract_result("MEASURE_DURATION")
        data["Server nodes"] = num_nodes

        return data
Пример #6
0
    def _perform_node_fail_scenario(self, test_config):
        failure_detection_timeout = self._global_int(
            self.GLOBAL_DETECTION_TIMEOUT, self.DEFAULT_DETECTION_TIMEOUT)

        cluster_size = self.available_cluster_size

        # One node is required to detect the failure.
        assert cluster_size >= 1 + test_config.nodes_to_kill + (
            self.ZOOKEEPER_NODES if test_config.with_zk else 0), \
            f"Few required containers: {cluster_size}. Check the params."

        self.logger.info("Starting on " + str(cluster_size) +
                         " maximal containers.")
        self.logger.info(
            f"{self.GLOBAL_DETECTION_TIMEOUT}: {failure_detection_timeout}")

        results = {}

        modules = ['zookeeper'] if test_config.with_zk else None

        if test_config.with_zk:
            zk_quorum = start_zookeeper(self.test_context,
                                        self.ZOOKEEPER_NODES,
                                        failure_detection_timeout)

            discovery_spi = from_zookeeper_cluster(zk_quorum)
        else:
            discovery_spi = TcpDiscoverySpi()

            if LATEST_2_7 < test_config.version <= V_2_9_0:
                discovery_spi.so_linger = 0

            if test_config.disable_conn_recovery:
                discovery_spi.conn_recovery_timeout = 0

        ignite_config = IgniteConfiguration(
            version=test_config.version,
            discovery_spi=discovery_spi,
            failure_detection_timeout=failure_detection_timeout,
            caches=[
                CacheConfiguration(
                    name='test-cache',
                    backups=1,
                    atomicity_mode='TRANSACTIONAL' if test_config.load_type
                    == ClusterLoad.TRANSACTIONAL else 'ATOMIC')
            ])

        # Start Ignite nodes in count less than max_nodes_in_use. One node is erequired for the loader. Some nodes might
        # be needed for ZooKeeper.
        servers, start_servers_sec = start_servers(
            self.test_context, cluster_size - self.ZOOKEEPER_NODES - 1,
            ignite_config, modules)

        results['Ignite cluster start time (s)'] = start_servers_sec

        failed_nodes = choose_node_to_kill(servers, test_config.nodes_to_kill,
                                           test_config.sequential_failure)

        if test_config.load_type is not ClusterLoad.NONE:
            load_config = ignite_config._replace(client_mode=True) if test_config.with_zk else \
                ignite_config._replace(client_mode=True, discovery_spi=from_ignite_cluster(servers))

            tran_nodes = [servers.node_id(n) for n in failed_nodes] \
                if test_config.load_type == ClusterLoad.TRANSACTIONAL else None

            params = {
                "cacheName": "test-cache",
                "range": self.DATA_AMOUNT,
                "warmUpRange": self.WARMUP_DATA_AMOUNT,
                "targetNodes": tran_nodes,
                "transactional": bool(tran_nodes)
            }

            start_load_app(self.test_context, load_config, params, modules)

        # Detection timeout is 4 * failure_detection_timeout in seconds.
        detection_timeout_sec = 4 * ignite_config.failure_detection_timeout // 1000

        results.update(
            self._simulate_and_detect_failure(servers, failed_nodes,
                                              detection_timeout_sec,
                                              test_config.net_part))

        return results