junrao commented on code in PR #16842:
URL: https://github.com/apache/kafka/pull/16842#discussion_r1815847272
##########
core/src/main/java/kafka/server/share/SharePartitionManager.java:
##########
@@ -617,22 +650,35 @@ private void maybeCompleteInitializationWithException(
return;
}
+ // Remove the partition from the cache as it's failed to initialize.
+ partitionCacheMap.remove(sharePartitionKey);
Review Comment:
1. We probably want to verify the leader epoch in SharePartition before
removal to avoid a newly created SharePartition being removed by an old request.
2. We piggyback the removal in an error response. The downside is that there
are quite a few error places to handle and it is reactive. An alternative is to
have a partitionLeaderEpochChange listener. We can then proactively remove a
SharePartition when the leader epoch changes.
--
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]