diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchExecuteRequest.java b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchExecuteRequest.java index 0994126b837..31ed5e6844a 100644 --- a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchExecuteRequest.java +++ b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchExecuteRequest.java @@ -28,7 +28,7 @@ /** * JDBC batch execute request. */ -public class JdbcBatchExecuteRequest implements ClientMessage { +public class JdbcBatchExecuteRequest extends JdbcObservableTimeAwareRequest implements ClientMessage { /** Schema name. */ private String schemaName; diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchPreparedStmntRequest.java b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchPreparedStmntRequest.java index 6391b29a17a..ddf36c2972a 100644 --- a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchPreparedStmntRequest.java +++ b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcBatchPreparedStmntRequest.java @@ -29,7 +29,7 @@ /** * JDBC prepared statement query batch execute request. */ -public class JdbcBatchPreparedStmntRequest implements ClientMessage { +public class JdbcBatchPreparedStmntRequest extends JdbcObservableTimeAwareRequest implements ClientMessage { /** Schema name. */ private String schemaName; diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcFinishTxResult.java b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcFinishTxResult.java index 5c6cbfa6f26..1a6efd904c1 100644 --- a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcFinishTxResult.java +++ b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcFinishTxResult.java @@ -17,15 +17,29 @@ package org.apache.ignite.internal.jdbc.proto.event; +import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.jetbrains.annotations.Nullable; + /** * Result of commit/rollback command. */ public class JdbcFinishTxResult extends Response { + /** Observable timestamp used only on server side. */ + @SuppressWarnings("TransientFieldInNonSerializableClass") + private final transient @Nullable HybridTimestamp observableTime; + /** * Default constructor is used for deserialization. */ public JdbcFinishTxResult() { - // No-op. + this.observableTime = null; + } + + /** + * Constructor. + */ + public JdbcFinishTxResult(@Nullable HybridTimestamp observableTime) { + this.observableTime = observableTime; } /** @@ -36,5 +50,14 @@ public JdbcFinishTxResult() { */ public JdbcFinishTxResult(int status, String err) { super(status, err); + + this.observableTime = null; + } + + /** + * Returns transaction observable time. + */ + public @Nullable HybridTimestamp observableTime() { + return observableTime; } } diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcObservableTimeAwareRequest.java b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcObservableTimeAwareRequest.java new file mode 100644 index 00000000000..36334697a1e --- /dev/null +++ b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcObservableTimeAwareRequest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.jdbc.proto.event; + +import org.apache.ignite.internal.hlc.HybridTimestampTracker; +import org.jetbrains.annotations.Nullable; + +/** + * An extension to JDBC request that provides the ability to update and read client observable time. + */ +abstract class JdbcObservableTimeAwareRequest { + /** Tracker of the latest time observed by client. */ + @SuppressWarnings("TransientFieldInNonSerializableClass") + private transient @Nullable HybridTimestampTracker timestampTracker; + + /** Returns the tracker of the latest time observed by client. */ + public @Nullable HybridTimestampTracker timestampTracker() { + return timestampTracker; + } + + /** Sets the tracker of the latest time observed by client. */ + public void timestampTracker(HybridTimestampTracker tracker) { + this.timestampTracker = tracker; + } +} diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcQueryExecuteRequest.java b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcQueryExecuteRequest.java index cd48d51d1f8..b6579249208 100644 --- a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcQueryExecuteRequest.java +++ b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/JdbcQueryExecuteRequest.java @@ -27,7 +27,7 @@ /** * JDBC query execute request. */ -public class JdbcQueryExecuteRequest implements ClientMessage { +public class JdbcQueryExecuteRequest extends JdbcObservableTimeAwareRequest implements ClientMessage { /** Expected statement type. */ private JdbcStatementType stmtType; @@ -61,6 +61,9 @@ public class JdbcQueryExecuteRequest implements ClientMessage { */ private long correlationToken; + /** The latest time observed by client. */ + private long observableTime; + /** * Default constructor. For deserialization purposes. */ @@ -91,7 +94,8 @@ public JdbcQueryExecuteRequest( boolean autoCommit, boolean multiStatement, long queryTimeoutMillis, - long correlationToken + long correlationToken, + long observableTime ) { Objects.requireNonNull(stmtType); @@ -105,6 +109,7 @@ public JdbcQueryExecuteRequest( this.multiStatement = multiStatement; this.queryTimeoutMillis = queryTimeoutMillis; this.correlationToken = correlationToken; + this.observableTime = observableTime; } /** @@ -190,6 +195,10 @@ public long correlationToken() { return correlationToken; } + public long observableTime() { + return observableTime; + } + /** {@inheritDoc} */ @Override public void writeBinary(ClientMessagePacker packer) { @@ -204,6 +213,7 @@ public void writeBinary(ClientMessagePacker packer) { packer.packObjectArrayAsBinaryTuple(args); packer.packLong(queryTimeoutMillis); packer.packLong(correlationToken); + packer.packLong(observableTime); } /** {@inheritDoc} */ @@ -220,6 +230,7 @@ public void readBinary(ClientMessageUnpacker unpacker) { args = unpacker.unpackObjectArrayFromBinaryTuple(); queryTimeoutMillis = unpacker.unpackLong(); correlationToken = unpacker.unpackLong(); + observableTime = unpacker.unpackLong(); } /** {@inheritDoc} */ diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/Response.java b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/Response.java index 9e625e28279..618e50cb1ca 100644 --- a/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/Response.java +++ b/modules/client-common/src/main/java/org/apache/ignite/internal/jdbc/proto/event/Response.java @@ -39,9 +39,6 @@ public abstract class Response implements ClientMessage { /** Error. */ private String err; - /** Has results. */ - protected boolean hasResults; - /** * Constructs successful response. */ @@ -121,9 +118,9 @@ public void err(String err) { } /** - * Gets hasResults flag. + * Gets success status. * - * @return Has results. + * @return {@code True} if command succeeded, {@code false} otherwise. */ public boolean success() { return status == STATUS_SUCCESS; diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java index 8bf9d4df804..889833c8998 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java @@ -715,10 +715,6 @@ private void processOperation(ChannelHandlerContext ctx, ClientMessageUnpacker i return ClientTupleContainsAllKeysRequest.process(in, out, igniteTables, resources, txManager); case ClientOp.JDBC_CONNECT: - // TODO: IGNITE-24053 JDBC request ought to contain the client observation timestamp. - jdbcQueryEventHandler.getTimestampTracker().update(clockService.current()); - out.meta(jdbcQueryEventHandler.getTimestampTracker().get()); - return ClientJdbcConnectRequest.execute(in, out, jdbcQueryEventHandler); case ClientOp.JDBC_EXEC: @@ -821,6 +817,7 @@ private void processOperation(ChannelHandlerContext ctx, ClientMessageUnpacker i case ClientOp.SQL_EXEC_SCRIPT: return ClientSqlExecuteScriptRequest.process(in, queryProcessor).thenRun(() -> { if (out.meta() == null) { + // TODO https://issues.apache.org/jira/browse/IGNITE-24275 Must set updated time instead of current time. out.meta(clockService.current()); } }); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcConnectionContext.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcConnectionContext.java new file mode 100644 index 00000000000..16a03727cc5 --- /dev/null +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcConnectionContext.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.client.handler; + +import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture; + +import java.time.ZoneId; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; +import org.apache.ignite.internal.tx.InternalTransaction; +import org.apache.ignite.internal.tx.InternalTxOptions; +import org.apache.ignite.internal.tx.TxManager; +import org.apache.ignite.lang.CancelHandle; +import org.apache.ignite.lang.CancellationToken; +import org.jetbrains.annotations.Nullable; + +/** + * JDBC connection context. + */ +class JdbcConnectionContext { + private final AtomicBoolean closed = new AtomicBoolean(); + + private final Object mux = new Object(); + + private final TxManager txManager; + + private final ZoneId timeZoneId; + + private final ConcurrentMap cancelHandles = new ConcurrentHashMap<>(); + + private @Nullable TxWithTimeTracker txWithTimeTracker; + + JdbcConnectionContext( + TxManager txManager, + ZoneId timeZoneId + ) { + this.txManager = txManager; + this.timeZoneId = timeZoneId; + } + + ZoneId timeZoneId() { + return timeZoneId; + } + + /** + * Gets the transaction associated with the current connection, starts a new one if it doesn't already exist. + * + *

NOTE: this method is not thread-safe and should only be called by a single thread. + * + * @return Transaction associated with the current connection. + */ + InternalTransaction getOrStartTransaction(HybridTimestampTracker timestampTracker) { + if (txWithTimeTracker == null) { + InternalTransaction tx = txManager.beginExplicitRw(timestampTracker, InternalTxOptions.defaults()); + + txWithTimeTracker = new TxWithTimeTracker(tx, timestampTracker); + } + + return txWithTimeTracker.transaction(); + } + + /** + * Finishes active transaction, if one exists. + * + *

NOTE: this method is not thread-safe and should only be called by a single thread. + * + * @param commit {@code True} to commit, {@code false} to rollback. + * @return Future that represents the pending completion of the operation. + */ + CompletableFuture<@Nullable HybridTimestamp> finishTransactionAsync(boolean commit) { + TxWithTimeTracker txWithTimeTracker0 = txWithTimeTracker; + + txWithTimeTracker = null; + + if (txWithTimeTracker0 == null) { + return nullCompletedFuture(); + } + + return commit + ? txWithTimeTracker0.transaction().commitAsync().thenApply(ignore -> txWithTimeTracker0.observableTimestamp()) + : txWithTimeTracker0.transaction().rollbackAsync().thenApply(ignore -> null); + } + + boolean valid() { + return !closed.get(); + } + + void close() { + if (!closed.compareAndSet(false, true)) { + return; + } + + synchronized (mux) { + finishTransactionAsync(false); + } + } + + CancellationToken registerExecution(long token) { + CancelHandle handle = CancelHandle.create(); + + CancelHandle previousHandle = cancelHandles.putIfAbsent(token, handle); + + assert previousHandle == null; + + return handle.token(); + } + + void deregisterExecution(long token) { + cancelHandles.remove(token); + } + + CompletableFuture cancelExecution(long token) { + CancelHandle handle = cancelHandles.remove(token); + + if (handle == null) { + return nullCompletedFuture(); + } + + return handle.cancelAsync(); + } + + private static class TxWithTimeTracker { + private final InternalTransaction transaction; + private final HybridTimestampTracker tracker; + + private TxWithTimeTracker(InternalTransaction transaction, HybridTimestampTracker tracker) { + this.transaction = transaction; + this.tracker = tracker; + } + + InternalTransaction transaction() { + return transaction; + } + + @Nullable HybridTimestamp observableTimestamp() { + return tracker.get(); + } + } +} diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcHandlerBase.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcHandlerBase.java index a3a54a986d3..f1abedb91b1 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcHandlerBase.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcHandlerBase.java @@ -19,7 +19,6 @@ import static org.apache.ignite.internal.jdbc.proto.IgniteQueryErrorCode.UNSUPPORTED_OPERATION; import static org.apache.ignite.internal.sql.engine.SqlQueryType.DDL; -import static org.apache.ignite.internal.sql.engine.SqlQueryType.DML; import static org.apache.ignite.internal.sql.engine.SqlQueryType.KILL; import static org.apache.ignite.internal.sql.engine.SqlQueryType.TX_CONTROL; @@ -49,16 +48,12 @@ * Contains common methods used to process jdbc requests. */ abstract class JdbcHandlerBase { - /** {@link SqlQueryType}s allowed in JDBC select statements. **/ public static final Set SELECT_STATEMENT_QUERIES = Set.of( SqlQueryType.QUERY, SqlQueryType.EXPLAIN ); - /** {@link SqlQueryType}s allowed in JDBC update statements. **/ - public static final Set UPDATE_STATEMENT_QUERIES = Set.of(DML, DDL, KILL); - /** {@link SqlQueryType}s types that return 0 in executeUpdate and execute / getUpdateCount. **/ public static final Set ZERO_UPDATE_COUNT_QUERIES = Set.of(DDL, KILL, TX_CONTROL); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java index 0cc8bf99427..55aab8b02c6 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java @@ -21,7 +21,6 @@ import static org.apache.ignite.internal.sql.engine.SqlQueryType.DML; import static org.apache.ignite.internal.util.ArrayUtils.OBJECT_EMPTY_ARRAY; import static org.apache.ignite.internal.util.CompletableFutures.allOf; -import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture; import static org.apache.ignite.lang.ErrorGroups.Client.CONNECTION_ERR; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -29,14 +28,13 @@ import java.time.ZoneId; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import org.apache.ignite.client.handler.requests.jdbc.JdbcMetadataCatalog; import org.apache.ignite.client.handler.requests.jdbc.JdbcQueryCursor; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.JdbcQueryEventHandler; import org.apache.ignite.internal.jdbc.proto.JdbcStatementType; import org.apache.ignite.internal.jdbc.proto.event.JdbcBatchExecuteRequest; @@ -65,12 +63,9 @@ import org.apache.ignite.internal.sql.engine.SqlQueryType; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; -import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.util.AsyncCursor.BatchedResult; -import org.apache.ignite.lang.CancelHandle; import org.apache.ignite.lang.CancellationToken; import org.apache.ignite.table.QualifiedName; import org.jetbrains.annotations.Nullable; @@ -82,12 +77,6 @@ public class JdbcQueryEventHandlerImpl extends JdbcHandlerBase implements JdbcQu /** {@link SqlQueryType}s allowed in JDBC update statements. **/ public static final Set UPDATE_STATEMENT_QUERIES = Set.of(DML, SqlQueryType.DDL, SqlQueryType.KILL); - /** - * Observation timestamp tracker. - * TODO: IGNITE-24053 Remove this after the issue will be fixed. - * */ - private final HybridTimestampTracker timestampTracker = HybridTimestampTracker.atomicTracker(null); - /** Sql query processor. */ private final QueryProcessor processor; @@ -159,19 +148,19 @@ public CompletableFuture queryAsync(long connectionId, JdbcQ long correlationToken = req.correlationToken(); CancellationToken token = connectionContext.registerExecution(correlationToken); - InternalTransaction tx = req.autoCommit() ? null : connectionContext.getOrStartTransaction(timestampTracker); - + HybridTimestampTracker timeTracker = Objects.requireNonNull(req.timestampTracker()); JdbcStatementType reqStmtType = req.getStmtType(); String defaultSchemaName = req.schemaName(); boolean multiStatement = req.multiStatement(); ZoneId timeZoneId = connectionContext.timeZoneId(); long timeoutMillis = req.queryTimeoutMillis(); + InternalTransaction tx = req.autoCommit() ? null : connectionContext.getOrStartTransaction(timeTracker); SqlProperties properties = createProperties(reqStmtType, defaultSchemaName, multiStatement, timeZoneId, timeoutMillis); CompletableFuture> result = processor.queryAsync( properties, - timestampTracker, + timeTracker, tx, token, req.sqlQuery(), @@ -184,10 +173,6 @@ public CompletableFuture queryAsync(long connectionId, JdbcQ .exceptionally(t -> createErrorResult("Exception while executing query.", t, null)); } - public HybridTimestampTracker getTimestampTracker() { - return timestampTracker; - } - private static SqlProperties createProperties( JdbcStatementType stmtType, String defaultSchemaName, @@ -233,7 +218,9 @@ public CompletableFuture batchAsync(long connectionId, J return CompletableFuture.completedFuture(new JdbcBatchExecuteResult(Response.STATUS_FAILED, "Connection is broken")); } - InternalTransaction tx = req.autoCommit() ? null : connectionContext.getOrStartTransaction(timestampTracker); + HybridTimestampTracker timeTracker = Objects.requireNonNull(req.timestampTracker()); + InternalTransaction tx = req.autoCommit() ? null : connectionContext.getOrStartTransaction(timeTracker); + long correlationToken = req.correlationToken(); CancellationToken token = connectionContext.registerExecution(correlationToken); String defaultSchemaName = req.schemaName(); @@ -246,6 +233,7 @@ public CompletableFuture batchAsync(long connectionId, J tail = tail.thenCompose(list -> executeAndCollectUpdateCount( connectionContext, defaultSchemaName, + timeTracker, tx, token, query, @@ -276,7 +264,11 @@ public CompletableFuture batchPrepStatementAsync(long co return CompletableFuture.completedFuture(new JdbcBatchExecuteResult(Response.STATUS_FAILED, "Connection is broken")); } - InternalTransaction tx = req.autoCommit() ? null : connectionContext.getOrStartTransaction(timestampTracker); + HybridTimestampTracker timeTracker = Objects.requireNonNull(req.timestampTracker()); + InternalTransaction tx = req.autoCommit() ? null : connectionContext.getOrStartTransaction(timeTracker); + + assert req.autoCommit() || tx != null; + long correlationToken = req.correlationToken(); CancellationToken token = connectionContext.registerExecution(correlationToken); var argList = req.getArgs(); @@ -287,7 +279,7 @@ public CompletableFuture batchPrepStatementAsync(long co for (Object[] args : argList) { tail = tail.thenCompose(list -> executeAndCollectUpdateCount( - connectionContext, defaultSchemaName, tx, token, req.getQuery(), args, timeoutMillis, list + connectionContext, defaultSchemaName, timeTracker, tx, token, req.getQuery(), args, timeoutMillis, list )); } @@ -305,6 +297,7 @@ public CompletableFuture batchPrepStatementAsync(long co private CompletableFuture executeAndCollectUpdateCount( JdbcConnectionContext context, String defaultSchemaName, + HybridTimestampTracker tracker, @Nullable InternalTransaction tx, CancellationToken token, String sql, @@ -325,7 +318,7 @@ private CompletableFuture executeAndCollectUpdateCount( CompletableFuture> result = processor.queryAsync( properties, - timestampTracker, + tracker, tx, token, sql, @@ -407,12 +400,12 @@ public CompletableFuture finishTxAsync(long connectionId, bo return CompletableFuture.completedFuture(new JdbcFinishTxResult(Response.STATUS_FAILED, "Connection is broken")); } - return connectionContext.finishTransactionAsync(commit).handle((ignored, t) -> { + return connectionContext.finishTransactionAsync(commit).handle((observableTime, t) -> { if (t != null) { return new JdbcFinishTxResult(Response.STATUS_FAILED, t.getMessage()); } - return new JdbcFinishTxResult(); + return new JdbcFinishTxResult(observableTime); }); } @@ -436,102 +429,6 @@ public CompletableFuture cancelAsync(long connectionId, l }); } - static class JdbcConnectionContext { - private final AtomicBoolean closed = new AtomicBoolean(); - - private final Object mux = new Object(); - - private final TxManager txManager; - - private final ZoneId timeZoneId; - - private final ConcurrentMap cancelHandles = new ConcurrentHashMap<>(); - - private @Nullable InternalTransaction tx; - - JdbcConnectionContext( - TxManager txManager, - ZoneId timeZoneId - ) { - this.txManager = txManager; - this.timeZoneId = timeZoneId; - } - - ZoneId timeZoneId() { - return timeZoneId; - } - - /** - * Gets the transaction associated with the current connection, starts a new one if it doesn't already exist. - * - *

NOTE: this method is not thread-safe and should only be called by a single thread. - * - * @param timestampProvider Observation timestamp provider. - * @return Transaction associated with the current connection. - */ - InternalTransaction getOrStartTransaction(HybridTimestampTracker timestampProvider) { - return tx == null ? tx = txManager.beginExplicitRw(timestampProvider, InternalTxOptions.defaults()) : tx; - } - - /** - * Finishes active transaction, if one exists. - * - *

NOTE: this method is not thread-safe and should only be called by a single thread. - * - * @param commit {@code True} to commit, {@code false} to rollback. - * @return Future that represents the pending completion of the operation. - */ - CompletableFuture finishTransactionAsync(boolean commit) { - InternalTransaction tx0 = tx; - - tx = null; - - if (tx0 == null) { - return nullCompletedFuture(); - } - - return commit ? tx0.commitAsync() : tx0.rollbackAsync(); - } - - boolean valid() { - return !closed.get(); - } - - void close() { - if (!closed.compareAndSet(false, true)) { - return; - } - - synchronized (mux) { - finishTransactionAsync(false); - } - } - - CancellationToken registerExecution(long token) { - CancelHandle handle = CancelHandle.create(); - - CancelHandle previousHandle = cancelHandles.putIfAbsent(token, handle); - - assert previousHandle == null; - - return handle.token(); - } - - void deregisterExecution(long token) { - cancelHandles.remove(token); - } - - CompletableFuture cancelExecution(long token) { - CancelHandle handle = cancelHandles.remove(token); - - if (handle == null) { - return nullCompletedFuture(); - } - - return handle.cancelAsync(); - } - } - private void doWhenAllCursorsComplete( CompletableFuture> cursorFuture, Runnable action ) { diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteBatchRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteBatchRequest.java index d21534938f3..4633504a865 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteBatchRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteBatchRequest.java @@ -21,6 +21,7 @@ import org.apache.ignite.client.handler.JdbcQueryEventHandlerImpl; import org.apache.ignite.internal.client.proto.ClientMessagePacker; import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.event.JdbcBatchExecuteRequest; /** @@ -46,10 +47,12 @@ public static CompletableFuture process( req.readBinary(in); + HybridTimestampTracker timestampTracker = HybridTimestampTracker.atomicTracker(null); + // Passing the tracker only to the server-side handler. + req.timestampTracker(timestampTracker); + return handler.batchAsync(connectionId, req).thenAccept(res -> { - if (req.autoCommit()) { - out.meta(handler.getTimestampTracker().get()); - } + out.meta(timestampTracker.get()); res.writeBinary(out); }); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteRequest.java index 8e527272df9..de80809a6be 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcExecuteRequest.java @@ -21,6 +21,8 @@ import org.apache.ignite.client.handler.JdbcQueryEventHandlerImpl; import org.apache.ignite.internal.client.proto.ClientMessagePacker; import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; +import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryExecuteRequest; /** @@ -41,15 +43,17 @@ public static CompletableFuture execute( JdbcQueryEventHandlerImpl handler ) { var req = new JdbcQueryExecuteRequest(); - long connectionId = in.unpackLong(); req.readBinary(in); + HybridTimestampTracker timestampTracker = + HybridTimestampTracker.atomicTracker(HybridTimestamp.nullableHybridTimestamp(req.observableTime())); + // Passing the tracker only to the server-side handler. + req.timestampTracker(timestampTracker); + return handler.queryAsync(connectionId, req).thenAccept(res -> { - if (req.autoCommit()) { - out.meta(handler.getTimestampTracker().get()); - } + out.meta(timestampTracker.get()); res.writeBinary(out); }); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcFinishTxRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcFinishTxRequest.java index b1982a26e6d..b04586c091c 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcFinishTxRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcFinishTxRequest.java @@ -43,9 +43,7 @@ public static CompletableFuture process( boolean commit = in.unpackBoolean(); return handler.finishTxAsync(connectionId, commit).thenAccept(res -> { - if (commit) { - out.meta(handler.getTimestampTracker().get()); - } + out.meta(res.observableTime()); res.writeBinary(out); }); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcPreparedStmntBatchRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcPreparedStmntBatchRequest.java index 4bd46661a35..b63f0bf7baa 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcPreparedStmntBatchRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/ClientJdbcPreparedStmntBatchRequest.java @@ -21,6 +21,7 @@ import org.apache.ignite.client.handler.JdbcQueryEventHandlerImpl; import org.apache.ignite.internal.client.proto.ClientMessagePacker; import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.event.JdbcBatchPreparedStmntRequest; /** @@ -46,10 +47,12 @@ public static CompletableFuture process( req.readBinary(in); + HybridTimestampTracker timestampTracker = HybridTimestampTracker.atomicTracker(null); + // Passing the tracker only to the server-side handler. + req.timestampTracker(timestampTracker); + return handler.batchPrepStatementAsync(connectionId, req).thenAccept(res -> { - if (req.autoCommit()) { - out.meta(handler.getTimestampTracker().get()); - } + out.meta(timestampTracker.get()); res.writeBinary(out); }); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java index 5343250997b..abb7968bd96 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java @@ -24,9 +24,9 @@ import org.apache.ignite.internal.client.proto.ClientMessagePacker; import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.api.IgniteSqlImpl; import org.apache.ignite.internal.sql.engine.QueryProcessor; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.util.ArrayUtils; import org.apache.ignite.sql.BatchedArguments; diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java index f8d22f3d9e0..45db875d03e 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java @@ -31,6 +31,7 @@ import org.apache.ignite.internal.client.proto.ClientMessagePacker; import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteInternalCheckedException; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.sql.api.AsyncResultSetImpl; @@ -39,7 +40,6 @@ import org.apache.ignite.internal.sql.engine.SqlQueryType; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.util.ArrayUtils; import org.apache.ignite.internal.util.ExceptionUtils; diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteScriptRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteScriptRequest.java index 328d39b1a08..a242591f047 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteScriptRequest.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteScriptRequest.java @@ -20,9 +20,9 @@ import java.util.concurrent.CompletableFuture; import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.api.IgniteSqlImpl; import org.apache.ignite.internal.sql.engine.QueryProcessor; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.util.ArrayUtils; /** @@ -49,6 +49,7 @@ public static CompletableFuture process( arguments = ArrayUtils.OBJECT_EMPTY_ARRAY; } + // TODO https://issues.apache.org/jira/browse/IGNITE-24275 Script must return updated time to client. HybridTimestamp clientTs = HybridTimestamp.nullableHybridTimestamp(in.unpackLong()); var tsUpdater = HybridTimestampTracker.clientTracker(clientTs, ts -> {}); diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java index e1d156a7d2d..8a200d9ca8a 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java @@ -35,6 +35,7 @@ import org.apache.ignite.internal.client.proto.ClientMessageUnpacker; import org.apache.ignite.internal.client.proto.TuplePart; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteInternalCheckedException; import org.apache.ignite.internal.lang.NodeStoppingException; import org.apache.ignite.internal.schema.SchemaAware; @@ -42,7 +43,6 @@ import org.apache.ignite.internal.schema.SchemaRegistry; import org.apache.ignite.internal.table.IgniteTablesInternal; import org.apache.ignite.internal.table.TableViewInternal; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.tx.TxManager; diff --git a/modules/client-handler/src/test/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImplTest.java b/modules/client-handler/src/test/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImplTest.java index 4df09296b48..dfa45b2bc8a 100644 --- a/modules/client-handler/src/test/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImplTest.java +++ b/modules/client-handler/src/test/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImplTest.java @@ -25,8 +25,10 @@ import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -42,22 +44,29 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.Predicate; -import org.apache.ignite.client.handler.JdbcQueryEventHandlerImpl.JdbcConnectionContext; import org.apache.ignite.client.handler.requests.jdbc.JdbcMetadataCatalog; +import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.JdbcQueryEventHandler; import org.apache.ignite.internal.jdbc.proto.JdbcStatementType; import org.apache.ignite.internal.jdbc.proto.event.JdbcBatchExecuteRequest; import org.apache.ignite.internal.jdbc.proto.event.JdbcBatchExecuteResult; import org.apache.ignite.internal.jdbc.proto.event.JdbcBatchPreparedStmntRequest; import org.apache.ignite.internal.jdbc.proto.event.JdbcConnectResult; +import org.apache.ignite.internal.jdbc.proto.event.JdbcFinishTxResult; import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryExecuteRequest; import org.apache.ignite.internal.jdbc.proto.event.Response; import org.apache.ignite.internal.lang.IgniteInternalCheckedException; +import org.apache.ignite.internal.sql.ResultSetMetadataImpl; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; +import org.apache.ignite.internal.sql.engine.AsyncSqlCursorImpl; import org.apache.ignite.internal.sql.engine.InternalSqlRow; import org.apache.ignite.internal.sql.engine.QueryCancelledException; import org.apache.ignite.internal.sql.engine.QueryProcessor; +import org.apache.ignite.internal.sql.engine.SqlQueryType; +import org.apache.ignite.internal.sql.engine.util.IteratorToDataCursorAdapter; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; import org.apache.ignite.internal.testframework.IgniteTestUtils; import org.apache.ignite.internal.tx.InternalTransaction; @@ -136,11 +145,11 @@ public void contextClosedDuringBatchQuery() throws Exception { registryCloseLatch.countDown(); assertThat(startTxLatch.await(timeout, TimeUnit.SECONDS), is(true)); - return null; + return mock(InternalTransaction.class); }); CompletableFuture fut = IgniteTestUtils.runAsync(() -> - eventHandler.batchAsync(connectionId, createExecuteBatchRequest("x", "QUERY")).get() + eventHandler.batchAsync(connectionId, createExecuteBatchRequest("x", false, "QUERY")).get() ); assertThat(registryCloseLatch.await(timeout, TimeUnit.SECONDS), is(true)); @@ -164,7 +173,7 @@ public void explicitTxRollbackOnCloseRegistry() { long connectionId = acquireConnectionId(); - await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("x", "UPDATE 1"))); + await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("x", false, "UPDATE 1"))); verify(txManager).beginExplicitRw(any(), any()); verify(tx, times(0)).rollbackAsync(); @@ -191,22 +200,22 @@ public void singleTxUsedForMultipleOperations() { JdbcStatementType type = JdbcStatementType.SELECT_STATEMENT_TYPE; await(eventHandler.queryAsync( - connectionId, createExecuteRequest(schema, "SELECT 1", type) + connectionId, createExecuteRequest(schema, false, "SELECT 1", type) )); verify(txManager, times(1)).beginExplicitRw(any(), any()); - await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("schema", "UPDATE 1", "UPDATE 2"))); + await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("schema", false, "UPDATE 1", "UPDATE 2"))); verify(txManager, times(1)).beginExplicitRw(any(), any()); await(eventHandler.finishTxAsync(connectionId, false)); verify(tx).rollbackAsync(); - await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("schema", "UPDATE 1", "UPDATE 2"))); + await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("schema", false, "UPDATE 1", "UPDATE 2"))); verify(txManager, times(2)).beginExplicitRw(any(), any()); await(eventHandler.queryAsync( - connectionId, createExecuteRequest(schema, "SELECT 2", type) + connectionId, createExecuteRequest(schema, false, "SELECT 2", type) )); verify(txManager, times(2)).beginExplicitRw(any(), any()); - await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("schema", "UPDATE 3", "UPDATE 4"))); + await(eventHandler.batchAsync(connectionId, createExecuteBatchRequest("schema", false, "UPDATE 3", "UPDATE 4"))); verify(txManager, times(2)).beginExplicitRw(any(), any()); await(eventHandler.finishTxAsync(connectionId, true)); @@ -222,7 +231,7 @@ void simpleQueryCancellation() { long connectionId = acquireConnectionId(); - JdbcQueryExecuteRequest executeRequest = createExecuteRequest("schema", "SELECT 1", JdbcStatementType.SELECT_STATEMENT_TYPE); + JdbcQueryExecuteRequest executeRequest = createExecuteRequest("schema", true, "SELECT 1", JdbcStatementType.SELECT_STATEMENT_TYPE); CompletableFuture resultFuture = eventHandler.queryAsync(connectionId, executeRequest); @@ -237,7 +246,7 @@ void batchedQueryCancellation() { long connectionId = acquireConnectionId(); - JdbcBatchExecuteRequest executeRequest = createExecuteBatchRequest("schema", "SELECT 1"); + JdbcBatchExecuteRequest executeRequest = createExecuteBatchRequest("schema", true, "SELECT 1"); CompletableFuture resultFuture = eventHandler.batchAsync(connectionId, executeRequest); @@ -252,7 +261,7 @@ void prepBatchedQueryCancellation() { long connectionId = acquireConnectionId(); - JdbcBatchPreparedStmntRequest executeRequest = createExecutePrepBatchRequest("schema", "SELECT 1"); + JdbcBatchPreparedStmntRequest executeRequest = createExecutePrepBatchRequest("schema", true, "SELECT 1"); CompletableFuture resultFuture = eventHandler.batchPrepStatementAsync(connectionId, executeRequest); @@ -261,6 +270,122 @@ void prepBatchedQueryCancellation() { cancelAndVerify(connectionId, executeRequest.correlationToken(), resultFuture); } + @Test + void handlerTracksObservableTimeFromClient() { + HybridTimestamp updatedTs = HybridTimestamp.hybridTimestamp(300L); + HybridTimestamp ignoredTs = HybridTimestamp.hybridTimestamp(100L); + HybridTimestamp txTime = HybridTimestamp.hybridTimestamp(50L); + + long connectionId = acquireConnectionId(); + + AtomicReference txTrackerRef = new AtomicReference<>(); + InternalTransaction rwTx = mock(InternalTransaction.class); + when(rwTx.commitAsync()).thenAnswer(ignore -> { + txTrackerRef.get().update(txTime); + return nullCompletedFuture(); + }); + when(rwTx.rollbackAsync()).thenReturn(nullCompletedFuture()); + when(txManager.beginExplicitRw(any(HybridTimestampTracker.class), any())).thenAnswer(invocation -> { + txTrackerRef.set(invocation.getArgument(0)); + + return rwTx; + }); + + when(queryProcessor.queryAsync(any(), any(HybridTimestampTracker.class), any(), any(), any(), any(Object[].class))) + .thenAnswer(invocation -> { + HybridTimestampTracker tracker = invocation.getArgument(1); + InternalTransaction explicitTx = invocation.getArgument(2); + + if (explicitTx == null || explicitTx.isReadOnly()) { + tracker.update(updatedTs); + + // Time should only increase, smaller values should be ignored. + tracker.update(ignoredTs); + } + + return CompletableFuture.completedFuture(new AsyncSqlCursorImpl<>( + SqlQueryType.QUERY, + new ResultSetMetadataImpl(List.of()), + new IteratorToDataCursorAdapter<>(Collections.emptyIterator()), + null + )); + }); + + // Query (autocommit). + { + JdbcQueryExecuteRequest executeRequest = + createExecuteRequest("schema", true, "SELECT 1", JdbcStatementType.SELECT_STATEMENT_TYPE); + + await(eventHandler.queryAsync(connectionId, executeRequest)); + + assertThat("Should return the updated tracker value to the client.", + executeRequest.timestampTracker().get(), equalTo(updatedTs)); + } + + // Batch (autocommit). + { + JdbcBatchExecuteRequest executeRequest = createExecuteBatchRequest("schema", true, "SELECT 1"); + + await(eventHandler.batchAsync(connectionId, executeRequest)); + + assertThat("Should return the updated tracker value to the client.", + executeRequest.timestampTracker().get(), equalTo(updatedTs)); + } + + // Prepared batch (autocommit). + { + JdbcBatchPreparedStmntRequest executeRequest = createExecutePrepBatchRequest("schema", true, "SELECT 1"); + + await(eventHandler.batchPrepStatementAsync(connectionId, executeRequest)); + + assertThat("Should return the updated tracker value to the client.", + executeRequest.timestampTracker().get(), equalTo(updatedTs)); + } + + // Query (non-autocommit). + { + JdbcQueryExecuteRequest executeRequest = + createExecuteRequest("schema", false, "SELECT 1", JdbcStatementType.SELECT_STATEMENT_TYPE); + + await(eventHandler.queryAsync(connectionId, executeRequest)); + + assertThat("Should not update observable time until tx commit.", + executeRequest.timestampTracker().get(), nullValue()); + + // Rollback. + JdbcFinishTxResult res = await(eventHandler.finishTxAsync(connectionId, false)); + assertThat("The observable time must not be returned when rolling back a tx.", res.observableTime(), nullValue()); + verify(rwTx).rollbackAsync(); + } + + // Batch (non-autocommit). + { + JdbcBatchExecuteRequest executeRequest = createExecuteBatchRequest("schema", false, "SELECT 1"); + + await(eventHandler.batchAsync(connectionId, executeRequest)); + + assertThat("Should not update observable time until tx commit.", executeRequest.timestampTracker().get(), nullValue()); + assertThat("Should not update observable time until tx commit.", txTrackerRef.get().get(), nullValue()); + } + + // Prepared batch (non-autocommit). + { + JdbcBatchPreparedStmntRequest executeRequest = createExecutePrepBatchRequest("schema", false, "SELECT 1"); + + await(eventHandler.batchPrepStatementAsync(connectionId, executeRequest)); + + assertThat("Should not update observable time until tx commit.", executeRequest.timestampTracker().get(), nullValue()); + assertThat("Should not update observable time until tx commit.", txTrackerRef.get().get(), nullValue()); + } + + // Commit. + { + JdbcFinishTxResult res = await(eventHandler.finishTxAsync(connectionId, true)); + assertThat(res.observableTime(), equalTo(txTime)); + verify(rwTx).commitAsync(); + } + } + private long acquireConnectionId() { JdbcConnectResult result = await(eventHandler.connect(ZoneId.systemDefault())); @@ -298,23 +423,35 @@ private void cancelAndVerify(long connectionId, long token, CompletableFuture responseThat(String description, Predicate checker) { diff --git a/modules/client/src/main/java/org/apache/ignite/internal/client/ReliableChannel.java b/modules/client/src/main/java/org/apache/ignite/internal/client/ReliableChannel.java index 1dc83e40f03..61a592b0888 100644 --- a/modules/client/src/main/java/org/apache/ignite/internal/client/ReliableChannel.java +++ b/modules/client/src/main/java/org/apache/ignite/internal/client/ReliableChannel.java @@ -59,6 +59,8 @@ import org.apache.ignite.internal.client.io.ClientConnectionMultiplexer; import org.apache.ignite.internal.client.io.netty.NettyClientConnectionMultiplexer; import org.apache.ignite.internal.close.ManuallyCloseable; +import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.logger.IgniteLogger; import org.apache.ignite.internal.thread.NamedThreadFactory; import org.apache.ignite.internal.util.IgniteUtils; @@ -115,7 +117,7 @@ public final class ReliableChannel implements AutoCloseable { private final AtomicLong partitionAssignmentTimestamp = new AtomicLong(); /** Observable timestamp, or causality token. Sent by the server with every response, and required by some requests. */ - private final AtomicLong observableTimestamp = new AtomicLong(); + private final HybridTimestampTracker observableTimeTracker; /** Cluster id from the first handshake. */ private final AtomicReference clusterId = new AtomicReference<>(); @@ -129,15 +131,19 @@ public final class ReliableChannel implements AutoCloseable { * * @param chFactory Channel factory. * @param clientCfg Client config. + * @param metrics Client metrics. + * @param observableTimeTracker Tracker of the latest time observed by client. */ ReliableChannel( ClientChannelFactory chFactory, IgniteClientConfiguration clientCfg, - ClientMetricSource metrics) { + ClientMetricSource metrics, + HybridTimestampTracker observableTimeTracker) { this.clientCfg = Objects.requireNonNull(clientCfg, "clientCfg"); this.chFactory = Objects.requireNonNull(chFactory, "chFactory"); this.log = ClientUtils.logger(clientCfg, ReliableChannel.class); this.metrics = metrics; + this.observableTimeTracker = Objects.requireNonNull(observableTimeTracker, "observableTime"); connMgr = new NettyClientConnectionMultiplexer(metrics); connMgr.start(clientCfg); @@ -198,7 +204,7 @@ public IgniteClientConfiguration configuration() { } public long observableTimestamp() { - return observableTimestamp.get(); + return HybridTimestamp.hybridTimestampToLong(observableTimeTracker.get()); } /** @@ -695,7 +701,7 @@ private void initAllChannelsAsync() { } private void onObservableTimestampReceived(long newTs) { - observableTimestamp.updateAndGet(curTs -> Math.max(curTs, newTs)); + observableTimeTracker.update(HybridTimestamp.nullableHybridTimestamp(newTs)); } private void onPartitionAssignmentChanged(long timestamp) { diff --git a/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java b/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java index 0de3774a83b..f910535bb9e 100644 --- a/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java +++ b/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java @@ -36,6 +36,7 @@ import org.apache.ignite.internal.client.sql.ClientSql; import org.apache.ignite.internal.client.table.ClientTables; import org.apache.ignite.internal.client.tx.ClientTransactions; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.ClientMessage; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.manager.ComponentContext; @@ -93,9 +94,10 @@ public class TcpIgniteClient implements IgniteClient { * Constructor. * * @param cfg Config. + * @param observableTimeTracker Tracker of the latest time observed by client. */ - private TcpIgniteClient(IgniteClientConfiguration cfg) { - this(TcpClientChannel::createAsync, cfg); + private TcpIgniteClient(IgniteClientConfiguration cfg, HybridTimestampTracker observableTimeTracker) { + this(TcpClientChannel::createAsync, cfg, observableTimeTracker); } /** @@ -103,15 +105,16 @@ private TcpIgniteClient(IgniteClientConfiguration cfg) { * * @param chFactory Channel factory. * @param cfg Config. + * @param observableTimeTracker Tracker of the latest time observed by client. */ - private TcpIgniteClient(ClientChannelFactory chFactory, IgniteClientConfiguration cfg) { + private TcpIgniteClient(ClientChannelFactory chFactory, IgniteClientConfiguration cfg, HybridTimestampTracker observableTimeTracker) { assert chFactory != null; assert cfg != null; this.cfg = cfg; metrics = new ClientMetricSource(); - ch = new ReliableChannel(chFactory, cfg, metrics); + ch = new ReliableChannel(chFactory, cfg, metrics, observableTimeTracker); tables = new ClientTables(ch, marshallers); transactions = new ClientTransactions(ch); compute = new ClientCompute(ch, tables); @@ -154,11 +157,22 @@ private CompletableFuture initAsync() { * @return Future representing pending completion of the operation. */ public static CompletableFuture startAsync(IgniteClientConfiguration cfg) { + return startAsync(cfg, HybridTimestampTracker.atomicTracker(null)); + } + + /** + * Initializes new instance of {@link IgniteClient} and establishes the connection. + * + * @param cfg Thin client configuration. + * @param observableTimeTracker Tracker of the latest time observed by client. + * @return Future representing pending completion of the operation. + */ + public static CompletableFuture startAsync(IgniteClientConfiguration cfg, HybridTimestampTracker observableTimeTracker) { ErrorGroups.initialize(); try { //noinspection resource: returned from method - var client = new TcpIgniteClient(cfg); + var client = new TcpIgniteClient(cfg, observableTimeTracker); return client.initAsync().thenApply(x -> client); } catch (IgniteException e) { diff --git a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java index 85599cef503..3cdd0eba543 100644 --- a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java +++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java @@ -26,8 +26,8 @@ import org.apache.ignite.internal.catalog.sql.IgniteCatalogSqlImpl; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.QueryProcessor; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.impl.IgniteTransactionsImpl; import org.apache.ignite.network.ClusterNode; diff --git a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java index 6c5eef1132d..5e65bf88c66 100644 --- a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java +++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java @@ -23,6 +23,7 @@ import static org.apache.ignite.lang.ErrorGroups.Sql.STMT_VALIDATION_ERR; import java.util.concurrent.CompletableFuture; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.InternalSqlRow; @@ -30,7 +31,6 @@ import org.apache.ignite.internal.sql.engine.prepare.QueryMetadata; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.util.Commons; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.lang.CancellationToken; import org.apache.ignite.sql.SqlException; diff --git a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeTxManager.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeTxManager.java index 8cefbecb722..4717e3d870e 100644 --- a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeTxManager.java +++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeTxManager.java @@ -26,10 +26,10 @@ import java.util.function.Function; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.replicator.TablePartitionId; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.tx.LockManager; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/HybridTimestampTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/hlc/HybridTimestampTracker.java similarity index 97% rename from modules/transactions/src/main/java/org/apache/ignite/internal/tx/HybridTimestampTracker.java rename to modules/core/src/main/java/org/apache/ignite/internal/hlc/HybridTimestampTracker.java index ec994d78ab8..5a1e1792f65 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/HybridTimestampTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/hlc/HybridTimestampTracker.java @@ -15,14 +15,13 @@ * limitations under the License. */ -package org.apache.ignite.internal.tx; +package org.apache.ignite.internal.hlc; import static org.apache.ignite.internal.hlc.HybridTimestamp.hybridTimestampToLong; import static org.apache.ignite.internal.hlc.HybridTimestamp.nullableHybridTimestamp; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; -import org.apache.ignite.internal.hlc.HybridTimestamp; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java index 876bf1477c2..458d67a26cf 100644 --- a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java +++ b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java @@ -145,6 +145,7 @@ import org.apache.ignite.internal.hlc.ClockWaiter; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.index.IndexManager; import org.apache.ignite.internal.lang.ByteArray; import org.apache.ignite.internal.lang.IgniteInternalException; @@ -236,7 +237,6 @@ import org.apache.ignite.internal.testframework.WorkDirectory; import org.apache.ignite.internal.testframework.WorkDirectoryExtension; import org.apache.ignite.internal.thread.NamedThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.LockManager; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcMultipleConnectionsTest.java b/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcMultipleConnectionsTest.java new file mode 100644 index 00000000000..197246f37a7 --- /dev/null +++ b/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcMultipleConnectionsTest.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.jdbc; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +/** + * Multiple JDBC connections test. + */ +public class ItJdbcMultipleConnectionsTest extends AbstractJdbcSelfTest { + private static final String URL1 = "jdbc:ignite:thin://127.0.0.1:10800"; + private static final String URL2 = "jdbc:ignite:thin://127.0.0.1:10801"; + + @Override + protected int initialNodes() { + return 2; + } + + @AfterEach + public void dropTable() { + sql("DROP TABLE IF EXISTS T1"); + } + + @Test + public void testMultipleConnectionsSingleServer() throws SQLException { + try (Connection conn1 = DriverManager.getConnection(URL1)) { + try (Connection conn2 = DriverManager.getConnection(URL1)) { + checkUpdatesVisibility(conn1, conn2); + } + } + } + + @Test + public void testMultipleConnectionsMultipleServer() throws SQLException { + try (Connection conn1 = DriverManager.getConnection(URL1)) { + try (Connection conn2 = DriverManager.getConnection(URL2)) { + checkUpdatesVisibility(conn1, conn2); + } + } + } + + private static void checkUpdatesVisibility(Connection conn1, Connection conn2) throws SQLException { + try (Statement stmt1 = conn1.createStatement()) { + try (Statement stmt2 = conn2.createStatement()) { + stmt1.executeUpdate("CREATE TABLE T1(id INT PRIMARY KEY)"); + + int rowsCount = 100; + int i = 0; + + do { + assertThat(stmt1.executeUpdate("INSERT INTO T1 VALUES (" + i + ")"), is(1)); + + try (ResultSet rs = stmt2.executeQuery("SELECT count(*) FROM T1 WHERE id >= 0")) { + assertTrue(rs.next()); + assertThat("i=" + i, rs.getLong(1), is(i + 1L)); + } + } while (i++ < rowsCount); + } + } + } +} diff --git a/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java b/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java index 779942a7189..86bce833651 100644 --- a/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java +++ b/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java @@ -23,6 +23,7 @@ import static java.sql.ResultSet.TYPE_FORWARD_ONLY; import static org.apache.ignite.internal.jdbc.proto.SqlStateCode.CLIENT_CONNECTION_FAILED; import static org.apache.ignite.internal.jdbc.proto.SqlStateCode.CONNECTION_CLOSED; +import static org.apache.ignite.internal.util.ViewUtils.sync; import java.sql.Array; import java.sql.Blob; @@ -54,11 +55,13 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicLong; import org.apache.ignite.client.BasicAuthenticator; -import org.apache.ignite.client.IgniteClient; import org.apache.ignite.client.IgniteClientAuthenticator; +import org.apache.ignite.client.IgniteClientConfiguration; import org.apache.ignite.client.SslConfiguration; import org.apache.ignite.internal.client.HostAndPort; +import org.apache.ignite.internal.client.IgniteClientConfigurationImpl; import org.apache.ignite.internal.client.TcpIgniteClient; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.proto.IgniteQueryErrorCode; import org.apache.ignite.internal.jdbc.proto.JdbcQueryEventHandler; import org.apache.ignite.internal.jdbc.proto.SqlStateCode; @@ -126,8 +129,9 @@ public class JdbcConnection implements Connection { * Creates new connection. * * @param props Connection properties. + * @param observableTimeTracker Tracker of the latest time observed by client. */ - public JdbcConnection(ConnectionProperties props) throws SQLException { + public JdbcConnection(ConnectionProperties props, HybridTimestampTracker observableTimeTracker) throws SQLException { this.connProps = props; autoCommit = true; @@ -138,13 +142,7 @@ public JdbcConnection(ConnectionProperties props) throws SQLException { qryTimeout = connProps.getQueryTimeout(); try { - client = ((TcpIgniteClient) IgniteClient.builder() - .addresses(addrs) - .connectTimeout(netTimeout) - .ssl(extractSslConfiguration(connProps)) - .authenticator(extractAuthenticationConfiguration(connProps)) - .build()); - + client = buildClient(addrs, observableTimeTracker); } catch (Exception e) { throw new SQLException("Failed to connect to server", CLIENT_CONNECTION_FAILED, e); } @@ -174,6 +172,26 @@ public JdbcConnection(ConnectionProperties props) throws SQLException { holdability = HOLD_CURSORS_OVER_COMMIT; } + private TcpIgniteClient buildClient(String[] addrs, HybridTimestampTracker observableTimeTracker) { + var cfg = new IgniteClientConfigurationImpl( + null, + addrs, + netTimeout, + IgniteClientConfigurationImpl.DFLT_BACKGROUND_RECONNECT_INTERVAL, + null, + IgniteClientConfigurationImpl.DFLT_HEARTBEAT_INTERVAL, + IgniteClientConfigurationImpl.DFLT_HEARTBEAT_TIMEOUT, + null, + null, + extractSslConfiguration(connProps), + false, + extractAuthenticationConfiguration(connProps), + IgniteClientConfiguration.DFLT_OPERATION_TIMEOUT + ); + + return (TcpIgniteClient) sync(TcpIgniteClient.startAsync(cfg, observableTimeTracker)); + } + /** * Constructor used for testing purposes. */ @@ -848,6 +866,11 @@ long connectionId() { return connectionId; } + /** Returns the latest time observed by client. */ + long observableTimestamp() { + return client.channel().observableTimestamp(); + } + /** {@inheritDoc} */ @Override public T unwrap(Class iface) throws SQLException { diff --git a/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java b/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java index 48270bc32cb..e5b2507a58a 100644 --- a/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java +++ b/modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java @@ -143,9 +143,10 @@ void execute0(JdbcStatementType stmtType, String sql, boolean multiStatement, Ob long correlationToken = nextToken(); JdbcQueryExecuteRequest req = new JdbcQueryExecuteRequest(stmtType, schema, pageSize, maxRows, sql, args, - conn.getAutoCommit(), multiStatement, queryTimeoutMillis, correlationToken); + conn.getAutoCommit(), multiStatement, queryTimeoutMillis, correlationToken, conn.observableTimestamp()); JdbcQueryExecuteResponse res; + try { res = (JdbcQueryExecuteResponse) conn.handler().queryAsync(conn.connectionId(), req).get(); } catch (InterruptedException e) { diff --git a/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java b/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java index fd935978f39..95ff8859902 100644 --- a/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java +++ b/modules/jdbc/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java @@ -29,6 +29,7 @@ import java.util.Properties; import java.util.logging.Logger; import org.apache.ignite.internal.client.proto.ProtocolVersion; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.jdbc.ConnectionPropertiesImpl; import org.apache.ignite.internal.jdbc.JdbcConnection; @@ -161,6 +162,15 @@ public class IgniteJdbcDriver implements Driver { /** Minor version. */ private static final int MINOR_VER = ProtocolVersion.LATEST_VER.minor(); + /** + * Tracker of the latest time observed by client. + * + *

All connections created by this driver use the same tracker. + * This is done so that read-only transactions from different connections can observe changes made in other connections, + * which in turn ensures visibility of changes when working through the jdbc connection pool. + */ + private final HybridTimestampTracker observableTimeTracker = HybridTimestampTracker.atomicTracker(null); + /** {@inheritDoc} */ @Override public Connection connect(String url, Properties props) throws SQLException { @@ -172,12 +182,12 @@ public Connection connect(String url, Properties props) throws SQLException { connProps.init(url, props); - return new JdbcConnection(connProps); + return new JdbcConnection(connProps, observableTimeTracker); } /** {@inheritDoc} */ @Override - public boolean acceptsURL(String url) throws SQLException { + public boolean acceptsURL(String url) { return url.startsWith(URL_PREFIX); } diff --git a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java index e6226b1a9f5..febb8eddccf 100644 --- a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java +++ b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java @@ -121,6 +121,7 @@ import org.apache.ignite.internal.hlc.ClockWaiter; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.index.IndexManager; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.lang.NodeStoppingException; @@ -199,7 +200,6 @@ import org.apache.ignite.internal.testframework.WorkDirectory; import org.apache.ignite.internal.testframework.WorkDirectoryExtension; import org.apache.ignite.internal.thread.NamedThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.LockManager; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java index 2ccb23aa715..aa68d01666e 100644 --- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java +++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java @@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.stream.IntStream; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteStringBuilder; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.InternalSqlRow; @@ -37,7 +38,6 @@ import org.apache.ignite.internal.sql.engine.SqlQueryType; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.util.AsyncCursor.BatchedResult; import org.apache.ignite.table.Tuple; import org.openjdk.jmh.annotations.Benchmark; diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java index c21aa163229..b07e7acdc30 100644 --- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java +++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java @@ -133,6 +133,7 @@ import org.apache.ignite.internal.hlc.ClockWaiter; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.index.IndexManager; import org.apache.ignite.internal.lang.ByteArray; import org.apache.ignite.internal.lang.IgniteInternalException; @@ -218,7 +219,6 @@ import org.apache.ignite.internal.testframework.InjectExecutorService; import org.apache.ignite.internal.testframework.TestIgnitionManager; import org.apache.ignite.internal.thread.NamedThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.tx.configuration.TransactionExtensionConfiguration; import org.apache.ignite.internal.tx.impl.HeapLockManager; diff --git a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java index af977195ef7..338fd5dae42 100644 --- a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java +++ b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java @@ -143,6 +143,7 @@ import org.apache.ignite.internal.hlc.ClockWaiter; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.index.IndexBuildingManager; import org.apache.ignite.internal.index.IndexManager; import org.apache.ignite.internal.index.IndexNodeFinishedRwTransactionsChecker; @@ -256,7 +257,6 @@ import org.apache.ignite.internal.thread.IgniteThreadFactory; import org.apache.ignite.internal.thread.NamedThreadFactory; import org.apache.ignite.internal.threading.PublicApiThreadingIgniteCatalog; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.LockManager; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCancelQueryTest.java b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCancelQueryTest.java index 422a0061874..0825e51df2f 100644 --- a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCancelQueryTest.java +++ b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCancelQueryTest.java @@ -28,10 +28,10 @@ import java.util.concurrent.CompletableFuture; import org.apache.ignite.internal.TestWrappers; import org.apache.ignite.internal.app.IgniteImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.BaseSqlIntegrationTest; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.lang.CancelHandle; import org.apache.ignite.lang.CancellationToken; import org.junit.jupiter.api.Test; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/IgniteSqlImpl.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/IgniteSqlImpl.java index 09015bbac61..9ceee53d5ef 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/IgniteSqlImpl.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/IgniteSqlImpl.java @@ -40,6 +40,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.logger.IgniteLogger; import org.apache.ignite.internal.logger.Loggers; @@ -56,7 +57,6 @@ import org.apache.ignite.internal.sql.engine.SqlQueryType; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.util.ArrayUtils; import org.apache.ignite.internal.util.AsyncCursor; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/QueryProcessor.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/QueryProcessor.java index 68b30ec977c..e42438d0a47 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/QueryProcessor.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/QueryProcessor.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.sql.engine; import java.util.concurrent.CompletableFuture; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.IgniteComponent; import org.apache.ignite.internal.sql.engine.prepare.QueryMetadata; import org.apache.ignite.internal.sql.engine.property.SqlProperties; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.lang.CancellationToken; import org.apache.ignite.lang.IgniteException; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java index d14ae829fcf..2de644d95ec 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java @@ -42,6 +42,7 @@ import org.apache.ignite.internal.failure.FailureManager; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.lang.NodeStoppingException; import org.apache.ignite.internal.lowwatermark.LowWatermark; @@ -103,7 +104,6 @@ import org.apache.ignite.internal.systemview.api.SystemViewManager; import org.apache.ignite.internal.systemview.api.SystemViewProvider; import org.apache.ignite.internal.table.distributed.TableManager; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.impl.TransactionInflights; diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionContextImpl.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionContextImpl.java index ee5275787ee..0997c1682eb 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionContextImpl.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionContextImpl.java @@ -21,8 +21,8 @@ import static org.apache.ignite.lang.ErrorGroups.Transactions.TX_ALREADY_FINISHED_ERR; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.exec.TransactionTracker; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.tx.TxManager; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/IgniteSqlImplTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/IgniteSqlImplTest.java index 3d7dc79a64b..b76416eb54e 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/IgniteSqlImplTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/api/IgniteSqlImplTest.java @@ -48,6 +48,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.InternalSqlRow; @@ -55,7 +56,6 @@ import org.apache.ignite.internal.sql.engine.SqlQueryType; import org.apache.ignite.internal.sql.engine.util.ListToInternalSqlRowAdapter; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.util.AsyncCursor.BatchedResult; import org.apache.ignite.sql.BatchedArguments; import org.apache.ignite.sql.SqlException; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/QueryTransactionWrapperSelfTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/QueryTransactionWrapperSelfTest.java index 394241d9d74..b32dcafdcff 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/QueryTransactionWrapperSelfTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/QueryTransactionWrapperSelfTest.java @@ -33,6 +33,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.exec.TransactionTracker; import org.apache.ignite.internal.sql.engine.framework.NoOpTransaction; import org.apache.ignite.internal.sql.engine.sql.IgniteSqlCommitTransaction; @@ -44,7 +45,6 @@ import org.apache.ignite.internal.sql.engine.tx.QueryTransactionWrapperImpl; import org.apache.ignite.internal.sql.engine.tx.ScriptTransactionContext; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.lang.ErrorGroups.Sql; import org.junit.jupiter.api.Test; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/QueryRecoveryTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/QueryRecoveryTest.java index 298bbb627bd..4f9212b827b 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/QueryRecoveryTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/QueryRecoveryTest.java @@ -31,6 +31,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.replicator.exception.PrimaryReplicaMissException; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; @@ -52,7 +53,6 @@ import org.apache.ignite.internal.sql.engine.util.QueryCheckerExtension; import org.apache.ignite.internal.sql.engine.util.QueryCheckerFactory; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.LockException; import org.apache.ignite.lang.CancellationToken; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/TransactionEnlistTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/TransactionEnlistTest.java index 316ed18a113..2e0059c8e73 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/TransactionEnlistTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/TransactionEnlistTest.java @@ -25,6 +25,7 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import java.util.stream.IntStream; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.InternalSqlRow; @@ -42,7 +43,6 @@ import org.apache.ignite.internal.sql.engine.util.QueryCheckerExtension; import org.apache.ignite.internal.sql.engine.util.QueryCheckerFactory; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.lang.CancellationToken; import org.jetbrains.annotations.Nullable; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/TableScanNodeExecutionTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/TableScanNodeExecutionTest.java index c7b780f271b..333c6dadf1c 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/TableScanNodeExecutionTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/TableScanNodeExecutionTest.java @@ -47,6 +47,7 @@ import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.lowwatermark.TestLowWatermark; import org.apache.ignite.internal.manager.ComponentContext; @@ -78,7 +79,6 @@ import org.apache.ignite.internal.table.distributed.storage.InternalTableImpl; import org.apache.ignite.internal.testframework.ExecutorServiceExtension; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.tx.impl.HeapLockManager; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ExplicitTxContext.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ExplicitTxContext.java index ffe854a8a11..0be8d472131 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ExplicitTxContext.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ExplicitTxContext.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.sql.engine.framework; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.tx.QueryTransactionContext; import org.apache.ignite.internal.sql.engine.tx.QueryTransactionWrapper; import org.apache.ignite.internal.sql.engine.tx.QueryTransactionWrapperImpl; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.jetbrains.annotations.Nullable; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ImplicitTxContext.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ImplicitTxContext.java index b6fb4e606dd..acd3eaee3a0 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ImplicitTxContext.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ImplicitTxContext.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.sql.engine.framework; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.tx.QueryTransactionContext; import org.apache.ignite.internal.sql.engine.tx.QueryTransactionWrapper; import org.apache.ignite.internal.sql.engine.tx.QueryTransactionWrapperImpl; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.jetbrains.annotations.Nullable; /** Context that always creates implicit transaction. */ diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/JoinRowCountEstimationTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/JoinRowCountEstimationTest.java index ae9ab7153b1..d01109acaa7 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/JoinRowCountEstimationTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/JoinRowCountEstimationTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import java.util.stream.IntStream; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.InternalSqlRow; @@ -43,7 +44,6 @@ import org.apache.ignite.internal.sql.engine.util.TpcTable; import org.apache.ignite.internal.sql.engine.util.tpcds.TpcdsTables; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.lang.CancellationToken; import org.hamcrest.BaseMatcher; diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerTest.java index f9a328a3f92..526a21138f3 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import java.util.stream.IntStream; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.InternalSqlRow; @@ -39,7 +40,6 @@ import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; import org.apache.ignite.internal.testframework.WithSystemProperty; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.lang.CancellationToken; import org.apache.ignite.sql.ColumnMetadata; diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/BaseSqlIntegrationTest.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/BaseSqlIntegrationTest.java index 36ce4641916..17a3a378ae2 100644 --- a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/BaseSqlIntegrationTest.java +++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/BaseSqlIntegrationTest.java @@ -32,6 +32,7 @@ import org.apache.ignite.Ignite; import org.apache.ignite.internal.ClusterPerClassIntegrationTest; import org.apache.ignite.internal.app.IgniteImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.AsyncSqlCursor; import org.apache.ignite.internal.sql.engine.SqlQueryProcessor; import org.apache.ignite.internal.sql.engine.statistic.SqlStatisticManagerImpl; @@ -41,7 +42,6 @@ import org.apache.ignite.internal.sql.engine.util.QueryCheckerFactory; import org.apache.ignite.internal.sql.engine.util.SqlTestUtils; import org.apache.ignite.internal.systemview.SystemViewManagerImpl; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.util.AsyncCursor.BatchedResult; diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactory.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactory.java index 410aeee902a..a7516d02d50 100644 --- a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactory.java +++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactory.java @@ -18,9 +18,9 @@ package org.apache.ignite.internal.sql.engine.util; import java.util.function.Consumer; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.QueryProcessor; import org.apache.ignite.internal.sql.engine.util.QueryChecker.QueryTemplate; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.sql.ResultSetMetadata; import org.jetbrains.annotations.Nullable; diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactoryImpl.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactoryImpl.java index 5247ada91dc..abd54abc82b 100644 --- a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactoryImpl.java +++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerFactoryImpl.java @@ -18,9 +18,9 @@ package org.apache.ignite.internal.sql.engine.util; import java.util.function.Consumer; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.sql.engine.QueryProcessor; import org.apache.ignite.internal.sql.engine.util.QueryChecker.QueryTemplate; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.sql.ResultSetMetadata; import org.jetbrains.annotations.Nullable; diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerImpl.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerImpl.java index 2c7ec723e25..e9c6cc2f6cf 100644 --- a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerImpl.java +++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/QueryCheckerImpl.java @@ -43,6 +43,7 @@ import java.util.concurrent.CompletableFuture; import java.util.regex.Pattern; import java.util.stream.Collectors; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.logger.IgniteLogger; import org.apache.ignite.internal.logger.Loggers; import org.apache.ignite.internal.sql.SqlCommon; @@ -56,7 +57,6 @@ import org.apache.ignite.internal.sql.engine.prepare.QueryMetadata; import org.apache.ignite.internal.sql.engine.property.SqlProperties; import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.util.ArrayUtils; import org.apache.ignite.internal.util.CollectionUtils; diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadOnlyScanTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadOnlyScanTest.java index 1e33ce0e110..7282acd15d4 100644 --- a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadOnlyScanTest.java +++ b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadOnlyScanTest.java @@ -22,9 +22,9 @@ import static org.mockito.Mockito.mock; import java.util.concurrent.Flow.Publisher; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.schema.BinaryRow; import org.apache.ignite.internal.table.InternalTable; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.network.ClusterNode; diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java index 13c3c221603..95435955d03 100644 --- a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java +++ b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java @@ -20,12 +20,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.concurrent.Flow.Publisher; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.replicator.TablePartitionId; import org.apache.ignite.internal.schema.BinaryRow; import org.apache.ignite.internal.table.InternalTable; import org.apache.ignite.internal.table.RollbackTxOnErrorPublisher; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.utils.PrimaryReplica; diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItLockTableTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItLockTableTest.java index f2c2331c7fb..335db346817 100644 --- a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItLockTableTest.java +++ b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItLockTableTest.java @@ -28,6 +28,7 @@ import org.apache.ignite.internal.configuration.testframework.ConfigurationExtension; import org.apache.ignite.internal.configuration.testframework.InjectConfiguration; import org.apache.ignite.internal.hlc.ClockService; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.logger.IgniteLogger; import org.apache.ignite.internal.logger.Loggers; import org.apache.ignite.internal.lowwatermark.LowWatermark; @@ -43,7 +44,6 @@ import org.apache.ignite.internal.testframework.ExecutorServiceExtension; import org.apache.ignite.internal.testframework.IgniteAbstractTest; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.tx.impl.HeapLockManager; import org.apache.ignite.internal.tx.impl.HeapLockManager.LockState; diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxStateLocalMapTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxStateLocalMapTest.java index 2b6ad33a8cf..507622bdef4 100644 --- a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxStateLocalMapTest.java +++ b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxStateLocalMapTest.java @@ -32,6 +32,7 @@ import org.apache.ignite.internal.configuration.testframework.ConfigurationExtension; import org.apache.ignite.internal.configuration.testframework.InjectConfiguration; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.raft.configuration.RaftConfiguration; import org.apache.ignite.internal.replicator.configuration.ReplicationConfiguration; import org.apache.ignite.internal.schema.Column; @@ -39,7 +40,6 @@ import org.apache.ignite.internal.schema.configuration.StorageUpdateConfiguration; import org.apache.ignite.internal.table.TableViewInternal; import org.apache.ignite.internal.testframework.IgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxStateMeta; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.tx.impl.ReadWriteTransactionImpl; diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java index f6fcefd9e79..9af75ad1df4 100644 --- a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java +++ b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java @@ -60,6 +60,7 @@ import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.lowwatermark.TestLowWatermark; @@ -103,7 +104,6 @@ import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; import org.apache.ignite.internal.testframework.ExecutorServiceExtension; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.LockManager; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java index de0c16a1e67..89aaff499f0 100644 --- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java +++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java @@ -122,6 +122,7 @@ import org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.ByteArray; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.lang.IgniteStringFormatter; @@ -215,7 +216,6 @@ import org.apache.ignite.internal.table.distributed.storage.PartitionStorages; import org.apache.ignite.internal.table.distributed.wrappers.ExecutorInclinedPlacementDriver; import org.apache.ignite.internal.thread.IgniteThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.LockManager; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java index ccd52a52a3c..aaca0add491 100644 --- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java +++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java @@ -97,6 +97,7 @@ import org.apache.ignite.internal.event.EventListener; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.lang.IgniteSystemProperties; @@ -188,7 +189,6 @@ import org.apache.ignite.internal.table.distributed.index.MetaIndexStatusChange; import org.apache.ignite.internal.table.distributed.raft.UnexpectedTransactionStateException; import org.apache.ignite.internal.table.distributed.schema.ValidationSchemasSource; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.IncompatibleSchemaAbortException; import org.apache.ignite.internal.tx.Lock; import org.apache.ignite.internal.tx.LockKey; diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java index e7dc54e8008..b791d0925b8 100644 --- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java +++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java @@ -81,6 +81,7 @@ import org.apache.ignite.internal.binarytuple.BinaryTupleReader; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.lang.IgnitePentaFunction; import org.apache.ignite.internal.lang.IgniteTriFunction; @@ -119,7 +120,6 @@ import org.apache.ignite.internal.table.InternalTable; import org.apache.ignite.internal.table.StreamerReceiverRunner; import org.apache.ignite.internal.table.distributed.storage.PartitionScanPublisher.InflightBatchRequestTracker; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.TransactionIds; import org.apache.ignite.internal.tx.TxManager; diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java index c5045d5762f..aa086e9c8fc 100644 --- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java +++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java @@ -78,6 +78,7 @@ import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.lowwatermark.TestLowWatermark; import org.apache.ignite.internal.manager.ComponentContext; @@ -124,7 +125,6 @@ import org.apache.ignite.internal.testframework.ExecutorServiceExtension; import org.apache.ignite.internal.testframework.IgniteAbstractTest; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.tx.impl.RemotelyTriggeredResourceRegistry; diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java index 7f692452ca9..de95929f5ea 100644 --- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java +++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java @@ -91,6 +91,7 @@ import org.apache.ignite.internal.failure.FailureManager; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.lang.NodeStoppingException; @@ -136,7 +137,6 @@ import org.apache.ignite.internal.testframework.ExecutorServiceExtension; import org.apache.ignite.internal.testframework.IgniteAbstractTest; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.tx.impl.RemotelyTriggeredResourceRegistry; diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableEstimatedSizeTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableEstimatedSizeTest.java index a893f751511..0910d29ef69 100644 --- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableEstimatedSizeTest.java +++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableEstimatedSizeTest.java @@ -60,6 +60,7 @@ import org.apache.ignite.internal.hlc.ClockWaiter; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lowwatermark.TestLowWatermark; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.manager.IgniteComponent; @@ -92,7 +93,6 @@ import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; import org.apache.ignite.internal.testframework.ExecutorServiceExtension; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.LockManager; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.impl.RemotelyTriggeredResourceRegistry; diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java index f1cce5eebc5..ab1faf498d1 100644 --- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java +++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java @@ -37,6 +37,7 @@ import java.util.List; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.network.SingleClusterNodeResolver; import org.apache.ignite.internal.placementdriver.PlacementDriver; import org.apache.ignite.internal.replicator.ReplicaService; @@ -45,7 +46,6 @@ import org.apache.ignite.internal.storage.engine.MvTableStorage; import org.apache.ignite.internal.table.StreamerReceiverRunner; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.impl.TransactionInflights; import org.apache.ignite.internal.tx.storage.state.TxStateTableStorage; diff --git a/modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java b/modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java index 49ab15b1577..529f803f7cd 100644 --- a/modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java +++ b/modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java @@ -80,6 +80,7 @@ import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.lang.NodeStoppingException; import org.apache.ignite.internal.logger.IgniteLogger; @@ -153,7 +154,6 @@ import org.apache.ignite.internal.table.impl.DummySchemaManagerImpl; import org.apache.ignite.internal.table.impl.DummyValidationSchemasSource; import org.apache.ignite.internal.thread.NamedThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.TxStateMeta; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxInfrastructureTest.java b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxInfrastructureTest.java index 106c798e9eb..71c3844d269 100644 --- a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxInfrastructureTest.java +++ b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxInfrastructureTest.java @@ -31,6 +31,7 @@ import org.apache.ignite.internal.configuration.testframework.InjectConfiguration; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.manager.ComponentContext; import org.apache.ignite.internal.network.ClusterService; import org.apache.ignite.internal.network.NodeFinder; @@ -54,7 +55,6 @@ import org.apache.ignite.internal.testframework.IgniteAbstractTest; import org.apache.ignite.internal.testframework.IgniteTestUtils; import org.apache.ignite.internal.testframework.InjectExecutorService; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; import org.apache.ignite.internal.type.NativeTypes; diff --git a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java index 775480661c5..cb498f9629d 100644 --- a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java +++ b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java @@ -49,6 +49,7 @@ import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.logger.IgniteLogger; import org.apache.ignite.internal.logger.Loggers; @@ -109,7 +110,6 @@ import org.apache.ignite.internal.table.distributed.schema.AlwaysSyncedSchemaSyncService; import org.apache.ignite.internal.table.distributed.storage.InternalTableImpl; import org.apache.ignite.internal.thread.NamedThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.configuration.TransactionConfiguration; diff --git a/modules/transactions/src/integrationTest/java/org/apache/ignite/tx/distributed/ItTransactionRecoveryTest.java b/modules/transactions/src/integrationTest/java/org/apache/ignite/tx/distributed/ItTransactionRecoveryTest.java index 7c54263b767..9acd5dad05d 100644 --- a/modules/transactions/src/integrationTest/java/org/apache/ignite/tx/distributed/ItTransactionRecoveryTest.java +++ b/modules/transactions/src/integrationTest/java/org/apache/ignite/tx/distributed/ItTransactionRecoveryTest.java @@ -62,6 +62,7 @@ import org.apache.ignite.internal.ClusterPerTestIntegrationTest; import org.apache.ignite.internal.TestWrappers; import org.apache.ignite.internal.app.IgniteImpl; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.network.ClusterService; import org.apache.ignite.internal.network.DefaultMessagingService; @@ -81,7 +82,6 @@ import org.apache.ignite.internal.testframework.SystemPropertiesExtension; import org.apache.ignite.internal.testframework.WithSystemProperty; import org.apache.ignite.internal.testframework.flow.TestFlowUtils; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.Lock; import org.apache.ignite.internal.tx.LockManager; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java index 3cfa0d89eb6..fd5afce206a 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java @@ -23,6 +23,7 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Function; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.manager.IgniteComponent; import org.apache.ignite.internal.replicator.TablePartitionId; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteAbstractTransactionImpl.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteAbstractTransactionImpl.java index b2dcbe58c89..350fd049d6b 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteAbstractTransactionImpl.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteAbstractTransactionImpl.java @@ -26,7 +26,7 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; -import org.apache.ignite.internal.tx.HybridTimestampTracker; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.TxState; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteTransactionsImpl.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteTransactionsImpl.java index f29a5993009..571a0c089f6 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteTransactionsImpl.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/IgniteTransactionsImpl.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.tx.impl; import java.util.concurrent.CompletableFuture; -import org.apache.ignite.internal.tx.HybridTimestampTracker; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.tx.TxManager; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImpl.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImpl.java index 4601b2a92b1..6a6e96ef8fc 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImpl.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImpl.java @@ -25,9 +25,9 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.replicator.TablePartitionId; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.network.ClusterNode; /** diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImpl.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImpl.java index 5c0dc9b7267..757af846ca8 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImpl.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImpl.java @@ -30,9 +30,9 @@ import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.replicator.TablePartitionId; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TransactionIds; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.network.ClusterNode; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxManagerImpl.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxManagerImpl.java index 54ba6d4804b..670c6f8856e 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxManagerImpl.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxManagerImpl.java @@ -64,6 +64,7 @@ import org.apache.ignite.internal.event.EventListener; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.lang.IgniteInternalException; import org.apache.ignite.internal.logger.IgniteLogger; @@ -89,7 +90,6 @@ import org.apache.ignite.internal.systemview.api.SystemView; import org.apache.ignite.internal.systemview.api.SystemViewProvider; import org.apache.ignite.internal.thread.IgniteThreadFactory; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.InternalTransaction; import org.apache.ignite.internal.tx.InternalTxOptions; import org.apache.ignite.internal.tx.LocalRwTxCounter; diff --git a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java index e3b17c18dbc..2cc40815b31 100644 --- a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java +++ b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java @@ -66,6 +66,7 @@ import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.hlc.TestClockService; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.lang.IgniteInternalException; diff --git a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImplTest.java b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImplTest.java index 777cf0596bb..0a73722a197 100644 --- a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImplTest.java +++ b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadOnlyTransactionImplTest.java @@ -24,8 +24,8 @@ import java.util.concurrent.CompletableFuture; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.test.TestTransactionIds; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java index 0cfc3f09157..85d23a4a262 100644 --- a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java +++ b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java @@ -34,11 +34,11 @@ import org.apache.ignite.internal.hlc.HybridClock; import org.apache.ignite.internal.hlc.HybridClockImpl; import org.apache.ignite.internal.hlc.HybridTimestamp; +import org.apache.ignite.internal.hlc.HybridTimestampTracker; import org.apache.ignite.internal.lang.IgniteBiTuple; import org.apache.ignite.internal.network.ClusterNodeImpl; import org.apache.ignite.internal.replicator.TablePartitionId; import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest; -import org.apache.ignite.internal.tx.HybridTimestampTracker; import org.apache.ignite.internal.tx.TxManager; import org.apache.ignite.internal.tx.TxState; import org.apache.ignite.internal.tx.TxStateMeta;