ascherbakoff commented on code in PR #4540: URL: https://github.com/apache/ignite-3/pull/4540#discussion_r1812149089
########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/HeapLockManager.java: ########## @@ -158,14 +162,22 @@ public HeapLockManager(DeadlockPreventionPolicy deadlockPreventionPolicy, int ma } slots = tmp; // Atomic init. - - parentLockManager.listen(LockEvent.LOCK_CONFLICT, parentLockConflictListener); } @Override public CompletableFuture<Lock> acquire(UUID txId, LockKey lockKey, LockMode lockMode) { - if (lockKey.contextId() == null) { // Treat this lock as a hierarchy lock. - return parentLockManager.acquire(txId, lockKey, lockMode); + if (lockKey.contextId() == null) { // Treat this lock as a hierarchy(coarse) lock. + // Try fast path. + CoarseLockState state = coarseMap.get(lockKey); + + if (state == null) { + // Atomically init state. + CoarseLockState s = new CoarseLockState(lockKey); + CoarseLockState cur = coarseMap.putIfAbsent(lockKey, s); + state = (cur == null ? s : cur); Review Comment: Correct. Replaced with computeIfAbsent -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org