[ https://issues.apache.org/jira/browse/IGNITE-24267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladislav Pyatkov updated IGNITE-24267: --------------------------------------- Description: h3. Motivation This is a test that demonstrates the misbehavior of current lock manager implementation: {code} @Test public void testCollision() throws Exception { int maxSlots = 16; HeapLockManager lockManager = new HeapLockManager(maxSlots, maxSlots); lockManager.start(new WaitDieDeadlockPreventionPolicy()); UUID[] txs = new UUID[maxSlots]; for (int i = 0; i < maxSlots; i++) { txs[i] = TestTransactionIds.newTransactionId(); lockManager.acquire(txs[i], new LockKey(txs[i], txs[i]), LockMode.S).get(); } UUID collisionTx = TestTransactionIds.newTransactionId(); lockManager.acquire(collisionTx, new LockKey(collisionTx, collisionTx), LockMode.S).get(); int collisionSlot = -1; for (int i = 0; i < maxSlots; i++) { if (lockManager.queue(new LockKey(txs[i], txs[i])).size() == 2) { collisionSlot = i; } else { lockManager.releaseAll(txs[i]); } } assertTrue(collisionSlot >= 0, "Collision slot was not found."); UUID otherTx = TestTransactionIds.newTransactionId(); CompletableFuture<Lock> xLockFut = lockManager.acquire(otherTx, new LockKey(collisionTx, collisionTx), LockMode.X); assertThrows(ExecutionException.class, xLockFut::get, "Failed to acquire a lock due to a possible deadlock"); lockManager.releaseAll(txs[collisionSlot]); lockManager.releaseAll(collisionTx); lockManager.releaseAll(otherTx); assertTrue(lockManager.isEmpty()); } {code} h3. Definition of done We have to forbid using conflicted locks on one key, even if it would lead to throwing an exception on the overflow lock table was: h3. Motivation This is a test that demonstrates the misbehavior of current lock manager implementation: {code} @Test public void testCollision() throws Exception { int maxSlots = 16; HeapLockManager lockManager = new HeapLockManager(maxSlots, maxSlots); lockManager.start(new WaitDieDeadlockPreventionPolicy()); UUID[] txs = new UUID[maxSlots]; for (int i = 0; i < maxSlots; i++) { txs[i] = TestTransactionIds.newTransactionId(); lockManager.acquire(txs[i], new LockKey(txs[i], txs[i]), LockMode.S).get(); } UUID collisionTx = TestTransactionIds.newTransactionId(); lockManager.acquire(collisionTx, new LockKey(collisionTx, collisionTx), LockMode.S).get(); int collisionSlot = -1; for (int i = 0; i < maxSlots; i++) { if (lockManager.queue(new LockKey(txs[i], txs[i])).size() == 2) { collisionSlot = i; } else { lockManager.releaseAll(txs[i]); } } assertTrue(collisionSlot >= 0, "Collision slot was not found."); UUID otherTx = TestTransactionIds.newTransactionId(); CompletableFuture<Lock> xLockFut = lockManager.acquire(otherTx, new LockKey(collisionTx, collisionTx), LockMode.X); assertThrows(ExecutionException.class, xLockFut::get, "Failed to acquire a lock due to a possible deadlock"); lockManager.releaseAll(txs[collisionSlot]); lockManager.releaseAll(collisionTx); lockManager.releaseAll(otherTx); assertTrue(lockManager.isEmpty()); } {code} h3. Definition of done We have to forbid using conflicted locks on one key, even if it would lead to throwing an exception on the overflow lock table. > Heap lock manager behave incorrectly in case of overflow > -------------------------------------------------------- > > Key: IGNITE-24267 > URL: https://issues.apache.org/jira/browse/IGNITE-24267 > Project: Ignite > Issue Type: Improvement > Reporter: Vladislav Pyatkov > Assignee: Vladislav Pyatkov > Priority: Major > Labels: ignite-3 > Fix For: 3.1 > > Time Spent: 10m > Remaining Estimate: 0h > > h3. Motivation > This is a test that demonstrates the misbehavior of current lock manager > implementation: > {code} > @Test > public void testCollision() throws Exception { > int maxSlots = 16; > HeapLockManager lockManager = new HeapLockManager(maxSlots, maxSlots); > lockManager.start(new WaitDieDeadlockPreventionPolicy()); > UUID[] txs = new UUID[maxSlots]; > for (int i = 0; i < maxSlots; i++) { > txs[i] = TestTransactionIds.newTransactionId(); > lockManager.acquire(txs[i], new LockKey(txs[i], txs[i]), > LockMode.S).get(); > } > UUID collisionTx = TestTransactionIds.newTransactionId(); > lockManager.acquire(collisionTx, new LockKey(collisionTx, collisionTx), > LockMode.S).get(); > int collisionSlot = -1; > for (int i = 0; i < maxSlots; i++) { > if (lockManager.queue(new LockKey(txs[i], txs[i])).size() == 2) { > collisionSlot = i; > } else { > lockManager.releaseAll(txs[i]); > } > } > assertTrue(collisionSlot >= 0, "Collision slot was not found."); > UUID otherTx = TestTransactionIds.newTransactionId(); > CompletableFuture<Lock> xLockFut = lockManager.acquire(otherTx, new > LockKey(collisionTx, collisionTx), LockMode.X); > assertThrows(ExecutionException.class, xLockFut::get, "Failed to acquire > a lock due to a possible deadlock"); > lockManager.releaseAll(txs[collisionSlot]); > lockManager.releaseAll(collisionTx); > lockManager.releaseAll(otherTx); > assertTrue(lockManager.isEmpty()); > } > {code} > h3. Definition of done > We have to forbid using conflicted locks on one key, even if it would lead to > throwing an exception on the overflow lock table -- This message was sent by Atlassian Jira (v8.20.10#820010)