xiangfu0 commented on code in PR #18411:
URL: https://github.com/apache/pinot/pull/18411#discussion_r3185126116
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableConfigsRestletResource.java:
##########
@@ -461,19 +469,29 @@ public String validateConfig(String tableConfigsStr,
@QueryParam("validationTypesToSkip") @Nullable String typesToSkip,
@Context HttpHeaders httpHeaders,
@Context Request request) {
Pair<TableConfigs, Map<String, Object>> tableConfigsAndUnrecognizedProps;
+ JsonNode tableConfigsJson;
try {
tableConfigsAndUnrecognizedProps =
JsonUtils.stringToObjectAndUnrecognizedProperties(tableConfigsStr,
TableConfigs.class);
+ tableConfigsJson = JsonUtils.stringToJsonNode(tableConfigsStr);
} catch (IOException e) {
throw new ControllerApplicationException(LOGGER,
String.format("Invalid TableConfigs json string: %s. Reason: %s",
tableConfigsStr, e.getMessage()),
Response.Status.BAD_REQUEST, e);
}
String databaseName =
DatabaseUtils.extractDatabaseFromHttpHeaders(httpHeaders);
TableConfigs tableConfigs = tableConfigsAndUnrecognizedProps.getLeft();
- validateConfig(tableConfigs, databaseName, typesToSkip);
- String rawTableName =
DatabaseUtils.translateTableName(tableConfigs.getTableName(), databaseName);
- tableConfigs.setTableName(rawTableName);
+ String rawTableName;
+ try {
+ validateNoDeprecatedCreateConfigs(tableConfigs, tableConfigsJson,
databaseName);
+ validateConfig(tableConfigs, databaseName, typesToSkip);
+ rawTableName =
DatabaseUtils.translateTableName(tableConfigs.getTableName(), databaseName);
+ tableConfigs.setTableName(rawTableName);
+ } catch (Exception e) {
+ throw new ControllerApplicationException(LOGGER,
+ String.format("Invalid TableConfigs json string: %s. Reason: %s",
tableConfigsStr, e.getMessage()),
Review Comment:
Addressed in df5e6363b3 — switched to concatenation (`"Invalid TableConfigs.
" + e.getMessage()`) so it matches `addConfig`'s pattern and stops
interpolating the full request body via `String.format`. The validate
endpoint's catch block was using the same pattern; both updated.
`ControllerApplicationException` now propagates without rewrap so upstream 500s
are preserved.
--
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]