Beispiel #1
0
    def do_setWithMeta_twice(self):

        mc = MemcachedClient(self.master.ip, 11210)
        mc.sasl_auth_plain(self.master.rest_username, self.master.rest_password)
        mc.bucket_select('default')

        try:
            mc.setWithMeta('1', '{"Hello":"World"}', 3600, 0, 1, 0x1512a3186faa0000)
        except MemcachedError as error:
            self.log.info("<MemcachedError #%d ``%s''>" % (error.status, error.message))
            self.fail("Error on First setWithMeta()")

        stats = mc.stats()
        self.log.info('curr_items: {} and curr_temp_items:{}'.format(stats['curr_items'], stats['curr_temp_items']))
        self.log.info("Sleeping for 5 and checking stats again")
        time.sleep(5)
        stats = mc.stats()
        self.log.info('curr_items: {} and curr_temp_items:{}'.format(stats['curr_items'], stats['curr_temp_items']))

        try:
            mc.setWithMeta('1', '{"Hello":"World"}', 3600, 0, 1, 0x1512a3186faa0000)
        except MemcachedError as error:
            stats = mc.stats()
            self.log.info('After 2nd setWithMeta(), curr_items: {} and curr_temp_items:{}'.format(stats['curr_items'], stats['curr_temp_items']))
            if int(stats['curr_temp_items']) == 1:
                self.fail("Error on second setWithMeta(), expected curr_temp_items to be 0")
            else:
                self.log.info("<MemcachedError #%d ``%s''>" % (error.status, error.message))
    def test_epengine_save_meta_to_48bits_in_ram(self):
        """
            As in MB-29119, ep-engine must save rev-seqno in 48 bits
            This fix went into version 5.1+
            params: eviction_policy=fullEviction,sasl_buckets=1
        """
        if 5.1 > float(self.cb_version[:3]):
            self.log.info("This test only work for version 5.1+")
            return
        if len(self.buckets) >= 2:
            self.fail("This test only runs in one bucket")

        rest = RestConnection(self.master)
        success_set_exist_item = False
        mc = MemcachedClient(self.master.ip, 11210)
        mc.sasl_auth_plain('Administrator', 'password')
        mc.bucket_select('standard_bucket0')
        mc.vbucketId = 903

        self.log.info("Start to test")
        mc.setWithMeta('test_with_meta', 'value', 0, 0, 0x1234000000000001, 1)
        self.sleep(10)
        item_count = rest.get_active_key_count("standard_bucket0")

        if int(item_count) != 1:
            self.fail("Fail to set 1 key to standard_bucket0")

        mc.evict_key('test_with_meta')
        try:
            mc.setWithMeta('test_with_meta', 'value', 0, 0, 0x1234000000000001,
                           1)
            success_set_exist_item = True
        except MemcachedError as e:
            print("\nMemcached exception: ", e)
            if "#2" not in str(e):
                self.fail("ep engine failed to check existed key")
                """error #2 is ErrorKeyEexists"""
        if success_set_exist_item:
            self.fail("ep engine could set an existed key")
Beispiel #3
0
    def do_setWithMeta_twice(self):

        mc = MemcachedClient(self.master.ip, 11210)
        mc.sasl_auth_plain(self.master.rest_username,
                           self.master.rest_password)
        mc.bucket_select('default')

        try:
            mc.setWithMeta('1', '{"Hello":"World"}', 3600, 0, 1,
                           0x1512a3186faa0000)
        except MemcachedError as error:
            self.log.info("<MemcachedError #%d ``%s''>" %
                          (error.status, error.message))
            self.fail("Error on First setWithMeta()")

        stats = mc.stats()
        self.log.info('curr_items: {} and curr_temp_items:{}'.format(
            stats['curr_items'], stats['curr_temp_items']))
        self.log.info("Sleeping for 5 and checking stats again")
        time.sleep(5)
        stats = mc.stats()
        self.log.info('curr_items: {} and curr_temp_items:{}'.format(
            stats['curr_items'], stats['curr_temp_items']))

        try:
            mc.setWithMeta('1', '{"Hello":"World"}', 3600, 0, 1,
                           0x1512a3186faa0000)
        except MemcachedError as error:
            stats = mc.stats()
            self.log.info(
                'After 2nd setWithMeta(), curr_items: {} and curr_temp_items:{}'
                .format(stats['curr_items'], stats['curr_temp_items']))
            if int(stats['curr_temp_items']) == 1:
                self.fail(
                    "Error on second setWithMeta(), expected curr_temp_items to be 0"
                )
            else:
                self.log.info("<MemcachedError #%d ``%s''>" %
                              (error.status, error.message))
    def test_epengine_save_meta_to_48bits_in_ram(self):
        """
            As in MB-29119, ep-engine must save rev-seqno in 48 bits
            This fix went into version 5.1+
            params: eviction_policy=fullEviction,sasl_buckets=1
        """
        if 5.1 > float(self.cb_version[:3]):
            self.log.info("This test only work for version 5.1+")
            return
        if len(self.buckets) >= 2:
            self.fail("This test only runs in one bucket")

        rest = RestConnection(self.master)
        success_set_exist_item = False
        mc = MemcachedClient(self.master.ip, 11210)
        mc.sasl_auth_plain('Administrator', 'password')
        mc.bucket_select('bucket0')
        mc.vbucketId = 903

        self.log.info("Start to test")
        mc.setWithMeta('test_with_meta', 'value', 0, 0, 0x1234000000000001, 1)
        self.sleep(10)
        item_count = rest.get_active_key_count("bucket0")

        if int(item_count) != 1:
            self.fail("Fail to set 1 key to bucket0")

        mc.evict_key('test_with_meta')
        try:
            mc.setWithMeta('test_with_meta', 'value', 0, 0, 0x1234000000000001, 1)
            success_set_exist_item = True
        except MemcachedError as e:
            print "\nMemcached exception: ", e
            if "#2" not in str(e):
                self.fail("ep engine failed to check existed key")
                """error #2 is ErrorKeyEexists"""
        if success_set_exist_item:
            self.fail("ep engine could set an existed key")