saurabhd336 commented on code in PR #9356:
URL: https://github.com/apache/pinot/pull/9356#discussion_r981056267


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -514,4 +529,47 @@ public List<SegmentConsumerInfo> getConsumingSegmentsInfo(
     }
     return segmentConsumerInfoList;
   }
+
+  @GET
+  @Path("tables/{tableNameWithType}/validate")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ApiOperation(value = "Validates if the ideal state matches with the 
segmentstate on this server", notes =
+      "Validates if the ideal state matches with the segmentstate on this 
server")
+  public TableSegmentValidationInfo validateTableIdealState(
+      @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableNameWithType")
+          String tableNameWithType) {
+    // Get table current ideal state
+    IdealState tableIdealState = HelixHelper.getTableIdealState(_helixManager, 
tableNameWithType);
+    TableDataManager tableDataManager =
+        ServerResourceUtils.checkGetTableDataManager(_serverInstance, 
tableNameWithType);
+
+    // Validate segments in idealstate which belong to this server
+    long maxEndTime = -1;
+    Map<String, Map<String, String>> instanceStatesMap = 
tableIdealState.getRecord().getMapFields();
+    for (Map.Entry<String, Map<String, String>> kv : 
instanceStatesMap.entrySet()) {
+      String segmentName = kv.getKey();
+      if (kv.getValue().containsKey(_instanceId)) {

Review Comment:
   Ack



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