[SERVER-14037] Parallel arrays in distinct sub-documents no longer cause an indexing error Created: 22/May/14  Updated: 11/Jul/16  Resolved: 24/May/14

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

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

Issue Links:
Related
is related to SERVER-8192 Optimize btree key generation Closed
Operating System: ALL
Steps To Reproduce:

var myDB = db.getSiblingDB('btree');
myDB.dropDatabase();
 
myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});

Participants:

 Description   

This bug appears to be a regression from SERVER-8192. In 2.6.1, documents that contain parallel arrays in distinct sub-documents are not allowed to be inserted when a corresponding index is present:

2.6.1:

> var myDB = db.getSiblingDB('btree');
> myDB.dropDatabase();
{ "dropped" : "btree", "ok" : 1 }
 
> myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
{
	"createdCollectionAutomatically" : true,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
WriteResult({
	"nInserted" : 0,
	"writeError" : {
		"code" : 10088,
		"errmsg" : "insertDocument :: caused by :: 10088 cannot index parallel arrays [a] [a]"
	}
})

2.6.2-pre w/ SERVER-8192 patch:

> var myDB = db.getSiblingDB('btree');
> myDB.dropDatabase();
{ "dropped" : "btree", "ok" : 1 }
 
> myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
{
	"createdCollectionAutomatically" : true,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
WriteResult({ "nInserted" : 1 })

master:

> var myDB = db.getSiblingDB('btree');
> myDB.dropDatabase();
{ "dropped" : "btree", "ok" : 1 }
 
> myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
{
	"createdCollectionAutomatically" : true,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
WriteResult({ "nInserted" : 1 })


Version: 9c3edc610c7f52a3d502fbc50e0acc55b5efa645


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