[SERVER-1892] Failed to update shard key with "change would move shards!" even though the chunk would not move Created: 05/Oct/10  Updated: 12/Jul/16  Resolved: 05/Oct/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.7.1
Fix Version/s: 1.7.2

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

db version v1.7.2-pre-, pdfile version 4.5
Tue Oct 5 16:50:28 git version: 41b422b789dd8ce8c9ae57063bc6fcca29182912


Issue Links:
Related
related to SERVER-1893 Need the ability to update the shard key Closed
Operating System: ALL
Participants:

 Description   

Problem:
Cannot update a shard_key value even if the document would still reside on the same shard.

Fails with "change would move shards!"

Reproduce:
Have setup a 2 shard system, as follows

> db.printShardingStatus()
— Sharding Status —
sharding version:

{ "_id" : 1, "version" : 3 }

shards:

{ "_id" : "shard0000", "host" : "10.194.251.95:27000" } { "_id" : "shard0001", "host" : "10.202.251.67:27000" }

databases:

{ "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "scaleout", "partitioned" : true, "primary" : "shard0000" }

scaleout.blogs chunks:
{ "ts" :

{ $minKey : 1 }

} -->>

{ "ts" : 0 }

on : shard0000

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

{ "ts" : 0 }

-->> { "ts" :

{ $maxKey : 1 }

} on : shard0001

{ "t" : 2000, "i" : 0 }

I then inserted the following

{ "_id" : ObjectId("4cab5334e9d125376ee1006d"), "author" : "jim", "clocktime" : "Tue Oct 05 2010 12:32:52 GMT-0400 (EDT)", "ts" : 1, "tags" : [ "yes", "no" ] }

This document should reside on shard001 based on the output above. However the following fails

> db.blogs.update(

{ ts : 1}

,

{ts : 2}

)
change would move shards!

Solution:
Either the error message is wrong or we should support shard_key updates within the same shard.



 Comments   
Comment by auto [ 05/Oct/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: fix error message on shard key change SERVER-1892
http://github.com/mongodb/mongo/commit/043f94b25e1e94b5be8b6d08cbeda36b0bd538ca

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