-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a temporary config property to allow multiple resources #40365
Conversation
...runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me.
I'm not 100% sure if we should really remove this in the future - yes we should be clear that we don't recommend (nor support!) this option, and perhaps even link to an explainer (a Narayana article/blog would be great to explain to people why this is important!), but I'd be willing to be pragmatic about it: some people might appreciate that, especially while creating POCs.
...runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
...runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gsmet - LGTM !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes are good but I have requested additional text for the javadoc for the new config property.
...runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
This was my concern, once it's in there will be reluctance to remove it. It is useful for development but I haven't been able to come up with any other use-case. |
e29ccea
to
2931a6e
Compare
I included @mmusgrov 's changes and changed the wording a bit for the removal, asking users to open issues if they see a valid use case. That way we will be able to take an educated decision in the future. |
...runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java
Show resolved
Hide resolved
@mmusgrov I did some further tests with the reproducer and I encountered the following warning twice:
Is it a warning that will be logged for each transaction? Because if so I don't think it will fly as we will flood the log. |
OK, I filtered your warnings and added a warning of our own saying:
I think this should be good enough. It will be displayed only once when the application is started. |
Just curious, you really mean it's going to be shown once? I didn't know we had that capability. |
@gsmet There is another property to disable it:
But the warning should only be issued once for each last resource, since you have two such last resources I'd expect to see it printed twice. I think it's valid to report the warning on each such attempt to register a last resource, ie I don't think it should be swallowed. |
ie I think it's valid to report the warning on each attempt to register a last resource (we only report it once per offending resource anyway), ie I don't think the second one should be swallowed since the user needs to know that he's heading into choppy waters with the second resource. |
becf17b
to
2931a6e
Compare
Ah OK, if it's issued only once then it's all good. I removed the two additional commits then. |
Actually I think it may still be printed on each transaction unless that property (setDisableMultipleLastResourcesWarning) is set. The check for whether to report a warning is here. Would you be able to check your reproducer with two transactions? |
We also print a warning during start up if |
Similarly if |
The plan is to remove this property in 3.11 but we need to provide a way for people to update to latest security fixes without having to significantly adjust their applications. In 3.11, we need to document this breaking change properly and also provide guidance on how to fix the most common issues that could be encountered due to this breaking change.
This to make sure we have a consistent experience between JVM and native modes.
Yes please, it's much more precise and clear.
I'm surprised that you'd hink that most users will not be familiar with XA. Sure, I don't expect many to be expert in it, but at least being familiar with the notion should be a requirement to make applications. |
Sanne, people struggle with basic SQL. EDIT: Besides, I'm not worried about "most users", but rather about "the minority who doesn't understand this stuff and will need this documentation the most". |
…ces` into `quarkus.transaction-manager.unsafe-multiple-last-resources` * The property is now named `quarkus.transaction-manager.unsafe-multiple-last-resources` * It has three possible values: * `allow`: allow unsafe multiple last resources, no warning per offending transaction * `warn`: allow unsafe multiple last resources, one warning log per offending transaction * `fail`: fail on unsafe multiple last resources * It will log a warning on startup if *explicitly* set to `allow` or `warn`. * It defaults to `fail` in this commit. * The plan is to make it default to `warn` in 3.8, which means no log on startup, but one per offending transaction. People will be able to set it to `allow` explicitly to suppress the warning per offending transaction, but will get a warning on startup (since they set the property explicitly).
The log level we get in beforeAnalysis may be null, in which case we still want to reset it after analysis. From the javadoc of Logger#getLevel: > Get the log Level that has been specified for this Logger. > The result may be null, which means that this logger's effective level will be inherited from its parent.
…o accept `warn-first` and `warn-each`
27d4ca9
to
3b008a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I addressed @Sanne 's comments and split the warn
option.
So here's what we have now:
- The property is named
quarkus.transaction-manager.unsafe-multiple-last-resources
- It has four possible values:
allow
: allow unsafe multiple last resources, no warning per offending transactionwarn-first
: allow unsafe multiple last resources, one warning on the first offending transaction only, no warning after thatwarn-each
: allow unsafe multiple last resources, one warning log per offending transactionfail
: fail on unsafe multiple last resources
- It will log a warning on startup if explicitly set to
allow
orwarn-first
orwarn-each
. - It defaults to
fail
in this PR. - The plan is to make it default to
warn-first
in 3.8, which means no log on startup, but one per offending transaction. People will be able to set it toallow
explicitly to suppress the warning on the first transaction, but will get a warning on startup (since they set the property explicitly).
@gsmet you can test this using my fork of the reproducer, which processes batches of 2 items, so it'll open multiple transactions: https://github.com/yrodiere/quarkus-camel-transactions/tree/fix
Status for workflow
|
Status for workflow
|
I think Yoann addressed your concerns and we can tweak the doc further later if needed. I'm trying to wrap up 3.11.0.CR1 and 3.10.1.
@shawkins @yrodiere Reporting mixed outcomes (first resource commits and the second one rolls back) from XA unaware participants requires some invasive changes to ArjunaCore so that we can support crash recovery and it will take us a while to design the changes. But we can detect such heuristic outcomes so would it be sufficient, in the short term, to log a WARNing instead and longer term we'd report the HeuristicMixedException? Note also that the probability of mixed outcomes is much higher than LRCO because the window between committing the first and second resources includes a network call so that window is quite long compared to the LRCO window of exposure. |
I'll let @shawkins answer about the HeuristicMixedException, personally I'm not familiar with that. I think @shawkins wanted to open a dedicated issue about the specific needs of Keycloak in this area? As far as I'm concerned, logging a warning in case of dodgy rollbacks seems like a reasonable first step, at least better than no information at all. I'm not sure it will help a lot but it will at least help debugging. Though IMO solving #40431 (getting a clear exception in case of multiple non-XA datasources in a single transaction) would be more beneficial to Quarkus users in general -- those who didn't enable dangerous settings. |
The main concern is around making users aware / documenting that a mixed situation has occurred. If that's via log, it will work as a first step. |
The plan is to remove this property in the future but we need to provide a way for people to update to latest security fixes without having to significantly adjust their applications.
When we remove it, we need to document this breaking change properly and also provide guidance on how to fix the most common issues that could be encountered due to this breaking change.
TODO:
Fixes #39283