vldpyatkov commented on code in PR #7107:
URL: https://github.com/apache/ignite-3/pull/7107#discussion_r2576851317


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/HeapLockManager.java:
##########
@@ -868,15 +857,20 @@ private boolean isWaiterReadyToNotify(WaiterImpl waiter, 
boolean skipFail) {
 
             for (Entry<UUID, WaiterImpl> entry : 
waiters.tailMap(waiter.txId(), false).entrySet()) {
                 WaiterImpl tmp = entry.getValue();
-                LockMode mode = tmp.lockMode;
+                LockMode currentlyAcquiredLockMode = tmp.lockMode;
 
-                if (mode != null && !mode.isCompatible(intendedLockMode)) {
+                if (currentlyAcquiredLockMode != null && 
!currentlyAcquiredLockMode.isCompatible(intendedLockMode)) {
                     if (conflictFound(waiter.txId())) {
                         waiter.fail(abandonedLockException(waiter.txId, 
tmp.txId));
 
                         return true;
                     } else if (!deadlockPreventionPolicy.usePriority() && 
deadlockPreventionPolicy.waitTimeout() == 0) {
-                        waiter.fail(lockException(waiter.txId, tmp.txId));
+                        waiter.fail(new PossibleDeadlockOnLockAcquireException(

Review Comment:
   If you added a new exception for lock conflict with an alive transaction, 
could you please add it here `CoarseLockState#notifyAndFail`?
   And also get rid of the method `coarseLockException`. Instead of it, you 
will use abandonedLockException for lock conflict with abandoned transaction 
and PossibleDeadlockOnLockAcquireException for the alive one.



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionReplicaListener.java:
##########
@@ -207,7 +212,15 @@ private static PendingTxPartitionEnlistment 
createAbandonedTxRecoveryEnlistment(
     public CompletableFuture<ReplicaResult> invoke(ReplicaRequest request, 
UUID senderId) {
         return replicaPrimacyEngine.validatePrimacy(request)
                 .thenCompose(replicaPrimacy -> processRequest(request, 
replicaPrimacy, senderId))
-                .thenApply(res -> {
+                .handle((res, ex) -> {
+                    if (ex != null) {
+                        if (hasCause(ex, LockException.class)) {
+                            sneakyThrow(new 
OperationLockException(request.getClass(), (LockException) unwrapCause(ex)));

Review Comment:
   I do not think a request class is enough to identify an operation because we 
have several operations in two request classes: ReadWriteMultiRowReplicaRequest 
and ReadWriteSingleRowReplicaRequest.
   I rather think about SingleRowReplicaRequest#requestType.



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

Reply via email to