Live data from Hacker News

The day I locked everyone out of the company intranet

dancowell.com

61–70 of 130 posts

Re: The day I locked everyone out of the company intranet

#61
post #46

Always do a select with your criteria before doing a Delete or update. Don’t ask me how I learned this.

Gone are the days of hard deletes in my approach; it's exclusively soft deletes now!

In the EU soft deletes can violate GDPR, so not always an available strategy.

Re: The day I locked everyone out of the company intranet

#62

Use chatGPT to double check too.

"Yes, you can delete those items via that query." "But now all has been deleted??!?! WTF HEEELP" "I apologize for my previous answer, you are correct, you now deleted everything!"

Mmm… you can ask to explain what the query will do… yes you can mess thing up if you do not understand, therefore you try to understand. There is a lot to learn, i did not recommend running code in production frOm chatGPT, funny with downvoting

Re: The day I locked everyone out of the company intranet

#63

Always do a select with your criteria before doing a Delete or update. Don’t ask me how I learned this.

Came here to say exactly that! I do a select count and then a limit against the returned count. At least it may reduce the blast radius.

In most of my scenarios, I'd actually rather cause a catastrophic global change than a silent subtle corruption of a handful of rows

Re: The day I locked everyone out of the company intranet

#64
post #60

My chooosen database explorer is Dbeaver. Horrible name but great app. You can set colours for local/test/prod servers and a red colored tab will scream at you to be cautious. And with red color every edit will pop up an "are you sure?" question. And autocommit is off. I sorta stopped making unrecoverable mistakes.

DBeaver is great. I came from a different tool, and had to get used to persisting the changes. I’m totally use to it.

I run a local copy of the database I connect to remotely and I have to be careful about which database/table I’m connected too.

Re: The day I locked everyone out of the company intranet

#65
post #12

I was working on an old old old "ERP" system written in D3 PICK. It's a database, programming language and OS all in one with roots in tracking military helicopter parts in the 1960's. I was working on it in the mid-2000s. It had SQL like syntax for manipulating data, but it was interactive. So you would SELECT the rows from the table that you wanted, then those rows would be part of your state. You would then do UPD…

Whe. I first learned SQL on an oracle cli client I was told to type begin; then any other command. For a brief while until i learned about transactions, I assumed that it was part of the cli startup :)

Re: The day I locked everyone out of the company intranet

#66

Earlier quoted context omitted.

Came here to say exactly that! I do a select count and then a limit against the returned count. At least it may reduce the blast radius.

In most of my scenarios, I'd actually rather cause a catastrophic global change than a silent subtle corruption of a handful of rows

That may be fun in a trivial setup such as op’s but when millions of customers or billions of transactions are affected it’s a nightmare. A competent engineer runs queries against a local and then a uat db, verifies results and then on prod. But if you must do it in prod then it must be limited in scope.

Re: The day I locked everyone out of the company intranet

#67

These kinds of scenarios happen when money is "cheap", and highlight why the current recession, and coming 2nd great depression aren't really a bad thing.

... Okay, I've seen people blame monetary policy for a lot of things, but I'm really struggling to see how this one works.

Re: The day I locked everyone out of the company intranet

#69
post #59
post #29

Back in the 90s I remember a work colleague asking 'can you rollback a drop table?', to which I replied 'no', and all the blood drained from his face in seconds. It's one of those things you've heard happens to people, but until you see it, you can't quite believe it.

Since this seems to be such a common occurrence, why haven't databases evolved to maintain some limited form of history that can be rolled back? Have no idea of the complexity, so forgive me if that sounds daft.

[deleted]

Re: The day I locked everyone out of the company intranet

#70
post #59
post #29

Back in the 90s I remember a work colleague asking 'can you rollback a drop table?', to which I replied 'no', and all the blood drained from his face in seconds. It's one of those things you've heard happens to people, but until you see it, you can't quite believe it.

Since this seems to be such a common occurrence, why haven't databases evolved to maintain some limited form of history that can be rolled back? Have no idea of the complexity, so forgive me if that sounds daft.

Long story short, you’re holding multiple transactions open. That’s a lot of bookkeeping overhead if there’s a lot of changes. A system with a few million rows and moderate load on a reasonably-sized server for that load will slam to a halt.

Then come the “site is down and the world is ending” tickets, messages, emails, and phone calls.

Post reply on HN