balodesecurity opened a new pull request, #8325:
URL: https://github.com/apache/hadoop/pull/8325

   ## Summary
   
   `ExcessRedundancyMap` uses a single coarse-grained `synchronized` monitor 
for all operations. Because `contains()`, `getSize4Testing()`, and 
`getExcessRedundancyMap()` are purely read-only, they unnecessarily serialize 
against each other under the block management write lock, reducing throughput 
on read-heavy workloads.
   
   ### Changes
   
   - Replace `synchronized` on every method with an explicit 
`ReentrantReadWriteLock`:
     - **Read lock**: `contains()`, `getSize4Testing()`, 
`getExcessRedundancyMap()`
     - **Write lock**: `add()`, `remove()`, `clear()`
   - The `size` counter is already an `AtomicLong` and requires no additional 
locking.
   
   ### Test
   
   Added `TestExcessRedundancyMap` with 4 unit tests:
   - `testAddContainsRemove` — basic correctness of add/contains/remove
   - `testClear` — clear resets map and size counter
   - `testConcurrentReads` — 8 concurrent readers all complete within 10 s (no 
deadlock)
   - `testConcurrentWritesProduceCorrectSize` — 10 concurrent writers produce a 
consistent final size
   
   All 4 tests pass.
   
   ## Test plan
   
   - [x] `TestExcessRedundancyMap` (4 tests) — PASS
   - [ ] Full `blockmanagement` test suite (CI)


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