LuciferYang opened a new pull request, #16847:
URL: https://github.com/apache/iceberg/pull/16847

   `InMemoryLockManager.HEARTBEATS` is a static map shared by every lock 
manager in the JVM and is written whenever a lock is acquired or released. The 
sibling `LOCKS` map is already a `ConcurrentMap`, but `HEARTBEATS` was left as 
a plain `HashMap`, so threads acquiring or releasing locks on different 
entities mutate it without synchronization. That can corrupt the map and leak 
the scheduled heartbeat futures it tracks.
   
   This makes `HEARTBEATS` a `ConcurrentMap` and replaces the non-atomic 
`containsKey`/`remove` cleanup in `acquireOnce` with a single atomic `remove`.
   
   Added two concurrency tests: one runs many rounds of acquire/release across 
distinct entities and asserts no heartbeat is left behind, the other has 16 
threads contend on a single entity and checks that at most one heartbeat exists 
while the lock is held and none remain after release.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to