[SERVER-7154] Bulk unique updates (similar to bulk inserts) Created: 25/Sep/12  Updated: 07/Mar/14  Resolved: 26/Sep/12

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.2.0
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: arjun kumar Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

1. There is no bulk unique updates feature. There are updates which apply to multiple documents based on query criteria, but if I have to update multiple documents querying by their unique key, I would have to do them one by one.

2. To do them one-by-one by passing j=True, is a big performance killer. With default journalling time of 100ms each update causes a 33ms delay (1/3rd time) when the next journal commit happens.

3. The only option for fast updates is not to pass j=True for every update. What we learnt from the forums is, if we update 500 documents without journaling, and then call getLastError with journalling concern, that would still only guarantee the success of the 500th record, and not all records including 1-499. Thus for 1-499 records, I would have to follow the fire-and-forget approach, and I cannot be 100% confident that they are updated and journalled successfully.

https://groups.google.com/forum/#!topic/mongodb-user/24jyqWmYIIY

To summarise, we need fast and completely safe updates, but we are not able to achieve that owing to essentially 2 reasons as we see -

i. No bulk update function to update multiple unique documents with separate criteria, similar to bulk insert.
ii. The journal is not committed immediately, but rather it waits for 1/3rd of the configured journalCommitInterval time.

We feel our problem would be solved, if bulk updates is implemented, that supports journaling parameter.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 26/Sep/12 ]

There is some confusion here.
If you call getLastError with j=true for the 500th write, you are guaranteed that any updates performed before are flushed to the journal.
What is not guaranteed is that there was not a user error, out of disk, or other type of error in those first 499.
So you could for example do a regular getLastError after each update, then after the last one, do a j=true.
Then you know that all updates worked, and they are all journalled.

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