[SERVER-3080] chunkSplit doesn't check order of fields in compound key in 'middle' param and damages config.chunks collection Created: 11/May/11  Updated: 12/Jul/16  Resolved: 20/Jun/11

Status: Closed
Project: Core Server
Component/s: Internal Code, Sharding
Affects Version/s: 1.8.1
Fix Version/s: 1.9.1

Type: Bug Priority: Major - P3
Reporter: Sergey Tikhonov Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux x64


Operating System: ALL
Participants:

 Description   

First, sharding:

> db.adminCommand( { shardcollection : "test.insert_test", key :

{"b":1,"a":1}

});

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

Then splitting (look at 'a' and 'b' order in shard key and split):

> db.adminCommand( { split : "test.insert_test" , middle :

{ 'a' : 0,'b':1 }

} )

{ "ok" : 1 }

> use config
switched to db config
> db.chunks.find()
{ "_id" : "test.insert_test-b_MinKeya_MinKey", "lastmod" :

{ "t" : 1000, "i" : 1 }

, "ns" : "test.insert_test", "min" : { "b" :

{ $minKey : 1 }

, "a" :

{ $minKey : 1 }

}, "max" :

{ "a" : 0, "b" : 1 }

, "shard" : "shard0000" }
{ "_id" : "test.insert_test-a_0.0b_1.0", "lastmod" :

{ "t" : 1000, "i" : 2 }

, "ns" : "test.insert_test", "min" :

{ "a" : 0, "b" : 1 }

, "max" : { "b" :

{ $maxKey : 1 }

, "a" :

{ $maxKey : 1 }

}, "shard" : "shard0000" }

after that any moveChunk command will fail with "Chunk map pointed to incorrect chunk" message, because BSONObj::woCompare, used for searching for a chunk, can't compare

{'a':1,'b':0}

with

{'b':0, 'a':1}

 Comments   
Comment by Mathias Stearn [ 20/Jun/11 ]

This will now error out before doing the split

Comment by auto [ 20/Jun/11 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: Don't allow manual split-point with different field order SERVER-3080
Branch: master
https://github.com/mongodb/mongo/commit/03736f9567b3fccccf92d4973ecfc40d680fb944

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