5 ms·
I don't think this controversial. Retrying failed transactions is a common strategy.
by returningfory2 2y ago
I don't think this controversial. Retrying failed transactions is a common strategy.
- gwd 2y agoYou're the first person I've heard say so. When I was learning DB stuff, there were loads of examples of things that looked at the error from a transaction. Not a single one of them then retried the transaction as a result. The OP's comment is a symptom of this -- they did some writes or some transactions and were getting failures, which means they weren't retrying their transactions. And then when they searched to solve the problem, the advice they received wasn't "oh, you should be retrying your transactions" -- rather, it was some complicated technical thing to avoid the problem by preventing concurrent writes.
- returningfory2 2y agoAh, interesting. Maybe my experience has been unusual then. I agree with you the retrying transactions is relatively simple and powerful.
- bornfreddy 2y agoI'm in the opposite camp. Transactions can fail, however retrying them is not the solution. It hides the symptom (which is not a problem with proper monitoring), but more importantly, it can lead to overwhelming the db server. Sometimes failure happens because of the load, in which case retrying the query is counterproductive. And even in cases where retrying would be the correct approach, it is the responsibility of the app logic, not of the db connection layer, to retry the query. Imho of course. :)