xiangfu0 commented on code in PR #20238:
URL: https://github.com/apache/pinot/pull/20238#discussion_r4549691124


##########
pinot-controller/src/main/java/org/apache/pinot/controller/util/TableMetadataReader.java:
##########
@@ -131,92 +131,38 @@ private TableReloadJsonResponse 
processSegmentMetadataReloadResponse(
   public JsonNode getSegmentsMetadata(String tableNameWithType, @Nullable 
List<String> columns,
       @Nullable List<String> segments, int timeoutMs)
       throws InvalidConfigException, IOException {
-    return getSegmentsMetadataInternal(tableNameWithType, columns, segments, 
timeoutMs);
-  }
+    Map<String, List<String>> serverToSegs =
+        _pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType);
+    BiMap<String, String> endpoints =
+        
_pinotHelixResourceManager.getDataInstanceAdminEndpoints(serverToSegs.keySet());
+    ServerSegmentMetadataReader reader =
+        new ServerSegmentMetadataReader(_executor, _connectionManager,
+            _pinotHelixResourceManager.getServerAdminAuthProvider());
 
-  /// Common helper used by both the new (server-level) and legacy 
(segment-level) endpoints.
-  private JsonNode fetchAndAggregateMetadata(List<String> urls, BiMap<String, 
String> endpoints, boolean perSegmentJson,
-      String tableNameWithType, int timeoutMs)
-      throws InvalidConfigException, IOException {
-    CompletionServiceHelper cs = new CompletionServiceHelper(_executor, 
_connectionManager, endpoints,
+    List<String> tableUrls = new ArrayList<>(serverToSegs.size());
+    for (String server : serverToSegs.keySet()) {
+      tableUrls.add(reader.generateTableMetadataServerURL(
+          tableNameWithType, columns, segments, endpoints.get(server)));
+    }
+
+    CompletionServiceHelper cs = new CompletionServiceHelper(_executor, 
_connectionManager, endpoints.inverse(),
         _pinotHelixResourceManager.getServerAdminAuthProvider());
     CompletionServiceHelper.CompletionServiceResponse resp =
-        cs.doMultiGetRequest(urls, tableNameWithType, perSegmentJson, 
timeoutMs);
-    // all requests will fail if new server endpoint is not available
+        cs.doMultiGetRequest(tableUrls, tableNameWithType, false, timeoutMs);
     if (resp._failedResponseCount > 0) {

Review Comment:
   Without the fallback, a rejected table-level request (e.g. a 400 for an 
oversized request line) now fails the whole call. With default limits the 
controller rejects the same `segments` list first, so this only happens when 
`pinot.controller.http.server.max.http.header.size` is set higher than the 
server's. It may be worth adding that to the upgrade note.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to