[SERVER-1317] background index creation blocks "creation" of existing indexes Created: 29/Jun/10  Updated: 12/Jul/16  Resolved: 23/Sep/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.4.2
Fix Version/s: 1.7.1

Type: Bug Priority: Major - P3
Reporter: Adam Fields Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux, 64-bit


Issue Links:
Duplicate
is duplicated by SERVER-2444 GridFS calls ensureIndex, which cause... Closed
Operating System: ALL
Participants:

 Description   

When background creating an index, creation of other indexes is blocked, as described in the docs: "Only one index build at a time is permitted per collection.". However, this has the side effect that index creation of other indexes fails even if the index already exists. This is a specific problem when called indirectly from an ORM such as mongoid which tries to create indexes for its models on initialization. As a result, a server (e.g.: a rails instance) that uses that ORM cannot be restarted while a background index build is in progress because the attempted index creation (even though the index already exists) fails.

The error message from the mongo driver:

/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo-1.0.1/lib/../lib/mongo/collection.rb:406:in `create_index':Mongo::OperationFailure: Failed to create index {:key=>

{"status"=>1}

, :unique=>false, :name=>"status_1", :ns=>"thatdb.messages"}

This error went away as soon as the background index creation was done.

The ideal fix would be to allow multiple indexes to be created at once. A short term fix would be to have ensureIndex return success if the index already exists, regardless of what else might be happening.



 Comments   
Comment by auto [ 23/Sep/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: check for background indexing in progress after dup check SERVER-1317
http://github.com/mongodb/mongo/commit/c088ca1af8b410248aea7cfdda58c17550215f5e

Generated at Thu Feb 08 02:56:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.