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

MagmaKVStore incorrectly returns no_such_key for all errors

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown
    • KV 2023-4

    Description

      MagmaKVStore::getMulti uses Magma::GetDocs to answer GET queries:

      https://github.com/couchbase/kv_engine/blob/3d8ed5630db8138c320971a1d96cbffffd7b59f4/engines/ep/src/kvstore/magma-kvstore/magma-kvstore.cc#L1100

      It uses magmaErr2EnginerErr for error handling. Current implementation is:

      cb::engine_errc MagmaKVStore::magmaErr2EngineErr(Status::Code err, bool found) {
          if (!found) {
              return cb::engine_errc::no_such_key;
          }
          // This routine is intended to mimic couchErr2EngineErr.
          // Since magma doesn't have a memory allocation error, all magma errors
          // get translated into cb::engine_errc::temporary_failure.
          if (err == Status::Code::Ok) {
              return cb::engine_errc::success;
          }
          return cb::engine_errc::temporary_failure;
      } 

      It always returns no_such_key when found=false. But found will always be false in presence of errors. We shouldn't  return no_such_key in all such cases. That would be alarming and falsely indicate data loss.

      The error handling needs to be granular wrt to the Status::Code. For example a IOError is temporary and hence we should return temporary_failure.

      Attachments

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

        Activity

          People

            rohan.suri Rohan Suri
            rohan.suri Rohan Suri
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty