Exemplo n.º 1
0
    def test_node_left(self, ignite_version, backups, cache_count, entry_count,
                       entry_size, preloaders, thread_pool_size, batch_size,
                       batches_prefetch_count, throttle):
        """
        Tests rebalance on node left.
        """

        reb_params = RebalanceParams(
            trigger_event=TriggerEvent.NODE_LEFT,
            backups=backups,
            cache_count=cache_count,
            entry_count=entry_count,
            entry_size=entry_size,
            preloaders=preloaders,
            thread_pool_size=thread_pool_size,
            batch_size=batch_size,
            batches_prefetch_count=batches_prefetch_count,
            throttle=throttle,
            persistent=True)

        ignites = start_ignite(self.test_context, ignite_version, reb_params)

        control_utility = ControlUtility(ignites)

        control_utility.activate()

        preload_time = preload_data(
            self.test_context,
            ignites.config._replace(
                client_mode=True, discovery_spi=from_ignite_cluster(ignites)),
            rebalance_params=reb_params)

        self.logger.debug(
            f'DB size before rebalance: {get_database_size_mb(ignites.nodes, ignites.database_dir)}'
        )

        node = ignites.nodes[-1]

        ignites.stop_node(node)
        assert ignites.wait_node(node)

        control_utility.remove_from_baseline([node])

        await_and_check_rebalance(ignites)

        result = get_result(ignites.nodes[:-1], preload_time, cache_count,
                            entry_count, entry_size)

        control_utility.deactivate()

        self.logger.debug(
            f'DB size after rebalance: {get_database_size_mb(ignites.nodes, ignites.database_dir)}'
        )

        return result
Exemplo n.º 2
0
    def test_baseline_add_remove(self, ignite_version):
        """
        Test add and remove nodes from baseline.
        """
        blt_size = self.NUM_NODES - 1
        servers = self.__start_ignite_nodes(ignite_version, blt_size)

        control_utility = ControlUtility(servers)

        control_utility.activate()

        # Add node to baseline.
        new_node = self.__start_ignite_nodes(ignite_version,
                                             1,
                                             join_cluster=servers)
        control_utility.add_to_baseline(new_node.nodes)
        blt_size += 1

        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_in_baseline(new_node.nodes, baseline)

        # Expected failure (remove of online node is not allowed).
        try:
            control_utility.remove_from_baseline(new_node.nodes)

            assert False, "Remove of online node from baseline should fail!"
        except ControlUtilityError:
            pass

        # Remove of offline node from baseline.
        new_node.stop()

        servers.await_event("Node left topology",
                            timeout_sec=30,
                            from_the_beginning=True)

        control_utility.remove_from_baseline(new_node.nodes)
        blt_size -= 1

        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_not_in_baseline(new_node.nodes, baseline)