ascherbakoff commented on code in PR #7799:
URL: https://github.com/apache/ignite-3/pull/7799#discussion_r3062525374
##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/HeapLockManager.java:
##########
@@ -861,35 +949,114 @@ IgniteBiTuple<CompletableFuture<Void>, LockMode>
tryAcquire(UUID txId, LockMode
}
}
- if (!isWaiterReadyToNotify(waiter, false)) {
- if (deadlockPreventionPolicy.waitTimeout() > 0) {
+ notifications = tryAcquireInternal(waiter, prev == null,
false);
+ }
+
+ // Callback outside the monitor.
+ for (Runnable r : notifications) {
+ r.run();
+ }
+
+ return new IgniteBiTuple<>(waiter.fut, waiter.lockMode());
+ }
+
+ private void failWaiter(WaiterImpl waiter, List<Runnable>
notifications, Exception exception) {
+ if (!waiter.locked()) {
+ waiters.remove(waiter.txId());
+ } else if (waiter.hasLockIntent()) {
+ waiter.refuseIntent(); // Reset lock intention.
+ }
+ waiter.fail(exception);
+ notifications.add(waiter::notifyLocked);
+ }
+
+ private List<Runnable> tryAcquireInternal(WaiterImpl waiter, boolean
track, boolean unlock) {
+ List<Runnable> notifications = new ArrayList<>();
+
+ if (sealed(waiter.txId)) {
+ failWaiter(waiter, notifications,
resolveTransactionSealedException(waiter.txId));
+ return notifications;
+ }
+
+ boolean[] needWait = {false};
+ boolean[] notified = {false};
+
+ findConflicts(waiter, owner -> {
+ assert !waiter.txId.equals(owner.txId);
+ @Nullable WaiterImpl toFail = (WaiterImpl)
deadlockPreventionPolicy.allowWait(waiter, owner);
Review Comment:
🆗
--
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]