[SERVER-6069] maxChunksize error when using 'find' instead of 'middle' with the 'split' command. Created: 11/Jun/12  Updated: 11/Jul/16  Resolved: 06/Mar/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.0.4
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: q Assignee: Greg Studer
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux (virtual) #28-Ubuntu SMP Fri Jan 27 18:22:35 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric

Total of four ec2 instances with the following configuration:
server 1 running mongos
server 2 running mongod, config server (shard1)
server 3 running mongod, config server (shard2)
server 4 running mongod, config server (shard3)

Using the mongodb-10gen repo from apt-get.


Operating System: OS X
Participants:

 Description   

Issue is while trying to pre-split a chunk on a sharded collection using the 'find', 'to' split options. Using the 'middle' option works as shown below:

MongoDB shell version: 2.0.6
connecting to: test
mongos> db.createCollection('test');

{ "ok" : 1 }

mongos> use admin
switched to db admin
mongos> db.runCommand(

{enablesharding: 'test'}

);

{ "ok" : 1 }

mongos> db.runCommand({'shardcollection': 'test.test', key: {'key1': 1, 'key2': 1}});

{ "collectionsharded" : "test.test", "ok" : 1 }

mongos> db.runCommand({split: 'test.test', find:

{ 'key1': 1, 'key2': 1 }

, to: { 'key1': 6, 'key2': 6 }});
{
"assertion" : "splitVector command (median key) failed:

{ errmsg: \"need to specify the desired max chunk size (maxChunkSize or maxChunkSizeBytes)\", ok: 0.0 }

",
"assertionCode" : 13503,
"errmsg" : "db assertion failure",
"ok" : 0
}
mongos> db.runCommand({split: 'test.test', find:

{ 'key1': 1, 'key2': 1 }

, to:

{ 'key1': 5, 'key2': 5 }

, maxChunkSize: 16});
{
"assertion" : "splitVector command (median key) failed:

{ errmsg: \"need to specify the desired max chunk size (maxChunkSize or maxChunkSizeBytes)\", ok: 0.0 }

",
"assertionCode" : 13503,
"errmsg" : "db assertion failure",
"ok" : 0
}
mongos> db.runCommand({split: 'test.test', middle: { 'key1': 3, 'key2': 3 }});

{ "ok" : 1 }

I've also tried increasing and decreasing the chunk size from the config db with no changes to the above error message.



 Comments   
Comment by Jenna deBoisblanc [ 09/Oct/12 ]

Using 2.2.0

db.runCommand( { split : "oct9.oct9" , find :

{ name: "Isaac" }

} )

fails if oct9 is an empty collection. Error message:

{
        "errmsg" : "exception: splitVector command (median key) failed: { errmsg: \"need to specify the desired max chunk size (maxChunkSize or maxChunkSizeBytes)\", ok: 0.0 }"
	"code" : 13503,
	"ok" : 0
}

using "middle" instead of "find" works.

Comment by q [ 13/Jun/12 ]

My misunderstanding. Thanks for the explanation.

Comment by Greg Studer [ 12/Jun/12 ]

The error message is wrong - but think this is undefined behavior - "to" is not a documented option in the split command.

http://www.mongodb.org/display/DOCS/Splitting+Shard+Chunks

There's no need to specify a "to" field because a split always breaks an existing chunk into two parts, by splitting at one point. The initial chunk is $MinKey->$MaxKey.

Think the desired behavior here is just :

db.runCommand({split: 'test.test', middle:

{ 'key1': 1, 'key2': 1 }

})
db.runCommand({split: 'test.test', middle:

{ 'key6': 1, 'key2': 6 }

})

Comment by Eliot Horowitz (Inactive) [ 12/Jun/12 ]

Was there any data in the collection?

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