kfaraz commented on code in PR #17775:
URL: https://github.com/apache/druid/pull/17775#discussion_r2009695748
##########
server/src/main/java/org/apache/druid/server/coordinator/loading/HttpLoadQueuePeon.java:
##########
@@ -368,15 +366,24 @@ private void logRequestFailure(Throwable t)
* Calculates the number of segments the server is capable of handling at a
time. If loading segments in turbo loading
* mode, returns the number of turbo loading threads on the server.
Otherwise, return the value set by the batch size
* runtime parameter, or number of normal threads on the server if the
parameter is not set.
+ * Always returns a positive integer.
*/
@VisibleForTesting
int calculateBatchSize(SegmentLoadingMode loadingMode)
{
+ int batchSize;
if (SegmentLoadingMode.TURBO.equals(loadingMode)) {
- return serverCapabilities.getNumTurboLoadingThreads();
+ batchSize = serverCapabilities.getNumTurboLoadingThreads();
} else {
- return Configs.valueOrDefault(config.getBatchSize(),
serverCapabilities.getNumLoadingThreads());
+ batchSize = Configs.valueOrDefault(config.getBatchSize(),
serverCapabilities.getNumLoadingThreads());
}
+
+ if (batchSize < 1) {
+ log.error("Batch size must be greater than 0.");
+ throw new RE("Batch size must be greater than 0.");
+ }
Review Comment:
We should not throw exception here.
--
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]