예제 #1
0
 def setUp(self):
     self.input = TestInputSingleton.input
     self.input.test_params.update({"default_bucket": False})
     super(volume, self).setUp()
     self.bucket_util._expiry_pager(self.cluster, val=5)
     self.rest = RestConnection(self.servers[0])
     self.available_servers = list()
     self.available_servers = self.cluster.servers[self.nodes_init:]
     self.nodes_in_cluster = self.cluster.servers[:self.nodes_init]
     self.exclude_nodes = [self.cluster.master]
     self.skip_check_logs = False
     self.iterations = self.input.param("iterations", 1)
     self.retry_get_process_num = self.input.param("retry_get_process_num",
                                                   400)
     self.kv_mem_quota = self.input.param("kv_mem_quota", 22000)
     self.index_mem_quota = self.input.param("index_mem_quota", 22700)
     self.skip_index_creation_in_setup = self.input.param(
         "skip_index_creation_in_setup", False)
     self.tombstone_purge_age = self.input.param("tombstone_purge_age", 300)
     shell = RemoteMachineShellConnection(self.cluster.master)
     shell.enable_diag_eval_on_non_local_hosts()
     shell.disconnect()
     self.rest.update_tombstone_purge_age_for_removal(
         self.tombstone_purge_age)
     self.index_setup()
     self.fts_setup()
예제 #2
0
 def setUp(self):
     super(RebalanceStartStopTests, self).setUp()
     extra_nodes_in = self.input.param("extra_nodes_in", 0)
     extra_nodes_out = self.input.param("extra_nodes_out", 0)
     self.servs_init = self.servers[:self.nodes_init]
     self.servs_in = [self.servers[i + self.nodes_init]
                      for i in range(self.nodes_in)]
     self.servs_out = [self.servers[self.nodes_init - i - 1]
                       for i in range(self.nodes_out)]
     self.extra_servs_in = [self.servers[i + self.nodes_init + self.nodes_in] for i in range(extra_nodes_in)]
     self.extra_servs_out = [self.servers[self.nodes_init - i - 1 - self.nodes_out] for i in range(extra_nodes_out)]
     self.withMutationOps = self.input.param("withMutationOps", True)
     self.sleep_before_rebalance = self.input.param("sleep_before_rebalance", 0)
     if self.spec_name is not None:
         self.num_items = 20000
         self.items = 20000
         init_doc_load_spec = \
             self.bucket_util.get_crud_template_from_package("initial_load")
         # Using the same key as defined in the loading spec
         self.gen_update = doc_generator(
             init_doc_load_spec["doc_crud"][
                 MetaCrudParams.DocCrud.COMMON_DOC_KEY],
             0, (self.items / 2),
             mutation_type="SET")
     shell = RemoteMachineShellConnection(self.cluster.master)
     shell.enable_diag_eval_on_non_local_hosts()
     shell.disconnect()
예제 #3
0
 def configure_stats_settings_from_diag_eval(self, key, value):
     """
     To change stats config settings through diag/eval
     :key:  scrape_interval, retention_size, prometheus_metrics_scrape_interval etc
     :value: new_value to be set for the above key.
     """
     shell = RemoteMachineShellConnection(self.server)
     shell.enable_diag_eval_on_non_local_hosts()
     shell.disconnect()
     key_value = '{%s, %s}' % (key, str(value))
     status, content = self.rest.diag_eval(
         'ns_config:set_sub(stats_settings, [%s])' % key_value)
     if not status:
         raise Exception(content)
예제 #4
0
 def get_ns_config_deleted_keys_count(self, nodes=None):
     """
     get a dump of ns_config and grep for "_deleted" to get
     deleted keys count
     Return dict with key = node_ip and value = deleted key count
     as string
     """
     deleted_keys_count_dict = dict()
     if nodes is None:
         nodes = self.cluster_util.get_nodes_in_cluster(self.cluster)
     for node in nodes:
         shell = RemoteMachineShellConnection(node)
         shell.enable_diag_eval_on_non_local_hosts()
         command = "curl --silent -u %s:%s http://localhost:8091/diag/eval -d 'ns_config:get()' " \
                   "| grep '_deleted' | wc -l" % (self.rest.username, self.rest.password)
         output, _ = shell.execute_command(command)
         shell.disconnect()
         deleted_keys_count_dict[node.ip] = output[0].strip('\n')
     return deleted_keys_count_dict
예제 #5
0
 def set_ephemeral_purge_age_and_interval(
         self,
         ephemeral_metadata_purge_age=0,
         ephemeral_metadata_purge_interval=1):
     """
     Enables diag eval on master node and updates the above two parameters
     for all ephemeral buckets on the cluster
     """
     shell = RemoteMachineShellConnection(self.cluster.master)
     shell.enable_diag_eval_on_non_local_hosts()
     shell.disconnect()
     ephemeral_buckets = [
         bucket for bucket in self.cluster.buckets
         if bucket.bucketType == "ephemeral"
     ]
     for ephemeral_bucket in ephemeral_buckets:
         rest = RestConnection(self.cluster.master)
         status, content = rest.set_ephemeral_purge_age_and_interval(
             bucket=ephemeral_bucket.name,
             ephemeral_metadata_purge_age=ephemeral_metadata_purge_age,
             ephemeral_metadata_purge_interval=
             ephemeral_metadata_purge_interval)
         if not status:
             raise Exception(content)
예제 #6
0
 def reset_stats_settings_from_diag_eval(self, key=None):
     """
     To restore stats config to defaults through diag/eval
     :key: Specific key to restore eg: retention_size
     """
     shell = RemoteMachineShellConnection(self.server)
     shell.enable_diag_eval_on_non_local_hosts()
     shell.disconnect()
     default_config_dict = constants.stats_default_config
     if key:
         value = default_config_dict[key]
         key_value = '{%s, %s}' % (key, str(value))
         status, content = self.rest.diag_eval(
             'ns_config:set_sub(stats_settings, [%s])' % key_value)
         if not status:
             raise Exception(content)
     else:
         # Reset all
         for key, value in default_config_dict.items():
             key_value = '{%s, %s}' % (key, str(value))
             status, content = self.rest.diag_eval(
                 'ns_config:set_sub(stats_settings, [%s])' % key_value)
             if not status:
                 raise Exception(content)