vrajat commented on code in PR #14451:
URL: https://github.com/apache/pinot/pull/14451#discussion_r1855820871


##########
pinot-controller/src/main/java/org/apache/pinot/controller/util/ServerSegmentMetadataReader.java:
##########
@@ -397,6 +398,39 @@ public ValidDocIdsBitmapResponse 
getValidDocIdsBitmapFromServer(String tableName
     return response;
   }
 
+  public Map<String, List<NeedRefreshResponse>> 
getSegmentsForRefreshFromServer(
+      String tableNameWithType, Set<String> serverInstances, BiMap<String, 
String> endpoints, int timeoutMs) {
+    LOGGER.debug("Getting list of segments for refresh from servers for table 
{}.", tableNameWithType);
+    List<String> serverURLs = new ArrayList<>();
+    for (String serverInstance : serverInstances) {
+      serverURLs.add(generateNeedRefreshSegmentsServerURL(tableNameWithType, 
endpoints.get(serverInstance)));
+    }
+    BiMap<String, String> endpointsToServers = endpoints.inverse();
+    CompletionServiceHelper completionServiceHelper =
+        new CompletionServiceHelper(_executor, _connectionManager, 
endpointsToServers);
+    CompletionServiceHelper.CompletionServiceResponse serviceResponse =
+        completionServiceHelper.doMultiGetRequest(serverURLs, 
tableNameWithType, true, timeoutMs);
+    Map<String, List<NeedRefreshResponse>> serverResponses = new HashMap<>();
+
+    int failedParses = 0;
+    for (Map.Entry<String, String> streamResponse : 
serviceResponse._httpResponses.entrySet()) {
+      try {
+        // TODO: RV - get the instance name instead of the endpoint
+        serverResponses.put(streamResponse.getKey(),
+            JsonUtils.stringToObject(streamResponse.getValue(),
+                new TypeReference<List<NeedRefreshResponse>>() { }));
+      } catch (Exception e) {
+        failedParses++;
+        LOGGER.error("Unable to parse server {} response due to an error: ", 
streamResponse.getKey(), e);
+      }
+    }
+    if (failedParses != 0) {
+      LOGGER.error("Unable to parse server {} / {} response due to an error: 
", failedParses, serverURLs.size());

Review Comment:
   I've remove this line. 



##########
pinot-controller/src/main/java/org/apache/pinot/controller/util/ServerSegmentMetadataReader.java:
##########
@@ -397,6 +398,39 @@ public ValidDocIdsBitmapResponse 
getValidDocIdsBitmapFromServer(String tableName
     return response;
   }
 
+  public Map<String, List<NeedRefreshResponse>> 
getSegmentsForRefreshFromServer(
+      String tableNameWithType, Set<String> serverInstances, BiMap<String, 
String> endpoints, int timeoutMs) {
+    LOGGER.debug("Getting list of segments for refresh from servers for table 
{}.", tableNameWithType);
+    List<String> serverURLs = new ArrayList<>();
+    for (String serverInstance : serverInstances) {
+      serverURLs.add(generateNeedRefreshSegmentsServerURL(tableNameWithType, 
endpoints.get(serverInstance)));
+    }
+    BiMap<String, String> endpointsToServers = endpoints.inverse();
+    CompletionServiceHelper completionServiceHelper =
+        new CompletionServiceHelper(_executor, _connectionManager, 
endpointsToServers);
+    CompletionServiceHelper.CompletionServiceResponse serviceResponse =
+        completionServiceHelper.doMultiGetRequest(serverURLs, 
tableNameWithType, true, timeoutMs);
+    Map<String, List<NeedRefreshResponse>> serverResponses = new HashMap<>();
+
+    int failedParses = 0;
+    for (Map.Entry<String, String> streamResponse : 
serviceResponse._httpResponses.entrySet()) {
+      try {
+        // TODO: RV - get the instance name instead of the endpoint
+        serverResponses.put(streamResponse.getKey(),
+            JsonUtils.stringToObject(streamResponse.getValue(),
+                new TypeReference<List<NeedRefreshResponse>>() { }));
+      } catch (Exception e) {
+        failedParses++;
+        LOGGER.error("Unable to parse server {} response due to an error: ", 
streamResponse.getKey(), e);

Review Comment:
   Done.



-- 
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