Alpha162 commented on PR #14511:
URL: https://github.com/apache/cloudstack/pull/14511#issuecomment-6743457894

   Thanks @DaanHoogland. On the manual breaking, I ran the failure case against 
a real MySQL 8.0.46 database. Inside one transaction: insert A, insert a 
duplicate A and catch the `EntityExistsException`, insert B, then `commit()`.
   
   | Code | Caller's `commit()` | Rows saved |
   |---|---|---|
   | 4.20 today | returns `false`, nothing committed | none |
   | #13925 | returns `false` | B only (A went with the caller's rollback, B 
committed on its own) |
   | this PR | returns `true` | A and B |
   
   The Simulator CI run on this PR also exercises the change against a real 
MySQL across the smoke tests, and it passed.
   
   On cost, MySQL's status counters confirm each nested `persist()` now sends a 
`SAVEPOINT` and a `RELEASE SAVEPOINT` on top of its `INSERT` and `SELECT`. A 
`persist()` outside a transaction sends nothing extra. 10,000 nested inserts on 
a local MySQL took about 7 s before and about 10 s after in the quieter runs. 
The build VM was noisy, so treat that as a rough figure. If that's too much for 
bulk callers, I can limit the savepoint to inserts that span more than one 
table or write an element collection. A failed single-statement insert is 
already undone by InnoDB, so those would only need their own `START_TXN` 
released.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to