fix(sharding): fix log format verb and document intentional shard-0 fallback (#27222)

Signed-off-by: nitishfy <justnitish06@gmail.com>
Signed-off-by: Nitish Kumar <justnitish06@gmail.com>
Co-authored-by: Soumya Ghosh Dastidar <44349253+gdsoumya@users.noreply.github.com>
This commit is contained in:
Nitish Kumar 2026-04-08 18:55:45 +05:30 committed by GitHub
parent d3b06f113f
commit 212f51d851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -222,7 +222,10 @@ func createConsistentHashingWithBoundLoads(replicas int, getCluster clusterAcces
} }
shardIndexedByCluster[c.ID], err = strconv.Atoi(clusterIndex) shardIndexedByCluster[c.ID], err = strconv.Atoi(clusterIndex)
if err != nil { 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] numApps, ok := appDistribution[c.Server]
if !ok { if !ok {