Oracle Transaction Priority Guide - #1852
Open
radovanradic wants to merge 12 commits into
Open
radovanradic wants to merge 12 commits into
radovanradic wants to merge 12 commits into
Conversation
graemerocher
requested changes
Sep 1, 2026
…mples in Oracle Transaction Priority Guide
…n priority guide - Map OracleTransactionPriorityException to 409 Conflict with an ExceptionHandler - Replace the controller state machine with plain endpoints on the blocking executor - Use the derived findByIdForUpdate query instead of a native query - Wait for the real row lock in the test with a FOR UPDATE NOWAIT probe - Add a test for a reconciliation that commits without contention - Rewrite the guide text, drop the removed helpWithMicronaut snippet, add license headers
…ansaction priority guide
…t duration over HTTP
- Port the inventory service, controller, exception handler and tests to Groovy and Kotlin - Add a Pyronaut Python variant with application.toml and a pytest module - Move application.properties into the JVM language directories, so the Python project does not get a copy-to-container path that only exists in JVM layouts - Show TOML configuration and Pyronaut commands for Python in the guide text The Gradle Java, Groovy and Kotlin tests pass against Oracle. The Python tests are unverified: locally, pyronaut test fails before any guide code runs, because the installed Pyronaut SDK (0.0.3, GraalPy 25.3.4.1) does not match the GraalPy 25.4.4 used by Micronaut Platform 5.2.0. Existing Python guides fail the same way locally. pyronaut install and validate-config pass.
- Build a new InventoryItem instead of dataclasses.replace, which does not accept the entities that the repository returns - Send the concurrent reconciliation with CompletableFuture, because the GraalPy context does not allow Python threads With Pyronaut 0.0.6 (GraalPy 25.4.4), micronautDataOracleTransactionPriorityBuildPython passes: all Python tests pass against Oracle, including the priority rollback.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Oracle Transaction Priority Guide
Adds the guide "Prioritize Oracle Transactions with Micronaut Data JDBC" (
micronaut-data-oracle-transaction-priority), covering@OracleTransactionalpriorities and theOracleTransactionPriorityExceptionadded in Micronaut Data 5.2.0.What the guide builds
A small inventory app where two operations compete for the same row:
@OracleTransactional(priority = LOW): locks the item with a derivedfindByIdForUpdatequery (SELECT ... FOR UPDATE) and simulates a slow external count.@OracleTransactional(priority = HIGH): waits for the same row lock. After the configured wait target, Oracle rolls back the reconciliation and the checkout commits.TransactionPriorityExceptionHandler: mapsOracleTransactionPriorityException(ORA-63300/ORA-63302) to409 ConflictthroughErrorResponseProcessor, instead of a500.Languages
Java, Groovy, Kotlin and Python (Pyronaut).
application.properties.python/config/application.toml, and the guide text shows TOML config andpyronautcommands for Python.application.propertiesis not shared, because the shared resources are copied into the Pythonconfig/directory and itscopy-to-containerpath only exists in the JVM layout.Oracle setup
Test Resources starts
gvenzl/oracle-freeand copiespriority-txns.sqlinto/container-entrypoint-startdb.d. The script runs as SYSDBA and setsPRIORITY_TXNS_MODE=ROLLBACK,PRIORITY_TXNS_HIGH_WAIT_TARGET=5andPRIORITY_TXNS_MEDIUM_WAIT_TARGET=10(SCOPE=MEMORY) for the container database andFREEPDB1.Tests
The HTTP tests use
@MicronautTest(transactional = false), so each request runs its own transaction:RECONCILED).409with the handler's message, and only the checkout is committed. The test waits for the real row lock first, using aFOR UPDATE NOWAITprobe (ORA-00054).countSecondsoutside 1..120 returns400 Bad Request(Bean Validation).Verification
micronautDataOracleTransactionPriorityBuildPythonpasses locally with Pyronaut 0.0.6 andgraalpy3.13-25.4.4(all tests, against Oracle).Known CI failure
The Python project fails in CI with
pyenv: command not found/pyronaut: command not found, because the Test Guides workflow doesn't install pyenv, GraalPy or Pyronaut.masterfails the same way for every Python guide (for example,micronautSecurityBasicauthBuildin run 36672950473). This needs a separate CI infrastructure fix; it isn't caused by this guide.micronaut-data-oracle-transaction-priority-gradle-groovy.pdf
micronaut-data-oracle-transaction-priority-gradle-java.pdf
micronaut-data-oracle-transaction-priority-gradle-kotlin.pdf
micronaut-data-oracle-transaction-priority-maven-groovy.pdf
micronaut-data-oracle-transaction-priority-maven-java.pdf
micronaut-data-oracle-transaction-priority-pyronaut-python.pdf