From fb81270c2c26198310b09fdc8322644f46e0b4fc Mon Sep 17 00:00:00 2001 From: water <672684719@qq.com> Date: Tue, 25 Aug 2026 05:08:37 +0800 Subject: [PATCH] fix: Make HttpLoadQueuePeon degrade gracefully instead of throwing on fetch failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a historical server returns a non-200/404 response or is unreachable, fetchSegmentLoadingCapabilities() throws an RE, which propagates through LoadQueueTaskMaster.resetPeonsForNewServers() into PrepareBalancerAndLoadQueues. The top-level DruidCoordinator.DutiesRunnable.run() catches and logs it, but segment management stops entirely for ALL servers — not just the unhealthy one. Fix: degrade gracefully by returning default SegmentLoadingCapabilities derived from the configured batch size, with a warning log. The peon is still created, the server is still managed with conservative defaults, and the rest of the duty group proceeds normally. --- .../coordinator/loading/HttpLoadQueuePeon.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/apache/druid/server/coordinator/loading/HttpLoadQueuePeon.java b/server/src/main/java/org/apache/druid/server/coordinator/loading/HttpLoadQueuePeon.java index 37ebaa8d9a07..b402c729dc8e 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/loading/HttpLoadQueuePeon.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/loading/HttpLoadQueuePeon.java @@ -178,7 +178,13 @@ private SegmentLoadingCapabilities fetchSegmentLoadingCapabilities() return defaultCapabilities; } else if (HttpServletResponse.SC_OK != responseHandler.getStatus()) { log.makeAlert("Received status[%s] when fetching loading capabilities from server[%s]", responseHandler.getStatus(), serverId); - throw new RE("Received status[%s] when fetching loading capabilities from server[%s]", responseHandler.getStatus(), serverId); + int batchSize = config.getBatchSize() == null ? 1 : config.getBatchSize(); + SegmentLoadingCapabilities defaultCapabilities = new SegmentLoadingCapabilities(batchSize, batchSize); + log.warn( + "Failed to fetch loading capabilities from server[%s]. Received status[%s]. Using default capabilities[%s].", + serverId, responseHandler.getStatus(), defaultCapabilities + ); + return defaultCapabilities; } return jsonMapper.readValue( @@ -187,7 +193,9 @@ private SegmentLoadingCapabilities fetchSegmentLoadingCapabilities() ); } catch (Throwable th) { - throw new RE(th, "Received error while fetching historical capabilities from Server[%s].", serverId); + log.warn(th, "Failed to fetch loading capabilities from server[%s]. Using default capabilities.", serverId); + int batchSize = config.getBatchSize() == null ? 1 : config.getBatchSize(); + return new SegmentLoadingCapabilities(batchSize, batchSize); } }