Details
-
Improvement
-
Resolution: Fixed
-
Major
-
6.6.0
-
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
- relates to
-
MB-42111 Support for doing CAS operation to turn a deleted document to a live document
- Open
For Gerrit Dashboard: MB-41550 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
136775,13 | MB-41550: Add new command SubdocReplaceBodyWithXattr | master | kv_engine | Status: MERGED | +2 | +1 |
138165,2 | MB-41550: Add hello flag for SubdocReplaceBodyWithXattr | master | kv_engine | Status: MERGED | +2 | +1 |
138229,13 | MB-41550: Allow SubdocReplaceBodyWithXattr to revive documents | master | kv_engine | Status: MERGED | +2 | +1 |