Compute API requires code deployment, which may be an obstacle in some cases.
But instead of withAffinityNode, I think we can add a new method to IgniteClient: public ClientTransactions transactions(ClusterGroup grp); Similar to existing compute(ClusterGroup) and services(ClusterGroup) methods. On Thu, Aug 11, 2022 at 7:31 PM Alexei Scherbakov < alexey.scherbak...@gmail.com> wrote: > Moving transaction logic to the client seems to me a bad idea. > > I would instead send the transaction's code close to data using Compute > API. > > чт, 11 авг. 2022 г. в 17:54, Maxim Muzafarov <mmu...@apache.org>: > > > Igniters, > > > > > > I'd like to discuss with you some thoughts about getting colocated > > data [1] from nodes via thin client (mostly the java thin client). > > > > - We do have partition awareness enabled for non-transactional data [2]. > > - We do have from now on partition awareness for caches with custom > > affinity functions [3]. > > - We do NOT have an option to execute a transactional operation on > > affinity node [4], however, I think it is possilbe to send a > > transactional get request over the affinity channels instead of the > > default one. > > > > > > The process execution on the thin client side may looks like: > > > > open transaction (colocated get request) -> set the right client > > context -> pick up the affinity node channel (instead of the default > > one) -> send the request over this channel right to the destination > > primaries. > > > > The interface improvement may looks like: > > > > IgniteClient { > > public void withAffinityNode(String cacheName, Object affKey); > > } > > > > IgniteClient affClient = Ignition.startClient(new ClientConfiguration() > > .setAddresses("node1_address:10800", "node2_address:10800", > > "node3_address:10800")) > > .withAffinityNode("person", "affKey"); > > > > try (ClientTransaction tx = affClient.transactions().txStart() > > ) { > > ClientCache<Integer, String> personCache = affClient.cache("person"); > > ClientCache<Integer, String> paymentsCache = > > affClient.cache("payments"); > > > > // personCache.get("affKey"); > > // paymentsCache.get(..); > > } > > catch (ClientException e) { > > // Ignore. > > } > > > > > > Additional benefits: > > > > - ScanQuery, SqlQuery with #setLocal(true) flag right on the required > > affinity channel; > > - ClientCompute task right on the required affinity channel; > > > > > > WDYT? > > > > > > [1] > > > https://ignite.apache.org/docs/latest/data-modeling/affinity-collocation#affinity-colocation > > [2] > > > https://ignite.apache.org/docs/latest/thin-clients/getting-started-with-thin-clients#partition-awareness > > [3] https://issues.apache.org/jira/browse/IGNITE-17316 > > [4] > > > https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java#L994 > > > > > -- > > Best regards, > Alexei Scherbakov >