You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ascherbakoff (via GitHub)" <gi...@apache.org> on 2024/04/23 09:27:37 UTC
Re: [PR] IGNITE-19681 Java thin: Add tx partition awareness (lazy tx start) [ignite-3]
ascherbakoff commented on code in PR #3640:
URL: https://github.com/apache/ignite-3/pull/3640#discussion_r1575943518
##########
modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTable.java:
##########
@@ -419,15 +435,21 @@ private <T> CompletableFuture<T> doSchemaOutInOpAsync(
CompletableFuture.allOf(schemaFut, partitionsFut)
.thenCompose(v -> {
ClientSchema schema = schemaFut.getNow(null);
- String preferredNodeName = getPreferredNodeName(provider, partitionsFut.getNow(null), schema);
-
- // Perform the operation.
- return ch.serviceAsync(opCode,
- w -> writer.accept(schema, w),
- r -> readSchemaAndReadData(schema, r, reader, defaultValue, responseSchemaRequired),
- preferredNodeName,
- retryPolicyOverride,
- expectNotifications);
+ String txPreferredNodeName = getPreferredNodeName(provider, partitionsFut.getNow(null), schema);
+
+ return ClientLazyTransaction.ensureStarted(tx, ch, txPreferredNodeName).thenCompose(unused -> {
Review Comment:
This can be optimized even further.
Currently we still have +1RTT to begin tx request/response here, which may be sensitive to small transactions.
A transaction should be started on first map request.
For this to work logical client tx id should be assigned on client.
For example, id can consist of local client counter combined with client unique id assigned by server on handshake.
One bit of 64 bit id is reserved for "first" flag.
If an operation is "first", the txn is implicitly started.
I'm ok to do it in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org