klsince commented on code in PR #13314:
URL: https://github.com/apache/pinot/pull/13314#discussion_r1628544264


##########
pinot-controller/src/main/java/org/apache/pinot/controller/util/CompletionServiceHelper.java:
##########
@@ -129,13 +129,21 @@ private CompletionServiceResponse collectResponse(String 
tableNameWithType, int
         int statusCode = 
multiHttpRequestResponse.getResponse().getStatusLine().getStatusCode();
         if (statusCode >= 300) {
           String reason = 
multiHttpRequestResponse.getResponse().getStatusLine().getReasonPhrase();
-          LOGGER.error("Server: {} returned error: {}, reason: {}", instance, 
statusCode, reason);
+          LOGGER.error("Server: {} returned error: {}, reason: {} for uri: 
{}", instance, statusCode, reason, uri);
           completionServiceResponse._failedResponseCount++;
           continue;
         }
         String responseString = 
EntityUtils.toString(multiHttpRequestResponse.getResponse().getEntity());
-        completionServiceResponse._httpResponses
-            .put(multiRequestPerServer ? uri.toString() : instance, 
responseString);
+        String key = multiRequestPerServer ? uri.toString() : instance;
+        // If there are multiple requests to the same server with the same URI 
but different payloads,
+        // we append a count value to the key to ensure each response is 
uniquely identified.
+        // Otherwise, the map will store only the last response, overwriting 
previous ones.
+        if (multiRequestPerServer) {
+          int count = 
completionServiceResponse._instanceToRequestCount.getOrDefault(key, 0) + 1;
+          completionServiceResponse._instanceToRequestCount.put(key, count);

Review Comment:
   can do `compute(key, (k, v) -> (v == null) ? 1 : v + 1);` but not a blocking 
comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to