You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/09/24 17:36:13 UTC

[GitHub] [kafka] hachikuji commented on a change in pull request #9332: KAFKA-10511; Ensure monotonic start epoch/offset updates in `MockLog`

hachikuji commented on a change in pull request #9332:
URL: https://github.com/apache/kafka/pull/9332#discussion_r494494327



##########
File path: raft/src/test/java/org/apache/kafka/raft/MockLog.java
##########
@@ -310,10 +310,10 @@ public LogFetchInfo read(long startOffset, Isolation isolation) {
     }
 
     @Override
-    public void assignEpochStartOffset(int epoch, long startOffset) {
-        if (startOffset != endOffset().offset)
-            throw new IllegalArgumentException(
-                "Can only assign epoch for the end offset " + endOffset().offset + ", but get offset " + startOffset);
+    public void initializeLeaderEpoch(int epoch) {
+        long startOffset = endOffset().offset;
+        epochStartOffsets.removeIf(epochStartOffset ->

Review comment:
       There's no guarantee that the leader change message ever gets committed. It is even possible for the leadership to change multiple times before a leader change message can be committed. There is no correctness problem with the current implementation. I just wanted the behavior to be consistent with `LeaderEpochFileCache`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org