apoorvmittal10 commented on code in PR #20286:
URL: https://github.com/apache/kafka/pull/20286#discussion_r2248181671
##########
server/src/main/java/org/apache/kafka/server/share/fetch/InFlightState.java:
##########
@@ -138,6 +157,16 @@ public boolean hasOngoingStateTransition() {
*/
public InFlightState tryUpdateState(RecordState newState, DeliveryCountOps
ops, int maxDeliveryCount, String newMemberId) {
try {
+ // If the state transition is in progress, the state should not be
updated.
+ if (hasOngoingStateTransition()) {
+ // A misbehaving client can send multiple requests to update
the same records hence
+ // do not proceed if the transition is already in progress. Do
not log an error here
+ // as it might not bea an error rather concurrent update of
same state due to multiple
+ // requests.
+ log.info("{} has ongoing state transition, cannot update",
this);
Review Comment:
The reason I used info here to check if really this can happen, ideally not
as there are additional checks in place. In case we do see the info log then I
will inpect more and should optimize code in this area.
--
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]