Jackie-Jiang commented on code in PR #13915: URL: https://github.com/apache/pinot/pull/13915#discussion_r1742764772
########## pinot-controller/src/main/java/org/apache/pinot/controller/util/TableMetadataReader.java: ########## @@ -60,21 +60,28 @@ public TableMetadataReader(Executor executor, HttpClientConnectionManager connec public Map<String, JsonNode> getServerCheckSegmentsReloadMetadata(String tableNameWithType, int timeoutMs) throws InvalidConfigException, IOException { + List<String> segmentsMetadata = getIsReloadNeeded(tableNameWithType, timeoutMs); + Map<String, JsonNode> response = new HashMap<>(); + for (String segmentMetadata : segmentsMetadata) { + JsonNode responseJson = JsonUtils.stringToJsonNode(segmentMetadata); + response.put(responseJson.get("instanceId").asText(), responseJson); + } + return response; + } + + private List<String> getIsReloadNeeded(String tableNameWithType, int timeoutMs) + throws InvalidConfigException { TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType); List<String> serverInstances = _pinotHelixResourceManager.getServerInstancesForTable(tableNameWithType, tableType); Set<String> serverInstanceSet = new HashSet<>(serverInstances); BiMap<String, String> endpoints = _pinotHelixResourceManager.getDataInstanceAdminEndpoints(serverInstanceSet); ServerSegmentMetadataReader serverSegmentMetadataReader = new ServerSegmentMetadataReader(_executor, _connectionManager); - List<String> segmentsMetadata = + List<String> segmentsMetadata; + segmentsMetadata = serverSegmentMetadataReader.getCheckReloadSegmentsFromServer(tableNameWithType, serverInstanceSet, endpoints, timeoutMs); - Map<String, JsonNode> response = new HashMap<>(); - for (String segmentMetadata : segmentsMetadata) { - JsonNode responseJson = JsonUtils.stringToJsonNode(segmentMetadata); - response.put(responseJson.get("instanceId").asText(), responseJson); - } - return response; + return segmentsMetadata; Review Comment: (nit) directly return ``` return serverSegmentMetadataReader.getCheckReloadSegmentsFromServer(tableNameWithType, serverInstanceSet, endpoints, timeoutMs); ``` ########## pinot-controller/src/main/java/org/apache/pinot/controller/util/TableMetadataReader.java: ########## @@ -60,21 +60,28 @@ public TableMetadataReader(Executor executor, HttpClientConnectionManager connec public Map<String, JsonNode> getServerCheckSegmentsReloadMetadata(String tableNameWithType, int timeoutMs) throws InvalidConfigException, IOException { + List<String> segmentsMetadata = getIsReloadNeeded(tableNameWithType, timeoutMs); + Map<String, JsonNode> response = new HashMap<>(); + for (String segmentMetadata : segmentsMetadata) { + JsonNode responseJson = JsonUtils.stringToJsonNode(segmentMetadata); + response.put(responseJson.get("instanceId").asText(), responseJson); + } + return response; + } + + private List<String> getIsReloadNeeded(String tableNameWithType, int timeoutMs) Review Comment: ```suggestion private List<String> getReloadCheckResponses(String tableNameWithType, int timeoutMs) ``` -- 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