def __run(self, ignite_version, trigger_event, backups, cache_count, entry_count, entry_size, preloaders, thread_pool_size, batch_size, batches_prefetch_count, throttle): """ Test performs rebalance test which consists of following steps: * Start cluster. * Put data to it via IgniteClientApp. * Triggering a rebalance event and awaits for rebalance to finish. :param ignite_version: Ignite version. :param trigger_event: Trigger event. :param backups: Backup count. :param cache_count: Cache count. :param entry_count: Cache entry count. :param entry_size: Cache entry size. :param preloaders: Preload application nodes count. :param thread_pool_size: rebalanceThreadPoolSize config property. :param batch_size: rebalanceBatchSize config property. :param batches_prefetch_count: rebalanceBatchesPrefetchCount config property. :param throttle: rebalanceThrottle config property. :return: Rebalance and data preload stats. """ reb_params = RebalanceParams( trigger_event=trigger_event, 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) ignites = start_ignite(self.test_context, ignite_version, reb_params) preload_time = preload_data( self.test_context, ignites.config._replace( client_mode=True, discovery_spi=from_ignite_cluster(ignites)), rebalance_params=reb_params) if trigger_event: ignites.stop_node(ignites.nodes[-1]) rebalance_nodes = ignites.nodes[:-1] else: ignite = IgniteService( self.test_context, ignites.config._replace( discovery_spi=from_ignite_cluster(ignites)), num_nodes=1) ignite.start() rebalance_nodes = ignite.nodes await_rebalance_start(ignite) ignite.await_rebalance() return get_result(rebalance_nodes, preload_time, cache_count, entry_count, entry_size)
def test_node_join(self, ignite_version, backups, cache_count, entry_count, entry_size, preloaders, thread_pool_size, batch_size, batches_prefetch_count, throttle): """ Tests rebalance on node join. """ reb_params = RebalanceParams( trigger_event=TriggerEvent.NODE_JOIN, 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) new_node = IgniteService( self.test_context, ignites.config._replace( discovery_spi=from_ignite_cluster(ignites)), num_nodes=1) new_node.start() control_utility.add_to_baseline(new_node.nodes) await_and_check_rebalance(new_node) nodes = ignites.nodes.copy() nodes.append(new_node.nodes[0]) result = get_result(new_node.nodes, preload_time, cache_count, entry_count, entry_size) control_utility.deactivate() self.logger.debug( f'DB size after rebalance: {get_database_size_mb(nodes, ignites.database_dir)}' ) return result
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
def node_join_historical_test(self, ignite_version, backups, cache_count, entry_count, entry_size, preloaders, thread_pool_size, batch_size, batches_prefetch_count, throttle): """ Test historycal rebalance. """ preload_entries = 10_000 reb_params = RebalanceParams( trigger_event=TriggerEvent.NODE_JOIN, 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, jvm_opts=[ '-DIGNITE_PDS_WAL_REBALANCE_THRESHOLD=0', '-DIGNITE_PREFER_WAL_REBALANCE=true' ]) ignites = start_ignite(self.test_context, ignite_version, reb_params) control_utility = ControlUtility(ignites) control_utility.activate() preloader_config = ignites.config._replace( client_mode=True, discovery_spi=from_ignite_cluster(ignites)) preloader = IgniteApplicationService( self.test_context, preloader_config, java_class_name= "org.apache.ignite.internal.ducktest.tests.rebalance.DataGenerationApplication", params={ "backups": 1, "cacheCount": 1, "entrySize": 1, "from": 0, "to": preload_entries }) preloader.run() preloader.free() control_utility.deactivate() control_utility.activate() node = ignites.nodes[-1] ignites.stop_node(node) assert ignites.wait_node(node) preload_time = preload_data( self.test_context, ignites.config._replace( client_mode=True, discovery_spi=from_ignite_cluster(ignites)), rebalance_params=reb_params) control_utility.deactivate() control_utility.activate() self.logger.debug( f'DB size before rebalance: {get_database_size_mb(ignites.nodes, ignites.database_dir)}' ) ignites.start_node(node) ignites.await_started() rebalance_nodes = [node] await_and_check_rebalance(ignites, rebalance_nodes, False) result = get_result(rebalance_nodes, 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