Skip to content
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

Narayana: support @DontRollback on exception type #22202

Merged
merged 1 commit into from Jan 26, 2022
Merged

Conversation

FroMage
Copy link
Member

@FroMage FroMage commented Dec 14, 2021

I need to be able to specify exception types that don't cause a rollback, such as redirect exceptions, for Renarde. This allows me to do it.

@FroMage FroMage added the area/narayana Transactions / Narayana label Dec 14, 2021
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DontRollback {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also support forcing a rollback (@Rollback(true) and @Rollback(false)).

At the moment rollback happens for unchecked exceptions, and it does not roll back for checked, so we should be able to override both these behaviors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK done.

*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be @inherited ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@FroMage
Copy link
Member Author

FroMage commented Jan 19, 2022

Done, and added a test.

@quarkus-bot
Copy link

quarkus-bot bot commented Jan 19, 2022

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 990b2a7

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Gradle Tests - JDK 11 #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.devmode.MultiModuleKotlinProjectDevModeTest.main line 22 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference was not fulfilled within 3 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:164)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

@FroMage
Copy link
Member Author

FroMage commented Jan 20, 2022

Failure seems unrelated, let's restart.

@quarkus-bot
Copy link

quarkus-bot bot commented Jan 20, 2022

Failing Jobs - Building 990b2a7

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Build Failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Gradle Tests - JDK 11 #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.devmode.MultiModuleKotlinProjectDevModeTest.main line 22 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference was not fulfilled within 3 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:164)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

⚙️ Gradle Tests - JDK 11 Windows #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.devmode.MultiModuleKotlinProjectDevModeTest.main line 22 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference was not fulfilled within 3 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:164)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

@FroMage
Copy link
Member Author

FroMage commented Jan 21, 2022

Same failure, again looks unrelated.

@FroMage FroMage merged commit 6600a9f into main Jan 26, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Jan 26, 2022
@FroMage FroMage deleted the narayana-dont-rollback branch January 26, 2022 13:10
@josephearl
Copy link

How does this differ from @Transactional and the dontRollbackOn parameter (which seems more flexible since I can choose to not rollback on exception types that are not under my control)?

@stuartwdouglas
Copy link
Member

It is applied to the exception type rather than the interception point. With @transactional if you have 100 endpoints you need to specify dontRollbackOn on every one.

@FroMage
Copy link
Member Author

FroMage commented Jan 27, 2022

Yeah. And now I'm realising that I need the same @Rollback annotation for @ReactiveTransactional so I wonder if I duplicate it or create a new module for common annotations or move it to a more core package. WDYT @stuartwdouglas ?

@stuartwdouglas
Copy link
Member

I guess a new common module that can be shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/narayana Transactions / Narayana
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants