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

Support for a Sub-Document copy mutation spec

    XMLWordPrintable

Details

    • 1

    Description

      Background

      I'm raising this for a transactions use-case, but I believe it has broad general utility beyond that.  I'll focus on the transactions case here though.

      Our transactions operate by staging a document's mutation inside a "op.stgd" field inside the document's "txn" user xattr.  At commit point, we then write this mutation into the document's body while simultaneously deleting the "txn" xattr.

      This presently requires one of two approaches, neither of which is ideal:

      • We cache all the mutations in memory.
      • Or, we reread the document just before the commit point to get the mutation back from "txn.op.stgd".

       

      Request

      If there was a new Sub-Document spec that allowed us to copy the "txn.op.stged" field into the document's body, that would be a much more optimal solution to the problem. 

      Possibly looking something like this:

      collection.mutateIn(docId, Arrays.asList(
          MutateInSpec.copy("txn.op.stged", "").srcIsXattr(),
          MutateInSpec.remove("txn"))
      ); 

      More generally, ideally it would allow generically moving any field (xattr or not) to any other, which seems a useful tool for power users?

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-41550
          # Subject Branch Project Status CR V

          Activity

            People

              ashwin.govindarajulu Ashwin Govindarajulu
              graham.pople Graham Pople
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty