[SERVER-38405] splitVector command fails on a collection with collation Created: 05/Dec/18  Updated: 05/Dec/18  Resolved: 05/Dec/18

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

Type: Bug Priority: Major - P3
Reporter: Chetan Paithane Assignee: Kelsey Schubert
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

 

mongos> use chetan
switched to db chetan
mongos> db.createCollection("contacts", {collation: {locale: "fr"}})
{ "ok" : 1 }
mongos> db.contacts.insert({category : 1})
WriteResult({ "nInserted" : 1 })
mongos> db.contacts.insert({category : 2})
WriteResult({ "nInserted" : 1 })
mongos> db.contacts.insert({category : 3})
WriteResult({ "nInserted" : 1 })
mongos> db.contacts.insert({category : 4})
WriteResult({ "nInserted" : 1 })
mongos> db.contacts.insert({category : 5})
WriteResult({ "nInserted" : 1 })
mongos> db.runCommand({splitVector : "chetan.contacts", keyPattern : { "_id" : 1}, maxChunkSize : 256})
{
 "ok" : 0,
 "errmsg" : "couldn't find index over splitting key { _id: 1.0 }",
 "code" : 27,
 "codeName" : "IndexNotFound"
}
mongos>

mongos> db.getCollectionInfos()
[
 {
 "name" : "contacts",
 "type" : "collection",
 "options" : {
 "collation" : {
 "locale" : "fr",
 "caseLevel" : false,
 "caseFirst" : "off",
 "strength" : 3,
 "numericOrdering" : false,
 "alternate" : "non-ignorable",
 "maxVariable" : "punct",
 "normalization" : false,
 "backwards" : false,
 "version" : "57.1"
 }
 },
 "info" : {
 "readOnly" : false
 },
 "idIndex" : {
 "v" : 2,
 "key" : {
 "_id" : 1
 },
 "name" : "_id_",
 "ns" : "chetan.contacts",
 "collation" : {
 "locale" : "fr",
 "caseLevel" : false,
 "caseFirst" : "off",
 "strength" : 3,
 "numericOrdering" : false,
 "alternate" : "non-ignorable",
 "maxVariable" : "punct",
 "normalization" : false,
 "backwards" : false,
 "version" : "57.1"
 }
 }
 }
]
 

 

Participants:

 Description   

I created a collection with collation specified.

Wrote 5 documents in the collection.

Ran splitVector command. But, hit an error that "couldn't find index over splitting key { _id: 1.0 }"

Commands performed in Mongodb shell are written in "Steps to Reproduce" section.

Any help in alternative solution to splitVector is appreciated.



 Comments   
Comment by Chetan Paithane [ 05/Dec/18 ]

Thanks for help. I verified steps specified by you. It worked for me.  This bug can be resolved.

mongos> db.contacts.createIndex( { _id: 1, category : 1 }, { collation:

{ locale: "simple" }

})
{
"raw" : {
"rst9/192.168.1.23:27201,192.168.1.23:27203" :

{ "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 }

},
"ok" : 1
}
mongos> db.runCommand({splitVector : "chetan.contacts", keyPattern :

{ "_id" : 1}

, maxChunkSize : 256})

{ "splitKeys" : [ ], "ok" : 1 }

mongos>

 

Comment by Dmitry Ryabtsev [ 05/Dec/18 ]

The command will work if an index with the simple locale is created first, e.g. this will work:

db.createCollection("contacts", {collation: {locale: "fr"}})
db.contacts.insert({category : 1})
db.contacts.insert({category : 2})
db.contacts.insert({category : 3})
db.contacts.insert({category : 4})
db.contacts.insert({category : 5})
db.contacts.createIndex( { _id: 1, c: 1 }, { collation: { locale: "simple" } } )
db.runCommand({splitVector : "test.contacts", keyPattern : { "_id" : 1}, maxChunkSize : 256})

Generated at Thu Feb 08 04:48:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.