vrajat commented on code in PR #14395:
URL: https://github.com/apache/pinot/pull/14395#discussion_r1832011717


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java:
##########
@@ -430,8 +430,8 @@ private SuccessResponse addSchema(Schema schema, boolean 
override, boolean force
       throw new ControllerApplicationException(LOGGER, e.getMessage(), 
Response.Status.BAD_REQUEST, e);
     } catch (Exception e) {
       
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_SCHEMA_UPLOAD_ERROR,
 1L);
-      throw new ControllerApplicationException(LOGGER, String.format("Failed 
to add new schema %s.", schemaName),
-          Response.Status.INTERNAL_SERVER_ERROR, e);
+      throw new ControllerApplicationException(LOGGER, String.format("Failed 
to add new schema %s. Reason: %s",

Review Comment:
   As a developer who learnt the trade on C using `printf` and `snprintf`, this 
is the most natural templatization method for me :) 
   
   It is unfortunate that the Java implementation is terrible. A benchmark that 
shows the terrible performance of `String.format`. Source: 
https://stackoverflow.com/a/1281651 
   
   `StringBuilder` or `+` are possible candidates. I find `StringBuilder` more 
natural because `+` to me are for numbers and it confuses my brain for a new 
nanoseconds. 



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java:
##########
@@ -369,8 +369,8 @@ private void 
persistInstancePartitionsHelper(InstancePartitions instancePartitio
       
InstancePartitionsUtils.persistInstancePartitions(_pinotHelixResourceManager.getPropertyStore(),
           instancePartitions);
     } catch (Exception e) {
-      throw new ControllerApplicationException(LOGGER, "Caught Exception while 
persisting the instance partitions",
-          Response.Status.INTERNAL_SERVER_ERROR, e);

Review Comment:
   nit: Why `Message` here vs `Reason` ? 



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to