denis-chudov commented on code in PR #2537: URL: https://github.com/apache/ignite-3/pull/2537#discussion_r1831500153
########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/TransactionIds.java: ########## @@ -76,14 +80,22 @@ public static int nodeId(UUID transactionId) { } public static TxPriority priority(UUID txId) { - int ordinal = (int) (txId.getLeastSignificantBits() & 1); + int ordinal = (int) ((txId.getLeastSignificantBits() >> 16) & 1); return TxPriority.values()[ordinal]; } - private static long combine(int nodeId, TxPriority priority) { - int priorityAsInt = priority.ordinal(); + public static boolean implicit(UUID txId) { + return (txId.getLeastSignificantBits() & IMPLICIT_TX_FLAG) == 1; + } + + private static long combine(int nodeId, TxPriority priority, boolean implicit) { + int priorityAndFlagsAsInt = priority.ordinal() << 16; Review Comment: Let's introduce `16` as a constant offset for priority. ########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionWrapperImpl.java: ########## @@ -28,7 +28,11 @@ * Wrapper for the transaction that encapsulates the management of an implicit transaction. */ public class QueryTransactionWrapperImpl implements QueryTransactionWrapper { - private final boolean implicit; + /** + * This flag does not match with the implicit transact. Review Comment: ```suggestion * This flag does not signify the type of transaction. ``` ########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java: ########## @@ -52,29 +53,29 @@ public interface TxManager extends IgniteComponent { * @param timestampTracker Observable timestamp tracker is used to track a timestamp for either read-write or read-only * transaction execution. The tracker is also used to determine the read timestamp for read-only transactions. Each client * should pass its own tracker to provide linearizability between read-write and read-only transactions started by this client. + * @param implicit Either the transaction is implicit or not. * @param readOnly {@code true} in order to start a read-only transaction, {@code false} in order to start read-write one. * Calling begin with readOnly {@code false} is an equivalent of TxManager#begin(). * @return The started transaction. * @throws IgniteInternalException with {@link Transactions#TX_READ_ONLY_TOO_OLD_ERR} if transaction much older than the data * available in the tables. */ - InternalTransaction begin(HybridTimestampTracker timestampTracker, boolean readOnly); + InternalTransaction begin(HybridTimestampTracker timestampTracker, boolean implicit, boolean readOnly); /** * Starts either read-write or read-only transaction, depending on {@code readOnly} parameter value. * * @param timestampTracker Observable timestamp tracker is used to track a timestamp for either read-write or read-only * transaction execution. The tracker is also used to determine the read timestamp for read-only transactions. Each client * should pass its own tracker to provide linearizability between read-write and read-only transactions started by this client. + * @param implicit Either the transaction is implicit or not. Review Comment: ```suggestion * @param implicit Whether the transaction is implicit or not. ``` ########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java: ########## @@ -41,9 +41,10 @@ public interface TxManager extends IgniteComponent { * * @param timestampTracker Observable timestamp tracker is used to track a timestamp for either read-write or read-only * transaction execution. The tracker is also used to determine the read timestamp for read-only transactions. + * @param implicit Either the transaction is implicit or not. Review Comment: ```suggestion * @param implicit Whether the transaction is implicit or not. ``` ########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java: ########## @@ -52,29 +53,29 @@ public interface TxManager extends IgniteComponent { * @param timestampTracker Observable timestamp tracker is used to track a timestamp for either read-write or read-only * transaction execution. The tracker is also used to determine the read timestamp for read-only transactions. Each client * should pass its own tracker to provide linearizability between read-write and read-only transactions started by this client. + * @param implicit Either the transaction is implicit or not. Review Comment: ```suggestion * @param implicit Whether the transaction is implicit or not. ``` ########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/TransactionIds.java: ########## @@ -55,10 +58,11 @@ public static UUID transactionId(HybridTimestamp beginTimestamp, int nodeId) { * @param beginTimestamp Transaction begin timestamp. * @param nodeId Unique ID of the current node used to make generated transaction IDs globally unique. * @param priority Transaction priority. + * @param implicit Transaction is implicitly started or not. Review Comment: ```suggestion * @param implicit Whether the transaction is started implicitly or not. ``` ########## modules/transactions/src/main/java/org/apache/ignite/internal/tx/TransactionIds.java: ########## @@ -26,6 +26,9 @@ * Collection of utils to generate and pick apart transaction IDs. */ public class TransactionIds { + + public static final int IMPLICIT_TX_FLAG = 0x00000001; Review Comment: can be private. And why not just `0x1`? -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org