This is an automated email from the ASF dual-hosted git repository.
hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks-controller.git
The following commit(s) were added to refs/heads/unstable by this push:
new 8b0eda8 migration: fix log for slot migration success (#277)
8b0eda8 is described below
commit 8b0eda8ce2e272c01329e6a9fb39edcdc54b1c4f
Author: travisshivers <[email protected]>
AuthorDate: Wed Mar 19 03:29:55 2025 -0500
migration: fix log for slot migration success (#277)
Previously, the code was trying to log the migrated slot after
calling ClearMigrateState, which set the migrated slot to -1.
Instead, capture the slot number so we can properly log it later.
---
controller/cluster.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/controller/cluster.go b/controller/cluster.go
index 1b642da..c613d60 100644
--- a/controller/cluster.go
+++ b/controller/cluster.go
@@ -321,11 +321,12 @@ func (c *ClusterChecker) tryUpdateMigrationStatus(ctx
context.Context, clonedClu
clonedCluster.Shards[i].SlotRanges =
store.RemoveSlotFromSlotRanges(clonedCluster.Shards[i].SlotRanges,
shard.MigratingSlot)
clonedCluster.Shards[shard.TargetShardIndex].SlotRanges
= store.AddSlotToSlotRanges(
clonedCluster.Shards[shard.TargetShardIndex].SlotRanges, shard.MigratingSlot)
+ migratedSlot := shard.MigratingSlot
clonedCluster.Shards[i].ClearMigrateState()
if err := c.clusterStore.UpdateCluster(ctx,
c.namespace, clonedCluster); err != nil {
log.Error("Failed to update the cluster",
zap.Error(err))
} else {
- log.Info("Migrate the slot successfully",
zap.Int("slot", shard.MigratingSlot))
+ log.Info("Migrate the slot successfully",
zap.Int("slot", migratedSlot))
}
c.updateCluster(clonedCluster)
default: