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

Reply via email to