
First Contact: GitHub
Our first contact with Ignite was an example project on GitHub. It suggests a configuration of Ignite with TransactionsEssentials. We'll come back to that further on in this post.Apache Ignite at Apache
Google sends us to this project homepage. The page looks good, quite frankly.ACID Transactions and JTA/XA
The homepage features ACID Transactions - clicking on this brings us to this documentation page. At the bottom of that page we find a section on JTA/XA integration. It suggests that the following use case is supported:IgniteCache<String, Integer> cache = cache(); UserTransactionManager utm = new UserTransactionManager(); utm.begin(); cache.put("key", "value"); utm.commit();In other words, this is similar to our Hazelcast integration. So far, so good!
Instead of calling begin() and commit() on the UserTransactionManager, you can also use Spring's @Transactional annotation. That should also work (because Spring really delegates to the UserTransactionManager).
More Transaction Features
The project also has this feature page - all about its transaction support. Of all the things there, what catches my eye is the section on two-phase-commit. Going to that page, it says somewhere:Ignite utilizes a Two-Phase-Commit (2PC) protocol for its transactions and optimizes to one-phase-commit whenever possible. Whenever data is updated within a transaction, Ignite will keep a transactional state in a local transaction map until commit() is called, at which point, if needed, the data is transferred to participating remote nodes.
So it seems like whatever you put in the cache is kept locally until the commit phase. That makes me wonder: what happens if two concurrent transaction put a value for the same key? Probably one of them will fail during the prepare phase of the two-phase commit (we did not test it).
Trying the Example on GitHub
What happens if we run the example on GitHub - mentioned in the beginning of this post? We tried, and here is the result:
[INFO] 3 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:07.892s [INFO] Finished at: Wed Jul 31 09:34:16 CEST 2019 [INFO] Final Memory: 25M/135M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project ignite-examples: Compilation failure: Compilation failure: [ERROR] /Users/guy/Downloads/ignite-examples-master/src/main/java/com/wangguofeng1923/ignite/examples/Demo.java:[15,46] package com.wangguofeng1923.examples.bytebuddy does not exist [ERROR] /Users/guy/Downloads/ignite-examples-master/src/main/java/com/wangguofeng1923/ignite/examples/Demo.java:[16,46] package com.wangguofeng1923.examples.bytebuddy does not exist [ERROR] /Users/guy/Downloads/ignite-examples-master/src/main/java/com/wangguofeng1923/ignite/examples/Demo.java:[17,46] package com.wangguofeng1923.examples.bytebuddy does not exist [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
In other words, it seems some code is missing?