deepthi912 commented on code in PR #13789:
URL: https://github.com/apache/pinot/pull/13789#discussion_r1716075639


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -952,4 +956,42 @@ public TableSegmentValidationInfo 
validateTableSegmentState(
     }
     return new TableSegmentValidationInfo(true, maxEndTimeMs);
   }
+
+  @GET
+  @Path("/tables/{tableName}/segments/mismatch")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ApiOperation(value = "Checks if there is any mismatch of columns in a 
segment", notes =
+      "Returns true if reload is required on" + " any segment in a given 
server")
+  @ApiResponses(value = {
+      @ApiResponse(code = 200, message = "Success", response = 
TableSegments.class), @ApiResponse(code = 500,
+      message = "Server initialization error", response = ErrorInfo.class)
+  })
+  public String checkMismatchedSegments(
+      @ApiParam(value = "Table Name with type", required = true) 
@PathParam("tableName") String tableName,
+      @ApiParam(value = "Column name", allowMultiple = true) 
@QueryParam("columns") @DefaultValue("")
+      List<String> columns, @Context HttpHeaders headers) {
+    tableName = DatabaseUtils.translateTableName(tableName, headers);
+    TableDataManager tableDataManager = 
ServerResourceUtils.checkGetTableDataManager(_serverInstance, tableName);
+    Pair<TableConfig, Schema> tableConfigSchema = 
tableDataManager.fetchTableConfigAndSchema();
+    IndexLoadingConfig indexLoadingConfig =
+        tableDataManager.getIndexLoadingConfig(tableConfigSchema.getLeft(), 
tableConfigSchema.getRight());
+    List<SegmentDataManager> segmentDataManagers = 
tableDataManager.acquireAllSegments();
+    try {
+      boolean mismatchCheck = false;
+      for (SegmentDataManager segmentDataManager : segmentDataManagers) {
+        SegmentZKMetadata segmentZKMetadata = 
tableDataManager.fetchZKMetadata(segmentDataManager.getSegmentName());
+        if (tableDataManager.checkReloadSegment(segmentZKMetadata,

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