[SERVER-8324] split command with find fails Created: 24/Jan/13  Updated: 11/Jul/16  Resolved: 08/Feb/13

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.3.2
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Alberto Lerner
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Running the small snippet below results in:

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

var st = new ShardingTest({ shards: 2, chunkSize: 1 });
st.stopBalancer();
 
var testDB = st.s.getDB('test');
testDB.adminCommand({ enableSharding: 'test' });
testDB.adminCommand({ shardCollection: 'test.user', key: { x: 1 }});
 
var cmdRes = testDB.adminCommand({ split: 'test.user', find: { x: 987745 }});
assert(cmdRes.ok, 'Cmd failed: ' + tojson(cmdRes));
 
st.stop();



 Comments   
Comment by auto [ 08/Feb/13 ]

Author:

{u'date': u'2013-02-08T18:16:35Z', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}

Message: SERVER-8324 Fixed reporting the right error when trying to find a split point in an empty chunk.
Branch: master
https://github.com/mongodb/mongo/commit/cdd7654f2ee3f9cda255e116b0615cfeae93d86b

Comment by Alberto Lerner [ 08/Feb/13 ]

I think the split command works as desired but the error message it is emitting is confusing.

The semantics of split+find x is "split the chunk where x lives in half". If that chunk is empty, there is no way to determine what a key would be that would divide the chunk in two parts. (Note that this is not a split+middle x, in which case we'd use that key to split.)

My suggestion is to clarify the error message, saying that the chunk is empty.

Comment by Randolph Tan [ 30/Jan/13 ]

It looks like the error was raised because the chunk has no document. If you insert a couple of documents before doing the split, then the command will just run fine.

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