From 212f51d851dcb15bc84c8bd4e29d6cbdebcf0eca Mon Sep 17 00:00:00 2001 From: Nitish Kumar Date: Wed, 8 Apr 2026 18:55:45 +0530 Subject: [PATCH] fix(sharding): fix log format verb and document intentional shard-0 fallback (#27222) Signed-off-by: nitishfy Signed-off-by: Nitish Kumar Co-authored-by: Soumya Ghosh Dastidar <44349253+gdsoumya@users.noreply.github.com> --- controller/sharding/sharding.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controller/sharding/sharding.go b/controller/sharding/sharding.go index 7910065e09..990e4c547a 100644 --- a/controller/sharding/sharding.go +++ b/controller/sharding/sharding.go @@ -222,7 +222,10 @@ func createConsistentHashingWithBoundLoads(replicas int, getCluster clusterAcces } shardIndexedByCluster[c.ID], err = strconv.Atoi(clusterIndex) if err != nil { - log.Errorf("Consistent Hashing was supposed to return a shard index but it returned %d", err) + log.Errorf("Failed to get shard index from consistent hashing, error=%v", err) + // No continue here: strconv.Atoi returns 0 on failure, so the cluster falls back to shard 0. + // This is intentional since shard 0 always exists (replicas > 0 is enforced by the caller), + // so the cluster remains reconciled rather than being silently dropped. } numApps, ok := appDistribution[c.Server] if !ok {