Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-36954

get_random_Key on empty bucket fails with Not found error

    XMLWordPrintable

    Details

    • Triage:
      Untriaged
    • Is this a Regression?:
      Yes

      Description

      1. create a couchbase bucket
      2. perform get_random_key on the bucket
      3. Test fails with  <MemcachedError #1 >

      Test:

      ./testrunner -i /tmp/testexec.9143.ini -p None -t epengine.basic_ops.basic_ops.do_get_random_key

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          owend Daniel Owen added a comment - - edited

          Hi Anitha Kuberan

          Could you upload the logs?

          Do you have the last known working build?

          thanks

          Show
          owend Daniel Owen added a comment - - edited Hi Anitha Kuberan Could you upload the logs? Do you have the last known working build? thanks
          Hide
          drigby Dave Rigby added a comment -

          Anitha Kuberan Please use the Bug Template when raising MBs - specifically what is the expected behaviour, and what is the actual behavour?

          In this instance, what should happen if you attempt to ask for a random key from a bucket which has no keys in it?

          Show
          drigby Dave Rigby added a comment - Anitha Kuberan Please use the Bug Template when raising MBs - specifically what is the expected behaviour, and what is the actual behavour? In this instance, what should happen if you attempt to ask for a random key from a bucket which has no keys in it?
          Hide
          owend Daniel Owen added a comment -

          Investigated running the test and see the following error when run against MH:

          Traceback (most recent call last):
            File "pytests/epengine/basic_ops.py", line 293, in do_get_random_key
              error.message))
          AssertionError: <MemcachedError #1 ``Memcached error #1''>
          

          Tried on 6.0.1 and see the same error.

          The get_random_key functionality was fixed in MB-31495
          In the associated patch we added the following test

          // Check that getRandomKey works correctly when given a random value of zero
          TEST_P(KVBucketParamTest, MB31495_GetRandomKey) {
              std::function<long()> returnZero = []() { return 0; };
              setRandomFunction(returnZero);
           
              // Try with am empty hash table
              auto gv = store->getRandomKey();
              EXPECT_EQ(ENGINE_KEY_ENOENT, gv.getStatus());
           
              Item item = store_item(
                          vbid, {"key", DocNamespace::DefaultCollection}, "value", 0);
           
              // Try with a non-empty hash table
              gv = store->getRandomKey();
              EXPECT_EQ(ENGINE_SUCCESS, gv.getStatus());
          }
          

          In the test we check that with an empty hash table (i.e. bucket with no docs) we return ENGINE_KEY_ENOENT.

          Therefore, I think the test might need updating to reflect this behaviour.

          Show
          owend Daniel Owen added a comment - Investigated running the test and see the following error when run against MH: Traceback (most recent call last): File "pytests/epengine/basic_ops.py", line 293, in do_get_random_key error.message)) AssertionError: <MemcachedError #1 ``Memcached error #1''> Tried on 6.0.1 and see the same error. The get_random_key functionality was fixed in MB-31495 In the associated patch we added the following test // Check that getRandomKey works correctly when given a random value of zero TEST_P(KVBucketParamTest, MB31495_GetRandomKey) { std::function<long()> returnZero = []() { return 0; }; setRandomFunction(returnZero);   // Try with am empty hash table auto gv = store->getRandomKey(); EXPECT_EQ(ENGINE_KEY_ENOENT, gv.getStatus());   Item item = store_item( vbid, {"key", DocNamespace::DefaultCollection}, "value", 0);   // Try with a non-empty hash table gv = store->getRandomKey(); EXPECT_EQ(ENGINE_SUCCESS, gv.getStatus()); } In the test we check that with an empty hash table (i.e. bucket with no docs) we return ENGINE_KEY_ENOENT. Therefore, I think the test might need updating to reflect this behaviour.
          Hide
          drigby Dave Rigby added a comment -

          Changing component to "test_execution" - the failure is due to the test having incorrect expectations on 6.5.

          Show
          drigby Dave Rigby added a comment - Changing component to "test_execution" - the failure is due to the test having incorrect expectations on 6.5.
          Hide
          anitha.kuberan Anitha Kuberan added a comment -

          changed the test script and script works fine.

          Show
          anitha.kuberan Anitha Kuberan added a comment - changed the test script and script works fine.

            People

            Assignee:
            anitha.kuberan Anitha Kuberan
            Reporter:
            anitha.kuberan Anitha Kuberan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty