Does anyone have experience that they can share savepoints with MySQL (directly or through ORM), especially in a non-trivial web service? Where did you use them? Are they reliable enough (assuming you are ready to run a fairly recent version of MySQL) or are too bleeding or expensive?
Finally, does anyone have experience with something like the following use case and have you used savepoints for it? Let's say the main point of a particular unit of work is to add a row to the Orders table (or something else, not necessarily related to order), and update the OrdersAuditInfo table in the same transaction. It is very important that Orders updated if at all possible, but the OrdersAuditInfo table OrdersAuditInfo not so significant (for example, just register an error in the file, but continue working with the general transaction). At a low level, it might look like this (warning, pseudo-SQL follows):
BEGIN; INSERT INTO Orders(...) VALUES (...); SAVEPOINT InsertAudit; INSERT INTO OrdersAudit(...) VALUES(...); ROLLBACK TO SAVEPOINT InsertAudit; COMMIT;
But even here, would there possibly be a better (or at least more general) idiom? You could insert the OrdersAuditInfo tab into a completely different transaction, but it would be nice to ensure that the OrdersAuditInfo table was not written until the final COMMIT executed.
database mysql web-services transactions
Jacob Gabrielson
source share