[SERVER-12547] Implement support for bulk rightward copy of opaque regions when serializing mutable documents Created: 30/Jan/14  Updated: 11/Jul/16  Resolved: 08/Feb/14

Status: Closed
Project: Core Server
Component/s: Internal Code, Write Ops
Affects Version/s: None
Fix Version/s: 2.6.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: Performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File flat_update.js    
Issue Links:
Related
related to SERVER-13521 Allow fast $push to front of an array Backlog
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Currently, if a BSON Object in a mutable Document tree has had a change applied to one of its children, then the ElementRep for that Object is marked as deserialized.

When we ask for a BSONObj representing the current state of the Document, the algorithm for serializing a de-serialized Object Element requires that we individually walk, represent, and then serialize each of its children.

However, if we had never explored some rightward subregion of the Object (e.g. its right child pointer is opaque, and one of its realized children has an opaque right pointer), then that opaque region could be bulk copied, rather than walked. Doing a bulk copy would avoid the overhead of ElementRep creation for all of the demonstrably unaltered children.

This would be particularly effective when updating "flat" documents like:

{ flat :

{ k_0 : a, k_1 : b, ... k_N : zz }

}

with updates like { $set :

{ flat.k_small : x }

}

since otherwise we would need to form ElementReps for all N Elements. Having support for bulk rightward copy would allow us to short circuit ElementRep construction once we had realized the ElementRep for flat.k_small.



 Comments   
Comment by Githook User [ 08/Feb/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-12547 Implement bulk rightward copying of opaque regions in mutable
Branch: master
https://github.com/mongodb/mongo/commit/ce632548f3053a49ac2f2763663d21eee1ce14bc

Comment by Andrew Morrow (Inactive) [ 07/Feb/14 ]

Code review url: http://codereview.10gen.com/6522285024346112/

Generated at Thu Feb 08 03:28:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.