-
Notifications
You must be signed in to change notification settings - Fork 60
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
Transaction synchronization #212
Merged
Merged
Conversation
This file contains 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
… each DataSource being managed within an application
…stentValue() for dirty properties
Added usePersistentDirtyPropertyValues
When including this project in another project as inline plugin $rootDir is the directory of the project that this plugin is included in. Using project.file we always get the correct path
GormEntity#ident has a similar if with these two branches: - PersistentEntity#identity is not null => Return value of this PersistentProperty - otherwise use PersistentEntity#compositeIdentity which is a list of properties that make up the composite key The default format of the string returned by getLogEntityId() is supposed to look like a map of the properties that make up the composite ID. For GormEntity only the ident is logged. # Conflicts: # plugin/src/main/groovy/grails/plugins/orm/auditable/Auditable.groovy
We decided that we wont fix the unexpected behaviour this test shows (for now)
„Test rollback behaviour“ and „Test nested transactions“ uncovered two new bugs with the previous implementation. Change AuditLogQueueManager to fix them. „test nested transactions different datastores“ is still an open problem and fails. Need to fix. See comment in test for explanation.
Going to need later
We didn’t find a way to achieve a good transaction synchronization using only GORM agnostic APIs. So for now this code is platform dependent on Hibernate.
Ensure that AuditTrails are always cleaned up BEFORE test runs
This ensures that the test environment is consistent
Leave makedoc.sh and travis-build.sh as release process has yet to be moved over to Github Actions
plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLogQueueManager.groovy
Outdated
Show resolved
Hide resolved
plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLogQueueManager.groovy
Outdated
Show resolved
Hide resolved
…eueManager.groovy
…eueManager.groovy
plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLogQueueManager.groovy
Outdated
Show resolved
Hide resolved
…eueManager.groovy
plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLogQueueManager.groovy
Outdated
Show resolved
Hide resolved
plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLogQueueManager.groovy
Outdated
Show resolved
Hide resolved
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.
Up to 4.x
AuditTrail
were written immediately e.g. when usingsave(flush: true)
even when afterwards the transaction failed or was rolled back.This PR is based on @longwa's work in
feature/4.0.0_wip
to queue theAuditTrail
s and batch-commit them AFTER the surrounding transaction is comitted.We added further tests that revealed edge cases when using nested transactions.
Unfortunately we didn't find a way to fix those edge cases in a GORM agnostic way yet.
Additionally, this supports using
hibernate.allow_update_outside_transaction: true
. This is handy when upgrading an old Grails 3 application to Grails 4 wherehibernate.allow_update_outside_transaction
defaults to false.For now we added a
provided
dependency onorg.grails.plugins:hibernate5
. This must be moved to a separate dependency to support e.g. using solely MongoDB.This fixes #173 and #175.