• (nodebb)

    Transactions are hard.

    Like, that's just your opinion, man.

  • (nodebb)

    It's always good to think through how any given database operation behaves inside of a transaction.

    More to the point, it's always good to think about how any given sequence of database operations behaves outside of a transaction. (Is it, for example to create gibberish in the database by crashing halfway through the sequence?)

  • Darren (unregistered)

    Based on the myriad of WTFs we get here it's quite obvious that developers don't being to start to formulate the possibility of having a thought as to how a database operation works. That's the job of the framework or DBA, right?

  • (nodebb)

    Meh, transactions just sound like some pointless paranoia stuff. Surely that adds complexity at runtime and more importantly more code to write and think about. Ain't got no time for that. I mean it's a database, it's built to execute operations, so why would it fail? And if it does, we'll see them errors in the logs or some kind of exception somewhere. I mean, somebody else will see them because I have better things to do than check logs or catch exceptions or handle return error codes. That's for noobs, I write pro code that doesn't fail.

  • (nodebb) in reply to Ralf

    we'll see them errors in the logs or some kind of exception somewhere

    Except in the first commercial system I worked on where some bright spark had the idea to use a database table for logging. It worked really well except when some error occurred that caused the transaction to abort and roll back the database, including, of course, the log table.

  • Darren (unregistered) in reply to jeremypnet

    In a similar vein I was once asked to setup a system that would email the business if the email server went down.

    I suppose you could do that nowadays with Exchange SE - but only if the SE stands for Schrödinger Edition...

  • Faroguy (unregistered)

    Let's just say that choices were made 15 years ago and ever since I started the job in 2023 I've been handling the consequences.

  • Richard Brantley (unregistered)

    I worked with a product made by a vendor who said 'if the process errors out, just roll back the database.'

    That was, sadly, not the worst of their coding ills.

  • gman003 (unregistered) in reply to jeremypnet

    At one of my first coding jobs, I implemented error logging in the database. Which worked up until an error occurred inside the log-to-the-database code. Which caused it to attempt to log an error to the database. Which caused another error. Which - well, you can see where this is going. (This is why you don't delegate your logging system to the intern, kids!)

    We were several months into crunch at that point and nobody was looking at the error logs, so we just disabled it. And shipped that way. And at the time I left, a decade and a few promotions later, we still didn't have any error logging.

    I should ask if they ever did re-implement that, next time they call asking me to contract for a bit.

Leave a comment on “Consistently Transactional”

Log In or post as a guest

Replying to comment #691242:

« Return to Article