SplitVector Command failed

219 views
Skip to first unread message

juhi bhatia

unread,
Feb 9, 2012, 12:57:32 AM2/9/12
to mongodb-user
Hi

I am in testing phase and testing my apps performance with inserting a
million records in mongodb.

After 239673 number of records got inserted in mongodb, I am getting
following error at mongos.log :

Wed Feb 8 14:37:40 [conn16] warning: could have autosplit on
collection: emgda.elements but: splitVector command failed: { errmsg:
"couldn't find index over splitting key", ok: 0.0 }
Wed Feb 8 14:37:40 [conn16] warning: could have autosplit on
collection: emgda.elements but: splitVector command failed: { errmsg:
"couldn't find index over splitting key", ok: 0.0 }
Wed Feb 8 14:37:40 [conn16] warning: could have autosplit on
collection: emgda.elements but: splitVector command failed: { errmsg:
"couldn't find index over splitting key", ok: 0.0 }

For the collection emgda.elements:
The dataSize is : 61395840
The storageSize is: 86114304
The totalSize is : 170809488

What does this error mean?

db.printCollectionStats() gives the following:

elements
{
"sharded" : true,
"flags" : 1,
"ns" : "emgda.elements",
"count" : 239673,
"numExtents" : 11,
"size" : 61395840,
"storageSize" : 86114304,
"totalIndexSize" : 84695184,
"indexSizes" : {
"_id_" : 7791728,
"createdTimestamp_1" : 6712496,
"customerId_1" : 6892368,
"customerId_1_elementId_1_createdTimestamp_1" :
17128720,

"customerId_1_siteId_1_elementId_1_createdTimestamp_1" : 24528000,
"elementId_1" : 9966544,
"siteId_1" : 11675328
},
"avgObjSize" : 256.16502484635316,
"nindexes" : 7,
"nchunks" : 1,
"shards" : {
"shard1" : {
"ns" : "emgda.elements",
"count" : 239673,
"size" : 61395840,
"avgObjSize" : 256.16502484635316,
"storageSize" : 86114304,
"numExtents" : 11,
"nindexes" : 7,
"lastExtentSize" : 20881408,
"paddingFactor" : 1,
"flags" : 1,
"totalIndexSize" : 84695184,
"indexSizes" : {
"_id_" : 7791728,
"createdTimestamp_1" : 6712496,
"siteId_1" : 11675328,
"elementId_1" : 9966544,
"customerId_1" : 6892368,

"customerId_1_elementId_1_createdTimestamp_1" : 17128720,

"customerId_1_siteId_1_elementId_1_createdTimestamp_1" : 24528000
},
"ok" : 1
}
},
"ok" : 1
}
---
system.indexes
{
"sharded" : false,
"primary" : "shard1",
"ns" : "emgda.system.indexes",
"count" : 7,
"size" : 784,
"avgObjSize" : 112,
"storageSize" : 12288,
"numExtents" : 1,
"nindexes" : 0,
"lastExtentSize" : 12288,
"paddingFactor" : 1,
"flags" : 0,
"totalIndexSize" : 0,
"indexSizes" : {

},
"ok" : 1
}
---

juhi bhatia

unread,
Feb 9, 2012, 9:31:11 AM2/9/12
to mongodb-user
Could get rid of the error.

Mongo expects an index on the shard key:
http://www.mongodb.org/display/DOCS/Configuring+Sharding#ConfiguringSharding-ShardingaCollection
(Though not clearly mentioned).

BTW.. It also says that if the index is not created and the collection
does not contain any data, it will be created automatically.

This was not the case with me. I pre-sharded the collection.

Can anyone identify it?

Scott Hernandez

unread,
Feb 9, 2012, 10:33:04 AM2/9/12
to mongod...@googlegroups.com
What is your shard key? What version did you shard with? The server
does stop you from sharding a collection if you don't have an index on
the shard key since at least 2.0.0.

What does I "pre-sharded the collection" mean? Just that you had no
data before enabling sharding?

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

juhi bhatia

unread,
Feb 11, 2012, 12:41:36 AM2/11/12
to mongodb-user
I am using mongodb v2.0.2. and sharded on this version itself. My
shard key is {customerId, siteId, elementId}.
"pre-sharded collection" meaning, i configured sharding first and then
started inserting data in mongodb.
Configuring sharding went fine without any errors. After i got these
errors i added an index on shard key
and everything went fine and still going as expected.

On Feb 9, 8:33 pm, Scott Hernandez <scotthernan...@gmail.com> wrote:
> What is your shard key? What version did you shard with? The server
> does stop you from sharding a collection if you don't have an index on
> the shard key since at least 2.0.0.
>
> What does I "pre-sharded the collection" mean? Just that you had no
> data before enabling sharding?
>
>
>
>
>
>
>
> On Thu, Feb 9, 2012 at 9:31 AM, juhi bhatia <bhatia.juhi...@gmail.com> wrote:
> > Could get rid of the error.
>
> > Mongo expects an index on the shard key:
> >http://www.mongodb.org/display/DOCS/Configuring+Sharding#ConfiguringS...

Eliot Horowitz

unread,
Feb 11, 2012, 10:27:37 PM2/11/12
to mongod...@googlegroups.com
Can you check the indexes on all shards?

juhi bhatia

unread,
Feb 12, 2012, 11:42:58 PM2/12/12
to mongodb-user
mongos> db.elements.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "emgda.elements",
"name" : "_id_"
},
{
"v" : 1,
"key" : {
"createdTimestamp" : 1
},
"ns" : "emgda.elements",
"name" : "createdTimestamp_1"
},
{
"v" : 1,
"key" : {
"siteId" : 1
},
"ns" : "emgda.elements",
"name" : "siteId_1"
},
{
"v" : 1,
"key" : {
"elementId" : 1
},
"ns" : "emgda.elements",
"name" : "elementId_1"
},
{
"v" : 1,
"key" : {
"customerId" : 1
},
"ns" : "emgda.elements",
"name" : "customerId_1"
},
{
"v" : 1,
"key" : {
"customerId" : 1,
"elementId" : 1,
"createdTimestamp" : 1
},
"ns" : "emgda.elements",
"name" : "customerId_1_elementId_1_createdTimestamp_1"
},
{
"v" : 1,
"key" : {
"customerId" : 1,
"siteId" : 1,
"elementId" : 1,
"createdTimestamp" : 1
},
"ns" : "emgda.elements",
"name" :
"customerId_1_siteId_1_elementId_1_createdTimestamp_1"
},
]

These were the indexes when I got the errors.

{
"v" : 1,
"key" : {
"customerId" : 1,
"siteId" : 1,
"elementId" : 1
},
"ns" : "emgda.elements",
"name" : "customerId_1_siteId_1_elementId_1"
}

This was the index i added after i got these errors, and since then
everything is working fine.
Reply all
Reply to author
Forward
0 new messages