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-23305 Get rid of client HybridTimestampTracker #4929

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

Conversation

vldpyatkov
Copy link
Contributor

@vldpyatkov vldpyatkov requested a review from xtern December 20, 2024 10:55
}

return clockService.currentLong();
return HybridTimestamp.MIN_VALUE.longValue();
Copy link
Contributor

@xtern xtern Dec 23, 2024

Choose a reason for hiding this comment

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

I suggest to rework a bit this method to see the code branching more clearly.

private long observableTimestamp(@Nullable ClientMessagePacker out) {
        // Certain operations can override the timestamp and provide it in the meta object.
        if (out == null) {
            return clockService.currentLong();
        }

        Object meta = out.meta();

        if (meta instanceof HybridTimestamp) {
            return ((HybridTimestamp) meta).longValue();
        }

        return HybridTimestamp.MIN_VALUE.longValue();
    }

@xtern xtern requested a review from korlov42 December 23, 2024 09:39
public IgniteAbstractTransactionImpl(TxManager txManager, UUID id, UUID coordinatorId, boolean implicit) {
public IgniteAbstractTransactionImpl(
TxManager txManager,
ObservableTimestampProvider observableTsTracker,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's update javadoc

/**
* Interface is used to provide an observable timestamp into a transaction operation.
*/
public interface ObservableTimestampProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's better to name it HybridTimestampTracker and rename implementation to HybridTimestampTrackerImpl so w will avoid hundreds of meaningless changes. Besides, I believe HybridTimestampTracker is better fit for such interface

* @return Future representing result of operation.
*/
public static CompletableFuture<Void> process(
ClientMessageUnpacker in,
ClientMessagePacker out,
ClientResourceRegistry resources,
IgniteTransactionsImpl transactions
ClientResourceRegistry resources
) throws IgniteInternalCheckedException {
long resourceId = in.unpackLong();

ClientSqlResultSet asyncResultSet = resources.remove(resourceId).get(ClientSqlResultSet.class);

return asyncResultSet.closeAsync()
.thenApply(ignored -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove thenApply entirely

* Observation timestamp tracker.
* TODO: IGNITE-24053 Remove this after the issue will be fixed.
* */
private final HybridTimestampTracker timestampTracker = new HybridTimestampTracker();
Copy link
Contributor

Choose a reason for hiding this comment

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

I've checked the mentioned JIRA, and it doesn't seem correct. At the moment, JDBC driver doesn't track time on client's side, and driver cannot connect to more than one server. During connection, server issues connectionId for every java.sql.Connection instance, and every request from the connection provides connectionId.

Given that said, we need to create one tracker per JdbcConnectionContext and use it for every request within this connection. Changes in JDBC-related requests processing methods are not necessary since driver doesn't track observable time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why does the JDBC driver cannot track an observation timestamp?

Copy link
Contributor

Choose a reason for hiding this comment

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

because it doesn't need to. There is no support for multi-node connections yet (simultaneous connections to several servers within the same cluster), so why should we bother?

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.

3 participants