Uploaded image for project: 'C++ Couchbase Client'
  1. C++ Couchbase Client
  2. CXXCBC-30

Inconsistent behaviour when using subdoc opcodes incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.0.0-dp.15
    • 1.0.0-beta
    • None
    • None

    Description

      If I use a mutation opcode on a lookup request an invalid argument error is returned

      couchbase::operations::lookup_in_request req{ id };
      req.specs.add_spec(couchbase::protocol::subdoc_opcode::remove, false, "array[0]");
      req.specs.add_spec(couchbase::protocol::subdoc_opcode::remove, false, "array[0]");
      auto resp = test::utils::execute(integration.cluster, req);
      REQUIRE(resp.ctx.ec == couchbase::error::common_errc::invalid_argument);
      

      If I use a lookup opcode on a mutation request an assertion is hit

      couchbase::operations::mutate_in_request req{ id };
      req.specs.add_spec(couchbase::protocol::subdoc_opcode::get, false, "p");
      req.specs.add_spec(couchbase::protocol::subdoc_opcode::get, false, "p");
      auto resp = test::utils::execute(integration.cluster, req);
      REQUIRE(resp.ctx.ec == couchbase::error::common_errc::invalid_argument);
      

      * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
        * frame #0: 0x00007fff6c8a333a libsystem_kernel.dylib`__pthread_kill + 10
          frame #1: 0x00007fff6c95fe60 libsystem_pthread.dylib`pthread_kill + 430
          frame #2: 0x00007fff6c82a808 libsystem_c.dylib`abort + 120
          frame #3: 0x00000001009c6741 libc++abi.dylib`abort_message + 241
          frame #4: 0x00000001009ac29e libc++abi.dylib`demangling_terminate_handler() + 46
          frame #5: 0x00000001009c5728 libc++abi.dylib`std::__terminate(void (*)()) + 8
          frame #6: 0x00000001009c56c2 libc++abi.dylib`std::terminate() + 66
          frame #7: 0x000000010006b659 test_integration_subdoc`gsl::details::terminate() at assert:119:9
          frame #8: 0x000000010005b696 test_integration_subdoc`____C_A_T_C_H____T_E_S_T____50() [inlined] couchbase::protocol::mutate_in_request_body::mutate_in_specs::add_spec(operation=get, xattr=false) at cmd_mutate_in.hxx:189:13
      

      https://github.com/couchbaselabs/couchbase-cxx-client/blob/1128790d371b9aefd047ca08de603a64daf16ead/couchbase/protocol/cmd_mutate_in.hxx#L189

      Expects(operation == protocol::subdoc_opcode::remove || operation == protocol::subdoc_opcode::remove_doc);

      I expect these scenarios to behave the same and an invalid_argument error seems better.

      Attachments

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

        Activity

          People

            matt.wozakowski Matt Wozakowski
            jake.rawsthorne Jake Rawsthorne
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes