klsince commented on a change in pull request #7249:
URL: https://github.com/apache/pinot/pull/7249#discussion_r685619317



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
##########
@@ -472,13 +474,24 @@ public SuccessResponse reloadSegmentDeprecated2(
   @ApiOperation(value = "Reload all segments", notes = "Reload all segments")
   public SuccessResponse reloadAllSegments(
       @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableName,
-      @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String 
tableTypeStr) {
+      @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String 
tableTypeStr,
+      @ApiParam(value = "Whether to force server to download segment") 
@QueryParam("forceDownload") @DefaultValue("false") boolean forceDownload) {
+    TableType tableTypeFromTableName = 
TableNameBuilder.getTableTypeFromTableName(tableName);
+    TableType tableTypeFromRequest = Constants.validateTableType(tableTypeStr);
+    // When rawTableName is provided but w/o table type, Pinot tries to reload 
both OFFLINE
+    // and REALTIME tables for the raw table. But forceDownload option only 
works with
+    // OFFLINE table currently, so we limit the table type to OFFLINE to let 
Pinot continue
+    // to reload w/o being accidentally aborted upon REALTIME table type.
+    // TODO: support to force download immutable segments from RealTime table.
+    if (forceDownload && (tableTypeFromTableName == null && 
tableTypeFromRequest == null)) {
+      tableTypeFromRequest = TableType.OFFLINE;
+    }

Review comment:
       So, if it's foo_REALTIME and type=null, the current change leads to 
error saying `OFFLINE table is required to force segment download`, but the 
suggested change would lead to exception from getExistingTableNamesWithType() 
below, the error might be a bit misleading to user. 
   ```
         if (tableType != null && tableType != tableTypeFromTableName) {
           throw new IllegalArgumentException("Table name: " + tableName + " 
does not match table type: " + tableType);
         }
   ```
   




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