-
Notifications
You must be signed in to change notification settings - Fork 61
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
GPAUDITLOGGING-4: Audit Logging Causes Rollback To Fail #88
Comments
robertoschwald said: Maybe we should switch to withNewTransaction to decouple audit logging from the main transaction. |
bdrhoa said: If I understand what you're saying correctly, then we would in fact have two separate transactions, one for the application transaction and one to create the audit record. |
longwa said: The 'transactional' flag is a bit confusing to me. I would think you want one of two behaviors:
Right now, the code doesn't handle the second case and even the first case is a bit dicey. For example, the actual save() of the audit log can be inside of a withTransaction() if using transactional= true, but since it's only wrapping the individual save(), it's not really doing much. At a minimum, I would think ALL of the audit rows for a single operation should be within a transaction together so you don't ever risk getting a partial log (especially true when verboseLog is enabled). |
is it fixed in new 1.1.0 release ? |
Original Reporter: bdrhoa
Environment: MySQL (Innodb), Grails 1.3.7
Migrated From: http://jira.grails.org/browse/GPAUDITLOGGING-4
If auditable = true then the insert into the audit log ends up creating a commit when a roleback is supposed to take place.
Example scenario:
Customer has a Person:owner
Person hasMany Authorities
Authority hasMany People
Given a Person who has Authority records and is in use as an owner of a Customer.
In a transaction:
This will cause a Referential Integrity Constraint error and should rollback the delete to the Authority records. However, the insert into the audit log and a commit get's sent to the DB, before the rollback from the error.
See the SQL log that illustrates the problem.
Setting transactional = true in config.groovy has no effect. The only current solution is to use static auditable = [handlersOnly:true].
The text was updated successfully, but these errors were encountered: