vldpyatkov commented on code in PR #13366:
URL: https://github.com/apache/ignite/pull/13366#discussion_r3712841546


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java:
##########
@@ -581,6 +598,228 @@ private FieldsQueryCursor<List<?>> 
executeDdl(RootQuery<Row> qry, DdlPlan plan)
         }
     }
 
+    /**
+     * Executes a {@code SELECT ... FOR UPDATE} plan.
+     *
+     * <ol>
+     *   <li>Validates that the current transaction is PESSIMISTIC.</li>
+     *   <li>Runs the inner SELECT with hidden key, value, and version columns 
and materialises all rows.</li>
+     *   <li>Builds cache entries from the hidden columns.</li>
+     *   <li>Creates a savepoint, acquires pessimistic locks via {@code 
lockTxEntries()},
+     *       and releases the savepoint on success (or rolls back on 
failure).</li>
+     *   <li>Repeats the SELECT and lock attempt after a concurrent version 
change while the deadline permits.</li>
+     *   <li>Returns a cursor with only the user-visible columns (the appended 
_KEY is stripped).</li>
+     * </ol>
+     */
+    private FieldsQueryCursor<List<?>> executeForUpdate(RootQuery<Row> qry, 
SelectForUpdatePlan plan) {
+        GridNearTxLocal userTx = Commons.queryTransaction(qry.context(), 
ctx.cache().context());
+
+        if (userTx == null || !userTx.pessimistic())
+            throw new IgniteSQLException(
+                
IgniteResource.INSTANCE.selectForUpdateRequiresPessimisticTx().str(),
+                IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
+
+        // waitSeconds: null = use tx remaining time (0), 0 = NOWAIT (-1), 
positive = ms.

Review Comment:
   I translate it right now. If you get in waitSeconds after parsing the query 
string, null it, which means you have to pass wait milliseconds 0, which means 
wait until the transaction is alive. If you get 0 (in waitSeconds) you have to 
pass -1L (or any negative digit) with means nowait, or if you get a digit, you 
have to convert seconds to milliseconds and pass the result.
   I will extend the comment here.



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