Live data from Hacker News

The day I locked everyone out of the company intranet

dancowell.com

101–110 of 130 posts

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

#101

A few months into my first job out of college, I brought down the main production server in the middle of the workday. It took us about an hour to recover. Afterward, I was very embarrassed and apologetic, but my boss just shrugged and said: "You're not a real technology worker until you've brought the company down. Welcome." Might not be the best words to live by, but it was exactly what I needed to hear at that tim…

Frequently heard in batcaves: "Hey, the FNG børked Prod."

"One of us!! One of us!!" :-)

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

#102

We had this saying: "If you fix it before anyone realized it was broken, you didn't break it."

Depending on the situation it can be risky to start thinking like this, trying to fix stuff with lots of stress, in secret, maybe working around access restrictions, it's easy to make further mistakes

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

#103
Roughly 10 years ago, I was working for a startup that offered a live conversational video service where you could also have hundreds (or eventually, thousands) of near-live watchers - with recording and later playback. The founder pitched the service to news orgs and celebrities. Anderson Cooper had a regular "show" there for a while, and we had a number of interviews with mostly 2nd-tier celebrities.

When the service started, they made the decision to not actually delete any content (delete just set a flag which disabled the content but didn't actually remove it).

Fast forward a year or so, and it became clear that a real delete was needed. So they had a junior engineer write up a sort of delayed sweep - delete all the videos with the delete flag set. But then, for some reason, they decided put the implementation behind a delay. Something like "actually delete all soft-deleted videos, but don't start doing it until 30 days from now". However, unbeknownst to the team, there was a bug in the implementation that deleted everything, regardless of whether the 'delete' flag was set.

So one night, roughly a month later, all the content started disappearing from the site. One guy heroically tried to stop the process, but I think he was too late. The engineering director happened to be on a vacation down in South America somewhere and I think the founder fired him in a fit of pique. I managed to reclaim a small bit of content (basically the videos that were cached on the actual recording servers before they were uploaded to S3).

You can imagine the technical over-reaction:

  * Delete switched back to a soft delete
  * Turned on S3 object versioning
  * Started redundantly copying content onto a totally different hosting service
This was fine (hah!) until we had to start taking down the inevitable child porn that always shows up on services like this - I got stuck with writing the takedown code and it took me forever to track down all the various tendrils of stuff.

As you might expect, we lost a ton of users over mass content deletion and the service never really rebounded. The company held on for a couple more years, pivoting a couple of times, but eventually folded.

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

#104
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.

i'm using it on Mac, and it seems to want to update every time I turn it on... i get that having timely updates is great, but the way to update the app on a mac is: click ok on the update dialog, wait until the download finishes, shut down the app, drag the new app over to Applications, click Replace, wait for the actual moving dialog to pop up, wait for the moving dialog to finish, minimize all your windows so you c…

This is more of a Mac problem than anything, and why I'm such a big fan of package managers.

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

#105
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.

Autocommit being off took prod down for me.

Hop in the test database, run some SQL, update a bazillion records, run some selects to verify, open the test app and verify there. All good! Someone else checks… LGTM.

So I do the same thing in prod. Make changes, validate in the DB, looks good. Open the prod app… down. Requests are hanging.

Our software is shit so I’m not surprised. I start frantically digging through trying to figure out where and why it’s hanging. Eventually chase it down to some lock wait timeouts in SQL. Start looking at the database… no queries seem to be running against the table in question. Eventually dig a little deeper and find… the call was coming from inside the house! The locks are held by my connection. Go hit “commit” in dbeaver and prod comes right back up.

And that’s the boring story of the day I learned that dbeaver used transactions in prod connections by default.

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

#106

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.

This can also bite you if your dataset is larger than the buffer pool (or whatever other RDBMS calls it), and the particular table you’re querying isn’t commonly accessed.

Turns out when you start loading millions of rows of useless data into memory, the useful data has to get kicked out, and that makes query latency skyrocket.

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

#108

I wish a DELETE or UPDATE only affected a single row by default (and perhaps even wouldn't commit if it would hit multiple rows), unless a keyword for MANY or something similar was added. Aka DELETE ALL where x == y or DELETE MANY where x == y or perhaps you need an explicit limit for it to not be 1, so DELETE where x == y LIMIT ALL

For the MySQL CLI, you can start it with —-i-am-a-dummy to get this behavior. Or —-safe-updates if you’d rather, but the former is more fun.

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

#109
post #71
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…

> if your SELECT matched no rows, the state would be empty > UPDATE and DELETE are perfectly valid actions even without a state Some may call this a fun quirk :) but I'd call it a horrible mistake in the design of the system! It should have been conceptually obvious to the designer that an empty set of rows is a perfectly valid state and is fundamentally different from "no state".

A lot of older systems were like that before they became more commodity items with guard rails.

Some of the early SAN disk arrays used to use an assembly like config interface with no sanity checks, type in the wrong command and you could wipe the whole array.

The company I worked for at the time had a blanket policy that any change had to be implemented by the vendor to shift liability for any mistakes.

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

#110

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

Same thing on a Unix/Linux level: When using find, I always do it first with -print until I see the files I want. Only then do I add the actual action I want.
Post reply on HN