maytasm commented on code in PR #19393:
URL: https://github.com/apache/druid/pull/19393#discussion_r3171346230
##########
server/src/main/java/org/apache/druid/server/SetAndVerifyContextQueryRunner.java:
##########
@@ -70,13 +70,19 @@ public Query<T>
withTimeoutAndMaxScatterGatherBytes(Query<T> query, ServerConfig
);
// DirectDruidClient.QUERY_FAIL_TIME is used by DirectDruidClient and
JsonParserIterator to determine when to
// fail with a timeout exception
- final long failTime;
final QueryContext context = newQuery.context();
+ final long existingFailTime =
context.getLong(DirectDruidClient.QUERY_FAIL_TIME, -1L);
+ final long computedFailTime;
if (context.hasTimeout()) {
- failTime = this.startTimeMillis + context.getTimeout();
+ computedFailTime = this.startTimeMillis + context.getTimeout();
} else {
- failTime = this.startTimeMillis + serverConfig.getMaxQueryTimeout();
+ computedFailTime = this.startTimeMillis +
serverConfig.getMaxQueryTimeout();
Review Comment:
nit: this can overflow to negative (for example when
serverConfig.getMaxQueryTimeout() is default value of Long.MAX_VALUE). This
would then resulted in Math.min returning the overflow computedFailTime instead
of existingFailTime. Not sure if this would matter since existingFailTime would
already be Long.MAX_VALUE (has context.hasTimeout() is false). Might be worth
adding a guard
--
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]