diff --git a/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java b/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java index 0565290cf06..768d6bf31dc 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java @@ -181,16 +181,27 @@ public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest } } + private String getDistributedStageName(int stage) { + String stageName = stages.get(stage); + + if (stageName == null) { + stageName = "STAGE_" + Integer.toString(stage); + } + + return stageName; + } + @Override public void handleResponses(ResponseBuilder rb, ShardRequest sreq) { if (rb.isDebugTrack() && rb.isDistrib && !rb.finished.isEmpty()) { @SuppressWarnings("unchecked") NamedList stageList = (NamedList) - ((NamedList) rb.getDebugInfo().get("track")).get(stages.get(rb.stage)); + ((NamedList) rb.getDebugInfo().get("track")) + .get(getDistributedStageName(rb.stage)); if (stageList == null) { stageList = new SimpleOrderedMap<>(); - rb.addDebug(stageList, "track", stages.get(rb.stage)); + rb.addDebug(stageList, "track", getDistributedStageName(rb.stage)); } for (ShardResponse response : sreq.responses) { stageList.add(response.getShard(), getTrackResponse(response));