You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Jose Armando Garcia Sancio (Jira)" <ji...@apache.org> on 2021/02/24 20:06:00 UTC
[jira] [Commented] (KAFKA-12158) Consider better return type of
RaftClient.scheduleAppend
[ https://issues.apache.org/jira/browse/KAFKA-12158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17290233#comment-17290233 ]
Jose Armando Garcia Sancio commented on KAFKA-12158:
----------------------------------------------------
Yes [~sagarrao] . Feel free to pick this up.
> Consider better return type of RaftClient.scheduleAppend
> --------------------------------------------------------
>
> Key: KAFKA-12158
> URL: https://issues.apache.org/jira/browse/KAFKA-12158
> Project: Kafka
> Issue Type: Sub-task
> Reporter: Jason Gustafson
> Priority: Major
>
> Currently `RaftClient` has the following Append API:
> {code}
> Long scheduleAppend(int epoch, List<T> records);
> {code}
> There are a few possible cases that the single return value is trying to handle:
> 1. The epoch doesn't match or we are not the current leader => return Long.MaxValue
> 2. We failed to allocate memory to write the the batch (backpressure case) => return null
> 3. We successfully scheduled the append => return the expected offset
> It might be better to define a richer type so that the cases that must be handled are clearer. At a minimum, it would be better to return `OptionalLong` and get rid of the null case.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)