示例#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
    def upgrade_test(self, versions, ignite_version):
        """
        Basic upgrade test.
        """
        versions = sorted(list(map(IgniteVersion, versions)))

        self.logger.info(f"Testing: {versions}")

        service = IgniteApplicationService(
            self.test_context,
            config=None,  # will be defined later.
            java_class_name="org.apache.ignite.internal.ducktest.tests.persistence_upgrade_test."
                            "DataLoaderAndCheckerApplication"
        )

        for version in versions:
            service.config = IgniteConfiguration(
                data_storage=DataStorageConfiguration(default=DataRegionConfiguration(persistence_enabled=True)),
                version=version
            )

            service.params = {"check": service.stopped}

            service.start(clean=False)

            control_utility = ControlUtility(service)
            control_utility.activate()

            service.stop()
示例#3
0
    def snapshot_test(self, ignite_version):
        """
        Basic snapshot test.
        """
        version = IgniteVersion(ignite_version)

        ignite_config = IgniteConfiguration(
            version=version,
            data_storage=DataStorageConfiguration(default=DataRegionConfiguration(persistent=True)),
            metric_exporter='org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi'
        )

        nodes = IgniteService(self.test_context, ignite_config, num_nodes=len(self.test_context.cluster) - 1)
        nodes.start()

        control_utility = ControlUtility(nodes)
        control_utility.activate()

        loader_config = IgniteConfiguration(client_mode=True, version=version, discovery_spi=from_ignite_cluster(nodes))

        loader = IgniteApplicationService(
            self.test_context,
            loader_config,
            java_class_name="org.apache.ignite.internal.ducktest.tests.snapshot_test.DataLoaderApplication",
            params={"start": 0, "cacheName": self.CACHE_NAME, "interval": 500_000, "valueSizeKb": 1}
        )
示例#4
0
def start_ignite(test_context, ignite_version: str,
                 rebalance_params: RebalanceParams) -> IgniteService:
    """
    Start IgniteService:

    :param test_context: Test context.
    :param ignite_version: Ignite version.
    :param rebalance_params: Rebalance parameters.
    :return: IgniteService.
    """
    node_count = test_context.available_cluster_size - rebalance_params.preloaders

    if rebalance_params.persistent:
        data_storage = DataStorageConfiguration(
            max_wal_archive_size=2 * rebalance_params.data_region_max_size,
            default=DataRegionConfiguration(
                persistence_enabled=True,
                max_size=rebalance_params.data_region_max_size))
    else:
        data_storage = DataStorageConfiguration(
            default=DataRegionConfiguration(
                max_size=rebalance_params.data_region_max_size))

    node_config = IgniteConfiguration(
        version=IgniteVersion(ignite_version),
        data_storage=data_storage,
        metric_exporters={
            "org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi"
        },
        rebalance_thread_pool_size=rebalance_params.thread_pool_size,
        rebalance_batch_size=rebalance_params.batch_size,
        rebalance_batches_prefetch_count=rebalance_params.
        batches_prefetch_count,
        rebalance_throttle=rebalance_params.throttle)

    ignites = IgniteService(test_context,
                            config=node_config,
                            num_nodes=node_count if
                            rebalance_params.trigger_event else node_count - 1,
                            jvm_opts=rebalance_params.jvm_opts)
    ignites.start()

    return ignites
示例#5
0
    def test_change_users(self, ignite_version):
        """
        Test add, update and remove user
        """
        config = IgniteConfiguration(
            cluster_state="INACTIVE",
            auth_enabled=True,
            version=IgniteVersion(ignite_version),
            data_storage=DataStorageConfiguration(
                default=DataRegionConfiguration(persistent=True)),
            client_connector_configuration=ClientConnectorConfiguration())

        servers = IgniteService(self.test_context,
                                config=config,
                                num_nodes=self.NUM_NODES - 1)

        servers.start()

        ControlUtility(cluster=servers,
                       username=DEFAULT_AUTH_USERNAME,
                       password=DEFAULT_AUTH_PASSWORD).activate()

        client_cfg = IgniteThinClientConfiguration(
            addresses=servers.nodes[0].account.hostname + ":" +
            str(config.client_connector_configuration.port),
            version=IgniteVersion(ignite_version),
            username=DEFAULT_AUTH_USERNAME,
            password=DEFAULT_AUTH_PASSWORD)

        # Add new user
        check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD, True)
        self.run_with_creds(client_cfg, ADD_USER, TEST_USERNAME, TEST_PASSWORD)
        check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD)

        # Update user password
        check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD2, True)
        self.run_with_creds(client_cfg, UPDATE_USER, TEST_USERNAME,
                            TEST_PASSWORD2)
        check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD, True)
        check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD2)

        # Remove user
        self.run_with_creds(client_cfg, REMOVE_USER, TEST_USERNAME, free=False)
        check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD2, True)
示例#6
0
def get_server_config(ignite_version):
    affinity = Bean(
        "org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction",
        partitions=16384,
        affinityBackupFilter=Bean(
            "org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter",
            constructor_args=["CELL"]))

    cache_templates = [
        CacheConfiguration(name="PARTITIONED*",
                           cache_mode="PARTITIONED",
                           atomicity_mode="TRANSACTIONAL",
                           statistics_enabled=True,
                           affinity=affinity),
        CacheConfiguration(
            name="AffinityTemplate*",
            cache_mode="PARTITIONED",
            atomicity_mode="TRANSACTIONAL",
            statistics_enabled=True,
            affinity=affinity,
            affinity_mapper=Bean(
                "org.apache.ignite.internal.ducktest.tests.self_test.TestAffinityMapper"
            )),
    ]
    return IgniteConfiguration(
        version=IgniteVersion(ignite_version),
        data_storage=DataStorageConfiguration(
            checkpoint_frequency=10000,
            wal_history_size=2147483647,
            wal_segment_size=1024 * 1024 * 1024,
            wal_mode="LOG_ONLY",
            metrics_enabled=True,
            metrics_rate_time_interval=60000,
            wal_buffer_size=5242880,
            wal_compaction_enabled=True,
            default=DataRegionConfiguration(persistence_enabled=True,
                                            max_size=1024 * 1024 * 1024,
                                            metrics_enabled=True,
                                            metrics_rate_time_interval=1000)),
        client_connector_configuration=ClientConnectorConfiguration(
            thread_pool_size=10,
            thin_client_configuration=ThinClientConfiguration(
                max_active_compute_tasks_per_connection=100)),
        transaction_configuration=TransactionConfiguration(
            default_tx_timeout=300000,
            default_tx_isolation="READ_COMMITTED",
            tx_timeout_on_partition_map_exchange=120000),
        sql_schemas=["schema1", "schema2"],
        caches=cache_templates,
        metrics_log_frequency=30000,
        failure_detection_timeout=120000,
        rebalance_thread_pool_size=8,
        peer_class_loading_enabled=True,
        auto_activation_enabled=False,
        binary_configuration=BinaryConfiguration(compact_footer=True),
        communication_spi=TcpCommunicationSpi(idle_connection_timeout=600000,
                                              socket_write_timeout=30000,
                                              selectors_count=18,
                                              connections_per_node=4,
                                              use_paired_connections=True,
                                              message_queue_limit=0),
        connector_configuration=ConnectorConfiguration(idle_timeout=180000))