-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
0
Currently the update system calls into updateDocument() with a full replacement, unless we were able to calculate damages using mutablebson.
updateDocument() attempts to compute a diff using wt_calc_modify(), here, which scans over the row and attempts to compute a set of damages. In most cases, we compute a doc_diff before we reach this path. Furthermore, we have a way of computing a damage vector from a doc_diff done and in the codebase.
In a conversation with ernesto.rodriguez@mongodb.com, Ernesto made the observation that we could easily achieve a strict improvement if we convert the doc diff to damages, and then, assuming the existing criteria for damages are met, call updateDocumentWithDamages() directly. If not, we can update the full document and avoid the call to calc_modify. In both cases, we are performing the same type of update, with less work.
In the future, we could use updateDocumentWithDamages() even more often, but that would likely be larger than a single ticket's worth of work.