Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-24053 Jdbc. Use single observable time tracker for multiple JDBC connections #5069

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

xtern
Copy link
Contributor

@xtern xtern commented Jan 17, 2025

https://issues.apache.org/jira/browse/IGNITE-24053

  • HybridTimestampTracker moved to core module so that it can be used by client.
  • Observable time tracker added to IgniteJdbcDriver. Single instance of tracker is used for all connections created using driver.
  • JdbcQueryExecuteRequest now passes this time to the server in the observableTime field.
  • In order to send the updated timestamp back in the response meta after processing the request, an intermediate class JdbcObservableTimeAwareRequest with a time tracker was added.

Time is transferred from client to server only when executing queryAsync(..) method.

Time is transferred from the server to the client when executing the following methods:

  • queryAsync(..)
  • batchAsync(..)
  • batchPrepStatementAsync(..)
  • finishTxAsync(..)

@xtern xtern force-pushed the ignite-24053 branch 5 times, most recently from 07a0f0c to 5b32958 Compare January 20, 2025 15:11
@xtern xtern marked this pull request as ready for review January 20, 2025 15:11
@xtern xtern changed the title IGNITE-24053 IGNITE-24053 Jdbc. Use single obserable time tracker for multiple JDBC connections Jan 20, 2025
@xtern xtern requested a review from korlov42 January 21, 2025 06:27
@xtern xtern force-pushed the ignite-24053 branch 2 times, most recently from bb8a386 to 4af7a93 Compare January 21, 2025 12:11
/**
* JDBC connection context.
*/
class JdbcConnectionContext {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this class is simply moved to the top level

/** {@link SqlQueryType}s allowed in JDBC select statements. **/
public static final Set<SqlQueryType> SELECT_STATEMENT_QUERIES = Set.of(
SqlQueryType.QUERY,
SqlQueryType.EXPLAIN
);

/** {@link SqlQueryType}s allowed in JDBC update statements. **/
public static final Set<SqlQueryType> UPDATE_STATEMENT_QUERIES = Set.of(DML, DDL, KILL);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was not used

@xtern xtern changed the title IGNITE-24053 Jdbc. Use single obserable time tracker for multiple JDBC connections IGNITE-24053 Jdbc. Use single observable time tracker for multiple JDBC connections Jan 21, 2025
@xtern xtern requested a review from vldpyatkov January 21, 2025 13:00
*
* @return observable timestamp, or {@code null} if the observable time has not yet been initialized/updated.
*/
@Nullable HybridTimestamp observableTimestamp();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to save tracker in JdbcConnectionContext along with created transaction instead of adding a new method to InternalTransaction

@@ -161,6 +162,9 @@ 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. */
private final HybridTimestampTracker observableTimeTracker = HybridTimestampTracker.atomicTracker(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to throw a few lines describing rationale behind having a single tracker per driver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants