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 due 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]