From 140923722fbac014f1f7a98ab6fba2bd37b93130 Mon Sep 17 00:00:00 2001 From: Andrey Zvonov <32552679+zvonand@users.noreply.github.com> Date: Wed, 28 Jan 2026 11:04:01 +0100 Subject: [PATCH] Merge pull request #1343 from Altinity/backports/25.8.15/90243 25.8.15 Stable backport of #90243: Fix crash in StorageDistributed when parsing malformed shard directory names --- src/Storages/StorageDistributed.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index e9336640334f..52f9c0dcf4ee 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -2015,9 +2015,11 @@ Cluster::Addresses StorageDistributed::parseAddresses(const std::string & name) continue; } - if (address.replica_index > replicas) + if (address.replica_index == 0 || address.replica_index > replicas) { - LOG_ERROR(log, "No shard with replica_index={} ({})", address.replica_index, name); + LOG_ERROR(log, "Invalid replica_index={} for directory '{}' (cluster has {} replicas for shard {}). " + "Expected directory format: 'shardN_replicaM' or 'shardN_all_replicas'", + address.replica_index, dirname, replicas, address.shard_index); continue; }