cmccabe commented on code in PR #12033:
URL: https://github.com/apache/kafka/pull/12033#discussion_r850917391
##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -582,16 +582,17 @@ ReplicationControlManager replicationControl() {
return replicationControl;
}
- // VisibleForTesting
- <T> CompletableFuture<T> appendReadEvent(String name, Supplier<T> handler)
{
- ControllerReadEvent<T> event = new ControllerReadEvent<T>(name,
handler);
- queue.append(event);
- return event.future();
- }
-
- <T> CompletableFuture<T> appendReadEvent(String name, long deadlineNs,
Supplier<T> handler) {
+ <T> CompletableFuture<T> appendReadEvent(
+ String name,
+ OptionalLong deadlineNs,
+ Supplier<T> handler
+ ) {
ControllerReadEvent<T> event = new ControllerReadEvent<T>(name,
handler);
- queue.appendWithDeadline(deadlineNs, event);
+ if (deadlineNs.isPresent()) {
+ queue.appendWithDeadline(deadlineNs.getAsLong(), event);
+ } else {
+ queue.append(event);
+ }
Review Comment:
Some controller operations have a deadline, after which they should just be
timed out rather than executed. This is important because the client may have
retried the operation in the meantime. So keeping all the old operations can
lead to a kind of congestion collapse.
We probably should set a deadline for all operations, but that would be a
bigger change. This change just puts the timeout in the context object rather
than passing it as a separate parameter.
--
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]