Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-1050

Subdoc upsert with document insert flag succeeds on LCB V3 API, but fails on V4 API

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.0.0-beta1
    • 3.0.0-alpha2
    • library
    • None
    • 1

    Description

      For the LCB V3 API (AKA libcouchbase v2), PYCBC implements a subdoc upsert with fulldoc insert by setting CMDSUBDOC_F_INSERT_DOC on the lcb_CMDSUBDOC::cmdflags structure, and adding an upsert item into the lcb_CMDSUBDOC::specs structure.

      In LCB_V4 API, there is no direct access to setting the CMDSUBDOC_F_INSERT_DOC option without calling lcb_subdocops_fulldoc_add. However, this also chooses the LCB_SDCMD_SET_FULLDOC operation for a given item in the spec list. In response, libcouchbase returns a LCB_SUBDOC_VALUE_CANTINSERT error in this case ("Subdocument operation would invalidate the JSON")

      If I import the internal structure information of lcb_CMDSUBDOC and attempt to set CMDSUBDOC_F_INSERT_DOC directly and use an SD.upsert command in the spec as before it works as before.

      Should setting CMDSUBDOC_F_INSERT_DOC and adding an upsert operation to the specs be functionally equivalent to using lcb_subdocops_fulldoc_add, even though the opcode number set and sent is different? 

      If so, what might be causing the error?

      If not, is this functionality now deprecated?

       

      Attachments

        Issue Links

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

          Activity

            People

              Ellis.Breen Ellis Breen
              Ellis.Breen Ellis Breen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty