4 ms·
Yeah as soon as I read this I felt bad for the employee. I remember writing an update statement without a where clause and having to restore the table from back
by gigatexal 10y ago
Yeah as soon as I read this I felt bad for the employee. I remember writing an update statement without a where clause and having to restore the table from backup. But that was at a company not as advanced as Amazon. Fat fingering a key like that is just crazy (but comforting that even at Amazon it happens) and I'm sure they've fixed that from happening again.
- duskwuff 10y agoFWIW: Setting "safe-updates=1" in ~/.my.cnf will require UPDATE and DELETE statements in the client to have a WHERE clause which references a key. It's not perfect protection, but it will save you from a lot of mistakes.
- gigatexal 10y agohmm, that's kinda cool. I'm in a MS shop and I don't know if SMSS has the same feature. My manager just looked at me and said "welp, go restore the table and be more careful next time." I was a new DBA at the time, still, kinda new.
- amichal 10y agoThat's awesome, My worst DELETE fail however was: DELETE * FROM table WHERE [long condition that resolves to true for all records] Now i write SELECT or SELECT COUNT(*) over and over again until i see the data i expect and then change it to a DELETE/UPDATE. It's not my personal habit but some folks I know turn off auto commit and BEGIN a transaction every time they enter an interactive SQL sessions. They then default to ROLLBACK at least once before COMMITing them. That and having a user with read-only permissions or a read replica
- tacon 10y agoIs there a collection of data safety tips like this somewhere? I never knew this existed. What else am I missing?
- saalweachter 10y agoFat fingers are just nature's way of making sure you test your back-up & restore procedures periodically :-)
- vocatus_gate 10y agoI once brought down our entire production XenServer cluster group by issuing a "shutdown now" in the wrong SSH window. Needless to say it was a bad feeling watching Nagios go crazy and realizing what had just happened.
- gigatexal 10y agoOh crap! Yeah I bet you were pretty panicked. My update statement destroyed data that my team used all the time so I was worried I'd get fired. Luckily that wasn't the case.
- Piskvorrr 10y agoroot@baz # shutdown now W: molly-guard: SSH session detected! Please type in hostname of the machine to shutdown: foo Good thing I asked; I won't shutdown baz ... Surprising to see such a simple protection neglected.
- wakkaflokka 10y agoWhen I first started using Linux and wanted to do some housecleaning, I did "rm -r (asterix) in a folder. Cleaned up everything, no prob. Then went to some more folders, hit the up arrow on my keyboard fast to get to a command I had used before. Hit 'enter' before my brain realized I had landed on rm -r (asterix) and not the right command. Never used that command again.