Exemplo n.º 1
0
    def test_xattr_compression(self):
        # MB-32669
        # subdoc.subdoc_simple_dataset.SubdocSimpleDataset.test_xattr_compression,compression=active
        mc = MemcachedClient(self.master.ip, 11210)
        mc.sasl_auth_plain(self.master.rest_username,
                           self.master.rest_password)
        mc.bucket_select('default')

        self.key = "test_xattr_compression"
        self.nesting_level = 5
        array = {'i_add': 0, 'i_sub': 1, 'a_i_a': [0, 1], 'ai_sub': [0, 1]}
        base_json = self.generate_json_for_nesting()
        nested_json = self.generate_nested(base_json, array,
                                           self.nesting_level)
        jsonDump = json.dumps(nested_json)
        stats = mc.stats()
        self.assertEquals(stats['ep_compression_mode'], 'active')

        scheme = "http"
        host = "{0}:{1}".format(self.master.ip, self.master.port)
        self.sdk_client = SDKClient(scheme=scheme,
                                    hosts=[host],
                                    bucket="default")

        self.sdk_client.set(self.key, value=jsonDump, ttl=60)
        rv = self.sdk_client.cb.mutate_in(self.key,
                                          SD.upsert('my.attr',
                                                    "value",
                                                    xattr=True,
                                                    create_parents=True),
                                          ttl=60)
        self.assertTrue(rv.success)

        # wait for it to persist and then evict the key
        persisted = 0
        while persisted == 0:
            opaque, rep_time, persist_time, persisted, cas = mc.observe(
                self.key)

        mc.evict_key(self.key)
        time.sleep(65)
        try:
            self.client.get(self.key)
            self.fail("the key should get expired")
        except mc_bin_client.MemcachedError as error:
            self.assertEquals(error.status, 1)

        stats = mc.stats()
        self.assertEquals(int(stats['curr_items']), 0)
        self.assertEquals(int(stats['curr_temp_items']), 0)
Exemplo n.º 2
0
 def wait_for_warmup(self, host, port):
     if self.bucket_type == 'ephemeral': return
     while True:
         client = McdClient(host, port)
         try:
             client.bucket_select("default")
             response = client.stats()
             # check the old style or new style (as of 4.5) results
             mode = response.get('ep_degraded_mode')
             if mode is not None:
                 if mode == '0' or mode == 'false':
                     break
         except Exception as ex:
             pass
         time.sleep(1)
Exemplo n.º 3
0
 def wait_for_warmup(self, host, port):
     if self.bucket_type == 'ephemeral': return
     while True:
         client = McdClient(host, port)
         try:
             client.bucket_select("default")
             response = client.stats()
             # check the old style or new style (as of 4.5) results
             mode = response.get('ep_degraded_mode')
             if  mode is not None:
                 if mode == '0' or mode == 'false':
                     break
         except Exception as ex:
             pass
         time.sleep(1)