[SERVER-10684] Multiple indexes created when ensureIndex is called a lot with background = True Created: 05/Sep/13  Updated: 10/Dec/14  Resolved: 05/Sep/13

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.4.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Walt Woods Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu


Issue Links:
Duplicate
duplicates SERVER-9856 No check for building identical backg... Closed
Operating System: ALL
Steps To Reproduce:

Create about (in our case 80) different threads that call ensureIndex with the same index spec, and background = True.

Participants:

 Description   

Part of our mongodb model code involves calling ensureIndex() with background = True rather frequently. Or, did. We had to change it because it was creating literally hundreds of db.currentOp() entries relating to building the same index over and over. Our end result even after putting in a safe guard (which checks pymongo.index_information to see if anyone is creating this index) is ridiculous:

[
{
"v" : 1,
"key" :

{ "_id" : 1 }

,
"ns" : "dealer_1.item",
"name" : "id"
},
{
"v" : 1,
"key" :

{ "a" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "a_1"
},
{
"v" : 1,
"key" :

{ "s" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "s_1"
},
{
"v" : 1,
"key" :

{ "s" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "s_1"
},
{
"v" : 1,
"key" :

{ "u" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "u_1"
},
{
"v" : 1,
"key" :

{ "a" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "a_1"
},
{
"v" : 1,
"key" :

{ "a" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "a_1"
},
{
"v" : 1,
"key" :

{ "s" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "s_1"
},
{
"v" : 1,
"key" :

{ "u" : 1 }

,
"ns" : "dealer_1.item",
"background" : true,
"name" : "u_1"
}
]

As you can see, multiple indexes with the same key, namespace, and name. This is troubling.



 Comments   
Comment by Walt Woods [ 05/Sep/13 ]

Good call, we have several deployments, most of which are on 2.4.5. This one is on 2.4.4. Sorry, but thank you for the quick response!

Comment by J Rassi [ 05/Sep/13 ]

It would seem that this is a dup of SERVER-9856, but that was supposed to have been fixed in 2.4.5. I noticed you listed "affects version: 2.4.5" – are you sure these were created with server version 2.4.5?

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