Skip to content

Commit 8b0eda8

Browse files
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.
1 parent f0af65b commit 8b0eda8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controller/cluster.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,12 @@ func (c *ClusterChecker) tryUpdateMigrationStatus(ctx context.Context, clonedClu
321321
clonedCluster.Shards[i].SlotRanges = store.RemoveSlotFromSlotRanges(clonedCluster.Shards[i].SlotRanges, shard.MigratingSlot)
322322
clonedCluster.Shards[shard.TargetShardIndex].SlotRanges = store.AddSlotToSlotRanges(
323323
clonedCluster.Shards[shard.TargetShardIndex].SlotRanges, shard.MigratingSlot)
324+
migratedSlot := shard.MigratingSlot
324325
clonedCluster.Shards[i].ClearMigrateState()
325326
if err := c.clusterStore.UpdateCluster(ctx, c.namespace, clonedCluster); err != nil {
326327
log.Error("Failed to update the cluster", zap.Error(err))
327328
} else {
328-
log.Info("Migrate the slot successfully", zap.Int("slot", shard.MigratingSlot))
329+
log.Info("Migrate the slot successfully", zap.Int("slot", migratedSlot))
329330
}
330331
c.updateCluster(clonedCluster)
331332
default:

0 commit comments

Comments
 (0)