# UNDF: UNDF-2026-000000745 # UNDF: (leave blank) --- a/clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNodes.java +++ b/clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNodes.java @@ -324,10 +324,10 @@ public class ClickHouseNodes implements ClickHouseNodeManager { * List of healthy nodes. */ - protected final LinkedList nodes; + protected final LinkedHashSet nodes; /** * List of faulty nodes. */ - protected final LinkedList faultyNodes; + protected final LinkedHashSet faultyNodes; @@ -373,8 +373,8 @@ public class ClickHouseNodes implements ClickHouseNodeManager { this.checking = new AtomicBoolean(false); this.index = new AtomicInteger(0); this.lock = new ReentrantReadWriteLock(); - this.nodes = new LinkedList<>(); // usually just healthy nodes - this.faultyNodes = new LinkedList<>(); + this.nodes = new LinkedHashSet<>(); // O(1) contains for load-balancing hot path + this.faultyNodes = new LinkedHashSet<>(); // O(1) contains for health check