You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Jackie-Jiang (via GitHub)" <gi...@apache.org> on 2023/03/01 22:38:21 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #10363: Add controller API to fetch all segment zookeeper metadata for a table

Jackie-Jiang commented on code in PR #10363:
URL: https://github.com/apache/pinot/pull/10363#discussion_r1122370238


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java:
##########
@@ -901,6 +903,37 @@ public String getServerMetadata(
     return segmentsMetadata;
   }
 
+  @GET
+  @Path("segments/{tableName}/zkmetadata")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ApiOperation(value = "Get the zookeeper metadata for all table segments",
+          notes = "Get the zookeeper metadata for all table segments")
+  public String getZookeeperMetadata(
+          @ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName,
+          @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr)
+          throws JsonProcessingException {
+    LOGGER.info("Received a request to fetch zookeeper metadata for all segments for table {}", tableName);
+    TableType tableType = Constants.validateTableType(tableTypeStr);
+
+    List<String> tableNamesWithType =
+            ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager, tableName, tableType, LOGGER);
+    Map<String, JsonNode> tableTypeToSegmentMetadata = new HashMap<>();
+    for (String tableNameWithType: tableNamesWithType) {
+      List<String> segments =
+              _pinotHelixResourceManager.getSegmentsFor(tableNameWithType, false);

Review Comment:
   You may use `getSegmentsZKMetadata()` to batch read all ZK metadata for a table, which is more efficient



-- 
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-unsubscribe@pinot.apache.org

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


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