Comment On Classic WTF: Don't Worry, We'll Fix It!

I'm at the Business of Software conference in San Francisco this week and thought it'd be the perfect opportuntunity to revisit a classic. Don't Worry, We'll Fix It! was originally published on November 28, 2006. [expand full text]
« PrevPage 1 | Page 2Next »

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:05 • by poo (unregistered)
begin transaction?

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:08 • by Adam Robinson (unregistered)
Jane could hear the murderer chasing her through the woods, his heavy boots crushing every fallen limb and smallish woodland creature in his path. Just as she was on the edge of escape, he rounded the corner and...

Jane's day was about to get much, much worse.

The end!

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:13 • by highphilosopher (unregistered)
The murderer could hear his victim just in front of him, the blood rushing through his veins hot like the wind. As he rounded the corner he gasped in horror as the shotgun in her hands made that all to familiar sound.

the murderer's day was about to get much, much worse.

the end

captcha suscipere -- to peer suspiciously.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:17 • by Drew (unregistered)
So you restore from back up and move on with your life? Or is there a bigger WTF at work here?

Also, Time Servers aren't hard to set up.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:21 • by Not so cool (unregistered)
While foraging on the ground, the squirrel heard two tall, two-legged mammals running through the woods, making quite a racket. He scurried partway up a tree to ready his escape, but curiousity got the better of him.

While it debated whether to flee around to the far side of the tree or not, he saw the larger mammal closest to him leap to one side, revealing the other two-legged mammal pointing a strange thing in his direction.

The squirrel's day was about to get much, much worse...

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:23 • by baka0815 (unregistered)
Never remove any data if there could be the slightest possibility you'll need it later.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:25 • by Fenris (unregistered)
290299 in reply to 290295
Drew:
So you restore from back up and move on with your life? Or is there a bigger WTF at work here?

Also, Time Servers aren't hard to set up.


Forget Time Servers, how hard is to keep two dates in a record, business date, and real date. As business date is meaningless, always keep a real date around.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:31 • by SQL cowboy (unregistered)
rollback transaction

and FIRST !

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:33 • by BSDGuy (unregistered)
290301 in reply to 290300
date();

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:35 • by Spivonious (unregistered)
The acorn was peacefully sitting on his tree branch, as he had done the past three months of his life. "What a wonderful day" he thought, as he welcomed the morning sun. Suddenly he felt the pressure of a squirrel's feet on his branch.

The acorn's day was about to get much, much worse.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:37 • by Frank (unregistered)
Am I the only one who fears the statement "Restore from backup", knowing full well that the jackass who is in charge of the backups isn't necessarily always fully competent and most companies refuse to take the downtime / setup the environment to test the backup sets fully?

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:38 • by Alex (unregistered)
290304 in reply to 290292
poo:
begin transaction?

BEGIN TRANSACTION doesn't help when what you do is normal. If you purposefully delete data (Remember. The server thought all it deleted was outdated) either you don't do a transaction at all or you would have commited at the end: You *WANTED* to delete thingys.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:54 • by Jay (unregistered)
Putting aside the fact that such a big system must have had backups...

Purging old data at that point might be one of the worst WTFs I've heard. The deleting of Transactional data should be managed by an admin app by someone responsible!

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:54 • by Nice try (unregistered)
290307 in reply to 290298
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:57 • by dpm
The programmer settled back in his chair and surfed his daily sites, reading comics and checking news, then clicked on the link to thedailywtf.com, hoping to see a good CodeSOD or an entertaining Interview Tale. Just as he was sipping his coffee, the "Classic WTF" banner appeared on his monitor . . .

The programmer's day was about to get much, much worse.

The end!

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 09:59 • by highphilosopher (unregistered)
290309 in reply to 290307
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL



UPDATE [table] SET [deleted] = 1 WHERE [CreatedDate] < '20091110 00:00:00'

Like that.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:03 • by A Developer (unregistered)
290310 in reply to 290307
INSERT INTO TableName_BAK SELECT * FROM TABLENAME WHERE TRANS_DATE < (SYSDATE - INTERVAL '3' YEAR);
DELETE FROM TableName WHERE TRANS_DATE < (SYSDATE - INTERVAL '3' YEAR);
COMMIT;

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:10 • by Gramma (unregistered)
I think I like the philosopher's method over the developer's.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:13 • by Brompot (unregistered)
290312 in reply to 290310
Assuming each statement takes a significant amount of time using 'SYSDATE' twice may produce a set of records that are deleted, but not copied.

So you put sysdate into a variable and then use that variable in your statements.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:15 • by Anonymous (unregistered)
Seem to be a lot of classics lately. Still, this was always one of my favourites. It perfectly represents that "oh...... shit" moment when you realise that a well thought out feature was not so well thought out after all. For fifteen years, no-one had thought twice about the "purge items older than 3 years" functionality. But one trivial operator error was all it took for that functionality to wipe out a store's entire transaction history. Suddenly, with the power of hindsight, the auto-purge mechanism is shown to be a gaping hole in the entire system's data integrity. Ouch. Facepalm just doesn't cut it.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:18 • by The guy (unregistered)
290314 in reply to 290307
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL


In SQL:

Don't delete anything automatically! Only delete based on a real user's explicit request. At the very minimum, ask the user if they really want to delete the data...

Automatically deleting data without a prompt instead of archiving or something else non-destructive is TRWTF.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:18 • by A Nonny Mouse
so... copy the one day's data somewhere else, restore the db from backup, import one day's data as yesterday. voila.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:19 • by Anonymous (unregistered)
290316 in reply to 290292
poo:
begin transaction?
The transaction did begin. And then it ended. All normally. This was normal functionality, not an error condition or exceptional circumstance. The software was doing exactly what was programmed to. Transactions have no relevance to this story.

Post #4

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:19 • by SCB (unregistered)
290317 in reply to 290307
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL

My turn...

DELETE FROM [table] WHERE 1 = 0

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:26 • by Ike (unregistered)
290318 in reply to 290306
Hasn't anyone heard of validating the input data? How about "That transaction date is three years in the future! Did you really want to use it?" YES NO FILE_NOT_FOUND

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:29 • by YourName* (unregistered)
290319 in reply to 290312
Brompot:
Assuming each statement takes a significant amount of time using 'SYSDATE' twice may produce a set of records that are deleted, but not copied.

So you put sysdate into a variable and then use that variable in your statements.


iirc sysdate is read-consistent in an oracle transaction.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:32 • by Swa (unregistered)
if you want to remove stuff 3 years old from a database (i suspect for performance & size restrictions?), you archive it to another database first and then remove it from the primary database. it really aint all that hard.

as for the date screw-up on programmer side? i've seen worse.

the suggested solution of getdate() functions (or variations thereof) might also go haywire if for instance your motherboard fried, you swap it with another unit, but your battery was dead. you didn't bother to check the bios, you boot up with the years old default date & blam, you could be in trouble. now, with this particular app it wouldn't be an issue (since it only deletes "3y older than x"), but relying on getdate() isn't perfect either.

tl;dr: you shouldn't base a delete transaction on a getdate() statement.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:44 • by bored (unregistered)
290321 in reply to 290308
dpm:
The programmer settled back in his chair and surfed his daily sites, reading comics and checking news, then clicked on the link to thedailywtf.com, hoping to see a good CodeSOD or an entertaining Interview Tale. Just as he was sipping his coffee, the "Classic WTF" banner appeared on his monitor . . .

The programmer's day was about to get much, much worse.

The end!


Win!

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:48 • by frederick
290322 in reply to 290320
Swa:
tl;dr: you shouldn't base a delete transaction on a getdate() statement.


No, you shouldn't. Even if the date was only one year in the future, not three, you'd still purge a year's worth of records. Worse, that one you wouldn't necessarily notice right away, making it that much harder to figure out WTF happened.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:52 • by Patrick (unregistered)
290323 in reply to 290295
Drew:
So you restore from back up and move on with your life? Or is there a bigger WTF at work here?

What backup? We don't need no steenkin backup! Not when we have a database server! Just run one of those undelete things.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:53 • by lolwtf
Guys, we're in a bit of a jam. We accidentally posted in 2009 an article already published in 2006.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 10:57 • by dpm
290325 in reply to 290324
lolwtf:
Guys, we're in a bit of a jam. We accidentally posted in 2009 an article already published in 2006.
(Applause)

I wondered if anyone else would notice that.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:00 • by akatherder
290326 in reply to 290325
Did you notice that they deleted the comments from all previous WTFs too?

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:07 • by Ken B (unregistered)
290327 in reply to 290307
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.
Now express that in SQL
REVOKE DELETE ON TransactionTable FROM *

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:09 • by Harrow (unregistered)
The client's MIS manager squinted at me skeptically. "Are you sure? Nothing like this has ever happened before."

"I'm quite sure. Your data is gone," I said. "It's not in the working set and it's not in the archived set. That kind of thing worries me. What if it's nowhere?"

The manager dismissed my concerns with an airy wave of his paw. "Pish. Here at Initrode, we backup." He leaned back expansively. "I've been doing daily backups religiously for fifteen years."

"Have you ever done a restore?"

The manager sat forward. "A what?"

The MIS manager's day was about to get much, much worse.

-Harrow.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:10 • by Patrick (unregistered)
290329 in reply to 290311
Gramma:
I think I like the philosopher's method over the developer's.

They both have their pros/cons.

Philosopher's method is quick and doesn't require a second table as a mirror. However, if columns are added/changed, the entire dataset will have to be updated. The table's file will also have to be backed up in ever-increasing storage, and retrieval will have more and more data to sort through.

Developer's method can use the "Archive" storage engine (if using MySQL) for the second table. After a certain number of records, another archive table can be created incrementally, so future backups don't have to worry about data files who's values don't change. However, archive tables are uneditable, so changes to the table structure will have to result in a new table. Also, restoring from the archive will have to be a copy-to-active-table > copy-remaining-to-new-archive > delete-old-archive operation.

Automated data pruning is only good for information that was intended to be temporary in the first place, like session IDs. Doing it on a "hot" dataset based on random values(read: user input) is bad bad bad.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:12 • by Patrick (unregistered)
So, you can submit comments fine by pressing Enter on the captcha field, but clicking the submit button breaks it. Interesting.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:12 • by SarahE
290331 in reply to 290317
SCB:
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL

My turn...

DELETE FROM [table] WHERE 1 = 0

Almost the same as what I was going to do...
DELETE FROM [table] WHERE HellTemp <= 0

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:19 • by averageGuy (unregistered)
How about:
- Setting the default business date to today or tomorrow depending on a flag in the site configuration so the user is less likely to screw it up
- Validating that the business date is reasonable (for example: today +/- 1 day)

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:20 • by Crabs (unregistered)
I don't understand why they didn't use SYSDATE (or similar) to figure out when to purge the data. Why use the transaction date? Why would you purge data 3 years before a transaction date, which you can set to anything, instead of 3 years before the actual date (or at least the date on the server)?

I won't worry about the fact that their purging data. There's tons of reasons that they could be doing that, even though it's not "best practice".

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:40 • by Anonymous (unregistered)
290334 in reply to 290330
Patrick:
So, you can submit comments fine by pressing Enter on the captcha field, but clicking the submit button breaks it. Interesting.
No, it may look that way but you'll find that there is no rhyme or reason to the errors, you just get them periodically. Sometimes it takes 4 or 5 submission attempts before it actually works and submits your post. The rest of the time you'll see the "an error has occured" page. It's been like this for a few months now.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:41 • by Outtascope (unregistered)
290335 in reply to 290330
Patrick:
So, you can submit comments fine by pressing Enter on the captcha field, but clicking the submit button breaks it. Interesting.


I'm sure the enter button will be fixed in no time.

Captcha genitus - Condition caused by the over "use" of internet porn.

(Yep, enter seems fixed, 3rd try)

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:42 • by avflinsch
290336 in reply to 290307
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL


delete from table_foo where field_bar is null and field_bar is not null;

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 11:48 • by Bob (unregistered)
I'm with highphilosopher, never delete anything, ever. Storage is cheap.

insert into archive (select * from mytable where deleted=1)

delete from mytable where deleted=1

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 12:08 • by DCRoss
290339 in reply to 290324
lolwtf:
Guys, we're in a bit of a jam. We accidentally posted in 2009 an article already published in 2006.


It's 2009? Great, now I can finally return that toaster I bought back in 2006.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 12:10 • by Zach Bora (unregistered)
290340 in reply to 290299
Fenris:
Drew:
So you restore from back up and move on with your life? Or is there a bigger WTF at work here?

Also, Time Servers aren't hard to set up.


Forget Time Servers, how hard is to keep two dates in a record, business date, and real date. As business date is meaningless, always keep a real date around.


Except when your system date is wrong, then you`re fckup...


I've had a similar problem myself. The user date system was dd/mm/yy instead of mm/dd/yy and when it saved it was saved in the future. We usually prefer the yyyy-mm-dd format, it can't go wrong... except if your clock is set to a.m. instead of am, but that's another story.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 12:11 • by akatherder
290341 in reply to 290337
The system date is only as good as the date on the server. Stranger things can screw up with that at exactly the wrong time.

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 12:18 • by Blue Collar (unregistered)


I bet ya it wasn't the getdate function... i bet it was the Cashier doing SQL Injection from that REGISTER!!

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 12:21 • by Woof (unregistered)
290343 in reply to 290307
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL

delete from sql_keyword_table where keyword like '%delete%';

Re: Classic WTF: Don't Worry, We'll Fix It!

2009-11-10 12:29 • by JohnB (unregistered)
290344 in reply to 290331
SarahE:
SCB:
Nice try:
baka0815:
Never remove any data if there could be the slightest possibility you'll need it later.


Now express that in SQL

My turn...

DELETE FROM [table] WHERE 1 = 0

Almost the same as what I was going to do...
DELETE FROM [table] WHERE HellTemp <= 0
It could happen: H-ll, MI

Still trying after multiple reports of "spam" (fixed by replacing an "e" with a "-")

« PrevPage 1 | Page 2Next »

Add Comment