Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12578

Support in-place update of object/array elements when safe to do so

    • Fully Compatible

      We currently only support in-place element updates for primitive types. In-place updates for complex types is tricky, because even if the new object or array has the same size as the existing object, its internal layout may differ.

      That means that any Element objects that referred to regions of memory in the original layout would be invalidated once the damage vector was applied. Currently, the semantics of Document is that Elements are never invalidated.

      We could either:

      • State that you must abandon your Document after applying the damage vector to the supporting BSONObj, in which case we could simply enable support for in-place updates with object/array types right away, or:
      • Restrict applying in-place updates to object/array types to the case where the object or array to be updated in-place has opaque children, meaning that we had never formed any Element objects that referred into that region of memory, meaning that no Elements would be invalidated by the update.

        1. inplace_object_rewrite.js
          0.6 kB
          Andrew Morrow

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: