[SERVER-12980] Background fields are not ignored when comparing index spec equality Created: 28/Feb/14  Updated: 11/Jul/16  Resolved: 03/Mar/14

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: 2.6.0-rc1

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: J Rassi
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-13208 The dropDups index option should be i... Closed
is related to SERVER-10879 ensureIndex() on existing text index ... Closed
Operating System: ALL
Steps To Reproduce:

var coll = db.newColl;
coll.drop();
 
coll.ensureIndex({foo: 1}, {background: false});
coll.ensureIndex({foo: 1});

Participants:

 Description   

If you have two index specs that are the same except for the presence of a 'background' field, ensureIndexes will no longer treat them as identical specs. This bug is a result of the changes from SERVER-10879.

Error with master:

> var coll = db.newColl;
> coll.drop();
true
> 
> coll.ensureIndex({foo: 1}, {background: false});
WriteResult({ "nInserted" : 1 })
> coll.ensureIndex({foo: 1});
WriteResult({
	"nInserted" : 0,
	"writeError" : {
		"code" : 67,
		"errmsg" : "Index with name: foo_1 already exists with different options"
	}
})

No error with 2.4.9:

> var coll = db.newColl;
> coll.drop();
true
> 
> coll.ensureIndex({foo: 1}, {background: false});
> coll.ensureIndex({foo: 1});
> 
 


Version: 914a26f51ff7ffeb28922273925318da6a6eba71



 Comments   
Comment by Githook User [ 03/Mar/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-12980 Index spec equality check: don't consider 'background'
Branch: master
https://github.com/mongodb/mongo/commit/8ea1893b027876922bb16a09fa9d4691946f7700

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