quarkus-quickstarts
quarkus-quickstarts copied to clipboard
Add Narayana Transaction Logs QuickStart
closes: #1306
Ad Check list: The guide update is being worked on by docs team right now and I don't want to interfere. If this ever pass review, I'll check with @MichalMaler how to proceed.
Check list:
Your pull request:
- [x] targets the
developmentbranch - [x] uses the
999-SNAPSHOTversion of Quarkus - [x] has tests (
mvn clean test) - [x] works in native (
mvn clean package -Pnative) - [x] has integration/native tests (
mvn clean verify -Pnative) - [ ] makes sure the associated guide must not be updated
- [x] links the guide update pull request (if needed)
- [x] updates or creates the
README.mdfile (with build and run instructions) - [ ] for new quickstart, is located in the directory component-quickstart
- [x] for new quickstart, is added to the root
pom.xmlandREADME.md
Hey @zhfeng , WDYT? I decided against your project with dummy xa resources because it feels like it is important to show automatic recovery on XA resources registered by Agroal. I can make adjustments based on your feedback.
Recovery works, but as you can see here https://github.com/quarkusio/quarkus-quickstarts/blob/35c09deff26031d6b4659f0694eeb366fa4a22f4/narayana-transaction-logs-quickstart/README.md?plain=1#L30 it only happens if you make at least one request using XA transactions after crashed up was restarted in order for com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule to see XA resource. Without that, transaction never recovers and you can see
2023-08-06 23:56:26,715 WARN [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=46, bqual_length=36, tx_uid=0:ffff0a0000b9:af1b:64d01657:11, node_name=quarkus-quickstart, branch_uid=0:ffff0a0000b9:af1b:64d01657:17, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@55ea0fec >
2023-08-06 23:56:26,719 WARN [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=46, bqual_length=36, tx_uid=0:ffff0a0000b9:af1b:64d01657:11, node_name=quarkus-quickstart, branch_uid=0:ffff0a0000b9:af1b:64d01657:13, subordinatenodename=null, eis_name=0 >
I presume it is not a bug, but rather something I am missing? Anyway, feedback is welcome and I think even with that additional request, this quickstarts fill its purpose.
also cc @mmusgrov (review welcomed)
:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.
:heavy_check_mark: The latest workflow run for the pull request has completed successfully.
It should be safe to merge provided you have a look at the other checks in the summary.
Thanks @michalvavrik and it smells like a regression bug.
IIRC, it should work before. And can you check it with Quarkus 3.2 ?
I think there are some changes with quarkus-agroal in the main branch and DataSource looks like not initializing at the application startup.
see https://github.com/quarkusio/quarkus/blob/main/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/AgroalRecorder.java#L28-L30
If that is the case, please can you open an issue on quarkus?
Hey @zhfeng , fun fact, it only works with 999-SNAPSHOT, when I run app with 3.2.x.Final, app starts to fail
2023-08-07 12:18:22,356 FATAL [com.arj.ats.arjuna] (main) ARJUNA012260: Received exception for com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors.DirectDataSourceJDBCAccess:quarkus_JBossTSTxTable: java.lang.NullPointerException: Cannot invoke "io.quarkus.arc.ArcContainer.instance(java.lang.Class, java.lang.annotation.Annotation[])" because the return value of "io.quarkus.arc.Arc.container()" is null
at io.quarkus.narayana.jta.runtime.QuarkusDataSource.getDataSource(QuarkusDataSource.java:29)
at io.quarkus.narayana.jta.runtime.QuarkusDataSource.getConnection(QuarkusDataSource.java:38)
at com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors.DirectDataSourceJDBCAccess.getConnection(DirectDataSourceJDBCAccess.java:27)
at com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore.initImple(JDBCStore.java:235)
at com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore.<init>(JDBCStore.java:213)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClass(ClassloadingUtility.java:129)
at com.arjuna.ats.arjuna.objectstore.StoreManager.initStore(StoreManager.java:152)
at com.arjuna.ats.arjuna.objectstore.StoreManager.getActionStore(StoreManager.java:111)
at com.arjuna.ats.arjuna.objectstore.StoreManager.getRecoveryStore(StoreManager.java:68)
at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.<init>(AtomicActionRecoveryModule.java:67)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClass(ClassloadingUtility.java:135)
at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClassesWithInit(ClassloadingUtility.java:192)
at com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean.getRecoveryModules(RecoveryEnvironmentBean.java:476)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.loadModules(PeriodicRecovery.java:888)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.<init>(PeriodicRecovery.java:121)
at com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple.<init>(RecoveryManagerImple.java:107)
at com.arjuna.ats.arjuna.recovery.RecoveryManager.<init>(RecoveryManager.java:479)
at com.arjuna.ats.arjuna.recovery.RecoveryManager.manager(RecoveryManager.java:132)
at com.arjuna.ats.arjuna.recovery.RecoveryManager.manager(RecoveryManager.java:112)
at io.quarkus.narayana.jta.runtime.NarayanaJtaRecorder.lambda$handleShutdown$6(NarayanaJtaRecorder.java:141)
at io.quarkus.runtime.StartupContext.runAllInReverseOrder(StartupContext.java:84)
However you were right, it goes down to the datasource initialization. I've added following workaround that fixed problem:
package org.acme.quickstart;
import io.agroal.api.AgroalDataSource;
import io.quarkus.runtime.StartupEvent;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import jakarta.inject.Named;
@ApplicationScoped
public class StartupService {
@Inject
AgroalDataSource dataSource;
@Named("other-ds")
@Inject
AgroalDataSource otherDataSource;
@Named("object-store-ds")
@Inject
AgroalDataSource objectStoreDataSource;
public void initDataSources(@Observes StartupEvent event) {
// force init of proxied beans
dataSource.getMetrics();
otherDataSource.getMetrics();
objectStoreDataSource.getMetrics();
}
}
Thanks! I'll open issue, your quick response is well appreciated.
Upstream issue is now resolved, so I adjusted quickstart bit. Should be ready for review. cc @zhfeng
:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.
Failing Jobs - Building 861b2fa663112665493703863507d601000daaf3
| Status | Name | Step | Failures | Logs | Raw logs |
|---|---|---|---|---|---|
| ✖ | Build - JDK 11 | Build with Maven |
Failures | Logs | Raw logs |
Full information is available in the Build summary check run.
Failures
:gear: Build - JDK 11 #
- Failing: hibernate-search-orm-elasticsearch-quickstart
:package: hibernate-search-orm-elasticsearch-quickstart
✖ org.acme.hibernate.search.elasticsearch.service.LibraryResourceTest.testLibrary - More details - Source on GitHub
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.elasticsearch.restclient.common.deployment.DevServicesElasticsearchProcessor#startElasticsearchDevService threw an exception: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Dev Services for Elasticsearch detected a version mismatch, container image is docker.elastic.co/elasticsearch/elasticsearch:8.8.2 but the configured version is 7. Either configure a different image or disable Dev Services for Elasticsearch.
:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.
Failing Jobs - Building c445b93cfa9b78438ee49c7a8b5dcf24c6433ed8
| Status | Name | Step | Failures | Logs | Raw logs |
|---|---|---|---|---|---|
| ✖ | Build - JDK 11 | Build with Maven |
Failures | Logs | Raw logs |
Full information is available in the Build summary check run.
Failures
:gear: Build - JDK 11 #
- Failing: hibernate-search-orm-elasticsearch-quickstart
:package: hibernate-search-orm-elasticsearch-quickstart
✖ org.acme.hibernate.search.elasticsearch.service.LibraryResourceTest.testLibrary - More details - Source on GitHub
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.elasticsearch.restclient.common.deployment.DevServicesElasticsearchProcessor#startElasticsearchDevService threw an exception: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Dev Services for Elasticsearch detected a version mismatch, container image is docker.elastic.co/elasticsearch/elasticsearch:8.8.2 but the configured version is 7. Either configure a different image or disable Dev Services for Elasticsearch.
hibernate-search-orm-elasticsearch-quickstart failure unrelated, now it happens twice in row, so I won't re-trigger build again.
Good cooperation @michalvavrik and @zhfeng ! @zhfeng Pleaes, when you will have a minute, I sent you a message on Zullip. Please, have a look. Cheers!
:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.
Failing Jobs - Building 289fcb9db65281927e454156e2cf48e699becab4
| Status | Name | Step | Failures | Logs | Raw logs |
|---|---|---|---|---|---|
| ✖ | Build - JDK 11 | Cache Maven Repository |
:warning: Check → | Logs | Raw logs |
I rebased on current development. CI fails on "Cache maven Repository", so I doubt it can be related.
:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.
:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.
:heavy_check_mark: The latest workflow run for the pull request has completed successfully.
It should be safe to merge provided you have a look at the other checks in the summary.
Maybe @yrodiere could have a little more time (and since he reviewed upstream transaction logs PR) than @gsmet ?
This PR needs to be adapted to changes in Quarkus and Quakurs Quickstarts that happen in between. I'll do it later this week, address, Yoann comments and reopen it.