The attributes of a shard space should not be reverted to the defalut values when writing data into the shard space.

pull/759/head
Shugo Maeda 2014-07-17 14:13:15 +09:00
parent 1f180dcca5
commit 8646cb5a42
2 changed files with 11 additions and 0 deletions

View File

@ -1290,6 +1290,12 @@ func (self *ClusterConfiguration) removeShard(shard *ShardData) {
}
func (self *ClusterConfiguration) AddShardSpace(space *ShardSpace) error {
if space.Name != DEFAULT_SHARD_SPACE_NAME {
err := space.Validate(self)
if err != nil {
return err
}
}
self.shardLock.Lock()
defer self.shardLock.Unlock()
databaseSpaces := self.databaseShardSpaces[space.Database]

View File

@ -740,6 +740,11 @@ func (self *SingleServerSuite) TestCreateShardSpace(c *C) {
spaces, err = client.GetShardSpaces()
c.Assert(err, IsNil)
c.Assert(self.hasSpace("db1", "month", spaces), Equals, true)
for _, s := range spaces {
if s.Name == "month" && s.Database == "db1" {
c.Assert(s.Regex, Equals, "/^the_dude_abides/")
}
}
shards, err := client.GetShards()
c.Assert(err, IsNil)
spaceShards := self.getShardsForSpace("month", shards.All)