Skip to content

Commit c43ae70

Browse files
committed
earliest|latest -> smallest|largest
1 parent cc950eb commit c43ae70

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotRealtimeTableResource.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,15 @@ public Response pauseConsumption(
8484
+ "gone, the first available offsets are picked to minimize the data loss.")
8585
public Response resumeConsumption(
8686
@ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName,
87-
@ApiParam(value = "earliest | latest | best") @QueryParam("consumeFrom") String consumeFrom) {
87+
@ApiParam(value = "smallest | largest") @QueryParam("consumeFrom") String consumeFrom) {
8888
String tableNameWithType = TableNameBuilder.REALTIME.tableNameWithType(tableName);
8989
validate(tableNameWithType);
90-
String offsetCriteria;
91-
if ("earliest".equalsIgnoreCase(consumeFrom)) {
92-
offsetCriteria = "smallest";
93-
} else if ("latest".equalsIgnoreCase(consumeFrom)) {
94-
offsetCriteria = "largest";
95-
} else if (consumeFrom == null || "best".equalsIgnoreCase(consumeFrom)) {
96-
offsetCriteria = null;
97-
} else {
90+
if (consumeFrom != null && !consumeFrom.equalsIgnoreCase("smallest") && !consumeFrom.equalsIgnoreCase("largest")) {
9891
throw new ControllerApplicationException(LOGGER,
9992
String.format("consumeFrom param '%s' is not valid.", consumeFrom), Response.Status.BAD_REQUEST);
10093
}
10194
try {
102-
return Response.ok(_pinotLLCRealtimeSegmentManager.resumeConsumption(tableNameWithType, offsetCriteria)).build();
95+
return Response.ok(_pinotLLCRealtimeSegmentManager.resumeConsumption(tableNameWithType, consumeFrom)).build();
10396
} catch (Exception e) {
10497
throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR, e);
10598
}

0 commit comments

Comments
 (0)