jsancio commented on a change in pull request #10909:
URL: https://github.com/apache/kafka/pull/10909#discussion_r680031502



##########
File path: raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java
##########
@@ -2305,7 +2307,7 @@ public void resign(int epoch) {
         int currentEpoch = leaderAndEpoch.epoch();
 
         if (epoch > currentEpoch) {
-            throw new IllegalArgumentException("Attempt to resign from epoch " 
+ epoch +
+            throw new FencedEpochException("Attempt to resign from epoch " + 
epoch +

Review comment:
       I don't think this is a fenced epoch. It should not be possible for a 
user of `RaftClient` to see an epoch larger than the`RaftClient`'s current 
epoch. If we hit this case, I think it is safe to assume that there is a bug in 
the user of this type. That means that it is okay to throw 
`IllegalArgumentException`.
   
   If you agree with this comment, we'll want to update the documentation that 
references this exception.

##########
File path: raft/src/main/java/org/apache/kafka/raft/RaftClient.java
##########
@@ -136,19 +139,21 @@ default void beginShutdown() {}
      *
      * If the provided current leader epoch does not match the current epoch, 
which
      * is possible when the state machine has yet to observe the epoch change, 
then
-     * this method will return {@link Long#MAX_VALUE} to indicate an offset 
which is
-     * not possible to become committed. The state machine is expected to 
discard all
+     * this method will throw an {@link IllegalStateException} to indicate the 
leader

Review comment:
       I think you mean `NotLeaderException`.
   
   Same for the documentation for `scheduleAtomicAppend`.




-- 
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: jira-unsubscr...@kafka.apache.org

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


Reply via email to