Ejemplo n.º 1
0
    def collect_compare_dcp_stats(self,
                                  buckets,
                                  servers,
                                  perNode=True,
                                  stat_name='unacked_bytes',
                                  compare_value=0,
                                  flow_control_buffer_size=20971520,
                                  filter_list=[]):
        """
            Method to extract the failovers stats given by cbstats tool

            Paramters:
              buckets: bucket informaiton
              servers: server information
              stat_name: stat we are searching to compare
              compare_value: the comparison value to be satisfied

            Returns:
              map of bucket informing if stat matching was
              satisfied / not satisfied

            example:: unacked_bytes in dcp
        """
        bucketMap = dict()
        for bucket in buckets:
            bucketMap[bucket.name] = True
        for bucket in buckets:
            for server in servers:
                # client = MemcachedClientHelper.direct_client(server, bucket)
                # stats = client.stats('dcp')
                shell = RemoteMachineShellConnection(server)
                cbstat = Cbstats(shell)
                stats = cbstat.dcp_stats(bucket)
                for key in stats.keys():
                    do_filter = False
                    if stat_name in key:
                        for filter_key in filter_list:
                            if filter_key in key:
                                do_filter = True
                        value = int(stats[key])
                        if not do_filter:
                            if value != compare_value:
                                if "eq_dcpq:mapreduce_view" in key:
                                    if value >= flow_control_buffer_size:
                                        bucketMap[bucket] = False
                                else:
                                    bucketMap[bucket] = False
        return bucketMap
Ejemplo n.º 2
0
    def test_buffer_ack_during_dcp_commit(self):
        """
        MB-46482
        - Create bucket with min_ram
        - Perform huge number of sync_writes
        - Validate 'dcp unacked_bytes' stats are all ZERO
        """

        if self.durability_level == ""  \
                or self.durability_level.upper() == "NONE":
            self.fail("Test requires valid durability level for sync_writes")

        doc_gen = doc_generator(self.key,
                                self.num_items,
                                self.num_items * 3,
                                key_size=10,
                                doc_size=5)
        self.log.info("Loading %s keys into the bucket" % (self.num_items * 2))
        load_task = self.task.async_load_gen_docs(
            self.cluster,
            self.bucket,
            doc_gen,
            DocLoading.Bucket.DocOps.UPDATE,
            durability=self.durability_level,
            print_ops_rate=False)
        self.task_manager.get_task_result(load_task)

        self.bucket_util._wait_for_stats_all_buckets(self.cluster,
                                                     self.cluster.buckets)
        self.sleep(5, "Wait for dcp")
        for node in self.cluster_util.get_kv_nodes(self.cluster):
            cb_stat = Cbstats(node)
            dcp_stats = cb_stat.dcp_stats(self.bucket.name)
            for stat_name, val in dcp_stats.items():
                if stat_name.split(":")[-1] == "unacked_bytes":
                    self.log.debug("%s: %s" % (stat_name, val))
                    if int(val) != 0:
                        self.log_failure("%s: %s != 0" % (stat_name, val))

        self.validate_test_failure()