Copilot commented on code in PR #13673:
URL: https://github.com/apache/ignite/pull/13673#discussion_r4481427568


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java:
##########
@@ -579,13 +583,38 @@ private void processDhtLockRequest0(UUID nodeId, 
GridDhtLockRequest req) {
      * @param req Request.
      */
     private void processDhtUnlockRequest(UUID nodeId, GridDhtUnlockRequest 
req) {
-        clearLocks(nodeId, req);
+        if (req.unlockOptions == null) {
+            clearLocks(nodeId, req);
 
-        if (req.forSavepoint())
-            clearTxEntries(req.version(), req.keys());
+            if (req.forSavepoint())
+                clearTxEntries(req.version(), req.keys());
 
-        if (isNearEnabled(cacheCfg))
-            near().clearLocks(nodeId, req);
+            if (isNearEnabled(cacheCfg))
+                near().clearLocks(nodeId, req);
+
+            return;
+        }
+
+        GridCompoundFuture<Void, Void> cleanup = new GridCompoundFuture<>();
+
+        try {
+            clearLocks(nodeId, req);
+
+            if (!F.isEmpty(req.keys())) {
+                for (KeyCacheObject key : req.keys())
+                    clearTxEntry(req.version(), key, cleanup);
+            }
+
+            if (isNearEnabled(cacheCfg))
+                near().clearLocks(nodeId, req);
+        }
+        catch (IgniteCheckedException | RuntimeException e) {
+            cleanup.onDone(e);
+        }
+
+        cleanup.markInitialized();
+
+        sendUnlockResponse(nodeId, req, cleanup);
     }

Review Comment:
   `sendUnlockResponse` (added later in this class) accepts 
`GridNearUnlockRequest`, but here it’s invoked with `GridDhtUnlockRequest`. 
This is a compilation error (or will call an unintended overload if one exists 
elsewhere). Fix by adding an overload `sendUnlockResponse(UUID, 
GridDhtUnlockRequest, IgniteInternalFuture<Void>)`, or by refactoring to a 
shared helper that accepts the common fields (`unlockOptions.futId`, etc.) for 
both request types.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java:
##########
@@ -3073,193 +3087,172 @@ public CacheMetricsImpl metrics0() {
             return new GridFinishedFuture<>(
                 new IgniteCheckedException("Failed to acquire transactional 
lock in optimistic transaction."));
 
-        // Wait for previous per-transaction async operations to finish.
+        if 
(!ctx.kernalContext().rollingUpgrade().features().isActive(VERSIONED_TX_LOCK_FEATURE))
+            return new GridFinishedFuture<>(new IgniteCheckedException(
+                "Primary-side versioned transactional locks require rolling 
upgrade to be finalized."));
+
         tx.txState().awaitLastFuture();
 
         if (!tx.init())
             return new GridFinishedFuture<>(new 
IgniteTxRollbackCheckedException(
                 "Failed to acquire transactional lock because transaction has 
been completed: " + tx));
 

Review Comment:
   This makes `lockTxEntries*` hard-fail for the entire rolling-upgrade window 
until the feature is finalized. That’s a concrete behavioral change for callers 
(e.g., Calcite `SELECT FOR UPDATE`) during mixed-version clusters. If possible, 
consider a compatibility fallback to the legacy (non-primary-validated) 
implementation when the feature isn’t active, or (at minimum) include more 
actionable guidance in the exception (e.g., which finalize action/command is 
required) since this can surface as an operational outage during upgrade.



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