[DOCS-2004] reIndex documentation warning is not accurate Created: 27/Sep/13  Updated: 11/Jul/16  Resolved: 27/Sep/13

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: mongodb-2.4

Type: Task Priority: Major - P3
Reporter: Sherry Ger Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 10 years, 20 weeks, 2 days ago

 Description   

The following warning from the reIndex command documentation is not accurate.

This command obtains a write lock on the affected database and will block other operations until it has completed.

The warning is only true sometimes. The reIndex command will hold a lock and block all other database operations if it is rebuilding _id index. As for all other indexes, the options that were used initially to create the index would be used to rebuild the index. For example, if ensureIndex background option were set to true, then the same option would be true for reIndex, which does not block other database activities. Conversely, if the index were build in the foreground, then reIndex would be performed in the foreground.



 Comments   
Comment by auto [ 01/Oct/13 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-2004: reindex warning
Branch: master
https://github.com/mongodb/docs/commit/6b45df66e9b569fff718a04c7a5cf554328fb601

Comment by Jeff lee [ 27/Sep/13 ]

Hi,

That sounds great.

The only suggestion I would make is to still somehow call attention to the fact that the reIndex will drop and rebuild the _id index which will cause the block. Although it's implied by the fact that the index is not

{ background:true }

, the index is created by default so I don't think people think about it.

The only reason it occurred to me that the documentation might be wrong is because someone made a comment in the forums that didn't feel right and I decided to dig a bit.

Thanks.

Comment by auto [ 27/Sep/13 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-2004: adding cross references
Branch: master
https://github.com/mongodb/docs/commit/8b8311ad95e6c650dbbc2e1400ed2832f22d869d

Comment by Sam Kleinman (Inactive) [ 27/Sep/13 ]

The warning that I removed was overly broad and added generically based on weather the implementation of the command ever took a write lock, which while true doesn't actually reflect the locking behavior in a way that would be useful to users. I think its more useful to document the locking behavior of the logical operation (building an index)...

My inclination is to cross reference to this page (http://docs.mongodb.org/manual/core/index-creation/) on all the relevant pages rather than provide specific descriptions about the locks used by various commands.

Does this make sense for you?

Comment by Jeff lee [ 27/Sep/13 ]

Hi,

I'm not sure if this comment is premature, but I originally reported this issue in DOCS-2001 ( that got changed to CS-8949 ).

The reIndex command will still block other database operations for as it rebuilds indexes that were created without the background flag ( e.g. the _id index ). Since the operation drops and recreates all indexes on the collection, it will still block for a minimum of one index, but has the potential to release the lock depending on how the other indexes are created.

The warning should be amended rather than removed. There is also another page ( http://docs.mongodb.org/manual/reference/method/db.collection.reIndex/ )that needs to be amended to be consistent with this one...I'm not sure if that was opened as a separate ticket.

Thanks.

Comment by auto [ 27/Sep/13 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-2004: removing unclear warning about the write lock of the the reIndex database command.
Branch: master
https://github.com/mongodb/docs/commit/de41eeda8fbabf31fea5e0cd8493c6ef515dfb11

Comment by Sam Kleinman (Inactive) [ 27/Sep/13 ]

removed warning about write lock.

Generated at Thu Feb 08 07:42:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.