MrSibe opened a new pull request, #12711:
URL: https://github.com/apache/gravitino/pull/12711

   ### What changes were proposed in this pull request?
   
   - Guard the drop-event throttle decision and state updates with a lock.
   - Update the drop counter and timestamp atomically within the critical 
section.
   - Capture the current time once and perform log I/O outside the critical 
section.
   - Add a deterministic concurrency test that verifies only one warning is 
emitted within the throttle window.
   
   ### Why are the changes needed?
   
   `AsyncQueueListener.logDropEventsIfNecessary()` previously updated the drop 
counter and throttle timestamp independently.
   
   Under concurrent drops, another thread could observe the updated counter 
before the timestamp was updated and emit a duplicate warning within the same 
60-second throttle window.
   
   The lock makes the time check, counter update, and timestamp update a single 
atomic operation.
   
   Fix: #10169
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This change does not modify user-facing APIs or configuration properties.
   
   It only fixes duplicate drop-event warnings under concurrent queue overflow.
   
   ### How was this patch tested?
   
   Added `TestAsyncQueueListener.testDropEventLogThrottlingIsAtomic`.
   
   The test blocks the first warning while a second thread enters the drop 
path. It verifies that the second concurrent drop does not emit another warning 
within the same throttle window.
   
   The following Gradle tasks passed locally with Gradle 8.2:
   
   - `:core:spotlessApply`
   - `:core:test --tests org.apache.gravitino.listener.TestAsyncQueueListener 
-PskipITs`


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