jsancio commented on code in PR #12224:
URL: https://github.com/apache/kafka/pull/12224#discussion_r886118202
##########
metadata/src/test/java/org/apache/kafka/metalog/LocalLogManager.java:
##########
@@ -227,14 +228,14 @@ synchronized long tryAppend(int nodeId, int epoch,
List<ApiMessageAndVersion> ba
synchronized long tryAppend(int nodeId, int epoch, LocalBatch batch) {
if (epoch != leader.epoch()) {
- log.trace("tryAppend(nodeId={}, epoch={}): the provided epoch
does not " +
+ log.debug("tryAppend(nodeId={}, epoch={}): the provided epoch
does not " +
"match the current leader epoch of {}.", nodeId, epoch,
leader.epoch());
- return Long.MAX_VALUE;
+ throw new NotLeaderException("Append failed because the
replication is not the current leader");
Review Comment:
Looks like `KafkaRaftClient` throws `IllegalArgumentException` when the
passed `epoch` is greater than the current leader epoch. This is based on
`BatchAccumulator`:
```java
if (epoch < this.epoch) {
throw new NotLeaderException("Append failed because the epoch
doesn't match");
} else if (epoch > this.epoch) {
throw new IllegalArgumentException("Attempt to append from
epoch " + epoch +
" which is larger than the current epoch " + this.epoch);
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]