apache / kvrocks-controller

Apache Kvrocks Controller is a cluster management tool for Apache Kvrocks.
https://kvrocks.apache.org/
Apache License 2.0
86 stars 44 forks source link

suggest to enable retry migrating the same slot and target shard #221

Open greatsharp opened 1 week ago

greatsharp commented 1 week ago

https://github.com/apache/kvrocks-controller/blob/2649b8f08c1bbc851509a4f182970d3294216def/store/cluster.go#L203C1-L205C3

in controller/cluster.go, method tryUpdateMigrationStatus, it may not get migrating_state or migrating_slot data when executing 'cluster info' cmd on a master node, then switch will select the default case, then the migrating_slot and target_shard_index in cluster info can not be updated any more. this will stop any slot migrate.

suggest to enable retry migrating the same slot and target shard, if cluster.Shards[sourceShardIdx].IsMigrating() || cluster.Shards[targetShardIdx].IsMigrating() { if !(cluster.Shards[sourceShardIdx].MigratingSlot == slot && cluster.Shards[sourceShardIdx].TargetShardIndex == targetShardIdx) { return consts.ErrShardSlotIsMigrating } }

let the cluster node can exec the 'clusterx migrate' cmd again.

git-hulk commented 1 week ago

@greatsharp Makes sense.