KAFKA-13943; Make `LocalLogManager` implementation consistent with the...
KAFKA-13943; Make `LocalLogManager` implementation consistent with the `RaftClient` contract (#12224) Fixes two issues in the implementation of `LocalLogManager`: - As per the interface contract for `RaftClient.scheduleAtomicAppend()`, it should throw a `NotLeaderException` exception when the provided current leader epoch does not match the current epoch. However, the current `LocalLogManager`'s implementation of the API returns a LONG_MAX instead of throwing an exception. This change fixes the behaviour and makes it consistent with the interface contract. - As per the interface contract for `RaftClient.resign(epoch)`if the parameter epoch does not match the current epoch, this call will be ignored. But in the current `LocalLogManager` implementation the leader epoch might change when the thread is waiting to acquire a lock on `shared.tryAppend()` (note that tryAppend() is a synchronized method). In such a case, if a NotALeaderException is thrown (as per code change in above), then resign should be ignored. Reviewers: José Armando García Sancio <jsancio@users.noreply.github.com>, Tom Bentley <tbentley@redhat.com>, Jason Gustafson <jason@confluent.io>
显示
- metadata/src/test/java/org/apache/kafka/metalog/LocalLogManager.java 42 个添加, 11 个删除...c/test/java/org/apache/kafka/metalog/LocalLogManager.java
- raft/src/main/java/org/apache/kafka/raft/RaftClient.java 4 个添加, 1 个删除raft/src/main/java/org/apache/kafka/raft/RaftClient.java
- raft/src/main/java/org/apache/kafka/raft/internals/BatchAccumulator.java 6 个添加, 3 个删除...ava/org/apache/kafka/raft/internals/BatchAccumulator.java
加载中
想要评论请 注册 或 登录