ifesdjeen commented on code in PR #3274:
URL: https://github.com/apache/cassandra/pull/3274#discussion_r1598412308
##########
src/java/org/apache/cassandra/service/reads/AbstractReadExecutor.java:
##########
@@ -225,17 +229,27 @@ public boolean hasLocalRead()
*/
boolean shouldSpeculateAndMaybeWait()
{
+ long now = preciseTime.now();
+ long sampleLatencyNanos =
MICROSECONDS.toNanos(cfs.sampleReadLatencyMicros);
// no latency information, or we're overloaded
- if (cfs.sampleReadLatencyMicros > command.getTimeout(MICROSECONDS))
+ if (sampleLatencyNanos > command.getTimeout(NANOSECONDS))
{
- if (logger.isTraceEnabled())
- logger.trace("Decided not to speculate as {} > {}",
cfs.sampleReadLatencyMicros, command.getTimeout(MICROSECONDS));
+ logger.trace("Decided not to speculate as {}ns > {}ns",
sampleLatencyNanos, command.getTimeout(NANOSECONDS));
return false;
}
+ if (now + sampleLatencyNanos > requestTime.clientDeadline())
Review Comment:
Yes. `enqueuedAtNanos` is precise:
in `Request` constructor:
```
createdAtNanos = MonotonicClock.Global.preciseTime.now();
```
and then
```
processRequest(channel, request, forFlusher, backpressure, new
RequestTime(request.createdAtNanos, startTimeNanos));
```
Also, all metrics are using precise time.
--
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]