[SERVER-12380] port update improvements to batch write commands Created: 16/Jan/14  Updated: 11/Jul/16  Resolved: 17/Feb/14

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

Type: Task Priority: Major - P3
Reporter: Greg Studer Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-12347 WriteBatchExecutor should re-use an U... Closed
Participants:

 Description   

Improvements to the update code moving parsing outside the dblock should be ported to batch_executor.cpp.



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

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-12380 Port update optimizations to batch write commands.

Doing this requires that the write commands set last error themselves, rather
than depending on the assert-time setting used previously, as well as minor
restructuring of the multiUpdate() function.
Branch: master
https://github.com/mongodb/mongo/commit/85396abfc18ec3f6a15cce41f6512ec013b747a4

Comment by Githook User [ 14/Feb/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-12380 Refactor update() and receivedUpdate() for better reuse.

This patch introduces an UpdateExecutor type, that encapsulates the work of
performing a database update, described by the existing UpdateRequest type.
This includes any necessary parsing and also driving execution of the match
query and the update transformations. The UpdateExecutor interface makes it
convenient for users to prepare the operation to the greatest extent possible in
an unlocked context, without having to know the details of what that preparation
entails.
Branch: master
https://github.com/mongodb/mongo/commit/f3bbd9daf3f36b4fee3e577dcea9aa0d1aef8b11

Comment by Githook User [ 14/Feb/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-12380 Fix error that prevented UpdateDriver from being reused.

The UpdateDriver represents a document->document transformation described by the
update parameter of update-like database operations. It could already be used
repeatedly on multiple documents, so long as it represented only a single transaction.
However, it was designed to also support reprogramming to handle different transformations.
A programming error prevented this, by not clearing a piece of old state when reparsing.
Branch: master
https://github.com/mongodb/mongo/commit/7aad87285f8149e1979699d9767815740e98dff4

Comment by Greg Studer [ 16/Jan/14 ]

Notes from SERVER-12347:

In the current implementation of WriteBatchExecutor::execUpdate a new UpdateDriver object is implicitly created (under the write lock) for each update in the batch. Constructing an UpdateDriver is somewhat expensive.

However, an UpdateDriver object can be re-used, so it would be somewhat better if a single UpdateDriver object was created, than reset to handle each individual update operation in the batch. This would amortize the cost of UpdateDriver construction across all of the updates in the batch.

This would also have the nice side effect of hoisting UpdateDriver construction out of the write lock, as was done in the old update path.

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