Jason Gustafson created KAFKA-12158:
---------------------------------------
Summary: 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
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)