You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2019/10/15 15:52:00 UTC
[jira] [Created] (IGNITE-12292) Java thin client: In some cases
txId intersection (tx started on different nodes) leads to errors
Aleksey Plekhanov created IGNITE-12292:
------------------------------------------
Summary: Java thin client: In some cases txId intersection (tx started on different nodes) leads to errors
Key: IGNITE-12292
URL: https://issues.apache.org/jira/browse/IGNITE-12292
Project: Ignite
Issue Type: Bug
Components: thin client
Affects Versions: 2.8
Reporter: Aleksey Plekhanov
Assignee: Aleksey Plekhanov
Fix For: 2.8
Reproducer:
{code:java}
public void testTxWithIdIntersection() throws Exception {
int CLUSTER_SIZE = 2;
try (LocalIgniteCluster cluster = LocalIgniteCluster.start(CLUSTER_SIZE);
IgniteClient client = Ignition.startClient(new ClientConfiguration()
.setAddresses(cluster.clientAddresses().toArray(new String[CLUSTER_SIZE])))
) {
ClientCache<Integer, Integer> cache = client.createCache(new ClientCacheConfiguration().setName("cache")
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
CyclicBarrier barrier = new CyclicBarrier(2);
GridTestUtils.runAsync(() -> {
try {
// Another thread starts transaction here.
barrier.await(1, TimeUnit.SECONDS);
for (int i = 0; i < CLUSTER_SIZE; i++)
dropAllThinClientConnections(Ignition.allGrids().get(i));
ClientTransaction tx = client.transactions().txStart();
barrier.await(1, TimeUnit.SECONDS);
// Another thread puts to cache here.
barrier.await(1, TimeUnit.SECONDS);
tx.commit();
barrier.await(1, TimeUnit.SECONDS);
}
catch (Exception e) {
log.error("Unexpected error", e);
}
});
ClientTransaction tx = client.transactions().txStart();
barrier.await(1, TimeUnit.SECONDS);
// Another thread drops connections and create new transaction here, which started on another node with the
// same transaction id as we started in this thread.
barrier.await(1, TimeUnit.SECONDS);
try {
cache.put(0, 0);
fail("Exception expected");
}
catch (ClientException expected) {
// No-op.
}
tx.close();
barrier.await(1, TimeUnit.SECONDS);
// Another thread commit transaction here.
barrier.await(1, TimeUnit.SECONDS);
assertFalse(cache.containsKey(0));
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)