sanpwc commented on code in PR #7105:
URL: https://github.com/apache/ignite-3/pull/7105#discussion_r2571596657
##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java:
##########
@@ -457,29 +494,41 @@ public static TableNotFoundException
tableIdNotFoundException(Integer tableId) {
// Attach resource id only on first direct request.
resourceIdHolder[0] = resources.put(new ClientResource(tx,
tx::rollbackAsync));
- return tx;
+ return completedFuture(tx);
} else if (id == TX_ID_DIRECT) {
+ assert txManager != null : "Transaction manager must be
specified to process directly mapped requests.";
+ assert tables != null : "Tables manager must be specified to
process directly mapped requests.";
+
// This is direct request mapping.
long token = in.unpackLong();
UUID txId = in.unpackUuid();
+
+ // TODO https://issues.apache.org/jira/browse/IGNITE-25017
+ // partition awareness feature should be reworked to use zone
ids.
int commitTableId = in.unpackInt();
int commitPart = in.unpackInt();
+
UUID coord = in.unpackUuid();
long timeout = in.unpackLong();
- InternalTransaction remote = txManager.beginRemote(txId, new
TablePartitionId(commitTableId, commitPart),
- coord, token, timeout, err -> {
- // Will be called for write txns.
- notificationSender.sendNotification(w ->
w.packUuid(txId), err, NULL_HYBRID_TIMESTAMP);
+ return readTableAsync(commitTableId, tables)
+ .thenApply(table -> {
+ InternalTransaction remote =
txManager.beginRemote(txId, new ZonePartitionId(table.zoneId(), commitPart),
+ coord, token, timeout, err -> {
+ if (notificationSender != null) {
Review Comment:
What if notificationSender is null?
##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java:
##########
@@ -457,29 +494,41 @@ public static TableNotFoundException
tableIdNotFoundException(Integer tableId) {
// Attach resource id only on first direct request.
resourceIdHolder[0] = resources.put(new ClientResource(tx,
tx::rollbackAsync));
- return tx;
+ return completedFuture(tx);
} else if (id == TX_ID_DIRECT) {
+ assert txManager != null : "Transaction manager must be
specified to process directly mapped requests.";
+ assert tables != null : "Tables manager must be specified to
process directly mapped requests.";
+
// This is direct request mapping.
long token = in.unpackLong();
UUID txId = in.unpackUuid();
+
+ // TODO https://issues.apache.org/jira/browse/IGNITE-25017
+ // partition awareness feature should be reworked to use zone
ids.
int commitTableId = in.unpackInt();
int commitPart = in.unpackInt();
+
UUID coord = in.unpackUuid();
long timeout = in.unpackLong();
- InternalTransaction remote = txManager.beginRemote(txId, new
TablePartitionId(commitTableId, commitPart),
- coord, token, timeout, err -> {
- // Will be called for write txns.
- notificationSender.sendNotification(w ->
w.packUuid(txId), err, NULL_HYBRID_TIMESTAMP);
+ return readTableAsync(commitTableId, tables)
Review Comment:
I'd also rename commitTableId.
--
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]