adixitconfluent commented on code in PR #17965:
URL: https://github.com/apache/kafka/pull/17965#discussion_r1868731940


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -2332,12 +2330,24 @@ String memberId() {
             return memberId;
         }
 
+        private RecordState rollbackState() {
+            if (rollbackState == null) {
+                // This case could occur when the batch/offset hasn't 
transitioned even once or the state transitions have
+                // been committed.
+                return null;
+            }
+            return rollbackState.state;
+        }
+
         // Visible for testing.
         TimerTask acquisitionLockTimeoutTask() {
             return acquisitionLockTimeoutTask;
         }
 
-        void updateAcquisitionLockTimeoutTask(AcquisitionLockTimerTask 
acquisitionLockTimeoutTask) {
+        void updateAcquisitionLockTimeoutTask(AcquisitionLockTimerTask 
acquisitionLockTimeoutTask) throws IllegalStateException {
+            if (this.acquisitionLockTimeoutTask != null) {
+                throw new IllegalStateException("The acquisition lock timeout 
task is being overridden");

Review Comment:
   quotig @chia7712's comment 
https://github.com/apache/kafka/pull/17965?new_mergebox=false#pullrequestreview-2476424111
 
   
   > One of the issues is the leakage of acquisitionLockTimeoutTask. Therefore, 
I recommend adding a check to updateAcquisitionLockTimeoutTask that throws an 
exception if there is an attempt to override an existing 
updateAcquisitionLockTimeoutTask.
   
   So, basically if you're trying to override a non null 
`acquisitionLockTimeoutTask`, you will get this exception, hence there won't be 
any chances of leakage of `acquisitionLockTimeoutTask`. If you feel the error 
message can be enhanced, feel free to suggest some. I thought this message is 
intutive.



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

Reply via email to