Developer scored huge own goal by deleting almost every football fan in Europe
Fiddling with the production database – what could possibly go wrong?
Who, Me? Monday mornings are a nasty time of week that can be redeemed by two things: bantering about weekend sporting results, and reading another edition of "Who, Me?" – The Register's weekly column that shares your stories of dropping the ball at work but somehow recovering for at least an honorable draw.
This week, meet a reader we'll Regomize as "Pete" who told us of the time he worked for a news and sport website that faithfully reported the result of every major sporting event, and plenty of minor ones too.
"The information for each football match contained lots of statistical data, including the attendance," Pete told Who, Me? All the info was stored in what he described as "a fairly straightforward MySQL database, with unsurprising names."
A table named "MATCH," for example, had fields for "RESULT" and "ATTENDANCE."
"All the data came in XML files, which were parsed by a Perl program and the MySQL database updated," Pete explained.
The site ran smoothly until the day one of the staff journalists pointed out that one match report listed the crowd as zero.
The journalist had attended the match and, even though it was a very minor fixture, felt his estimate of the crowd – 450 hardy souls – should be faithfully recorded.
Pete checked his code, noticed an error in the way it parsed files that had produced the absent crowd, and set about making a fix.
In the production database.
Of course he made a mistake and changed the attendance for every match in the database to 450.
Cup Final? Pete's site said only 450 showed up. Sold-out derby between ancient enemies? Only 450 fans could be bothered. Televised match with heaving stands? Your eyes deceived you, as Pete's site told you the fixture attracted just 450 spectators.
- Static electricity can be shockingly funny, but the joke's over when a rack goes dark
- Dev loudly complained about older colleague, who retired not long after
- Tech trainer taught a course on software he'd never used and didn't own
- After three weeks of night shifts, very tired techie broke the UK's phone network
Pete realized it was only a matter of time before readers of the site would complain about the inaccurate data.
"The good news for me was that all the original XML files were in a backup directory I could access," he told Who, Me? All Pete had to do was find a way to extract the right attendance values from those files – which covered every event the site had ever reported – and overwrite the incorrect attendance figures.
Perl was Pete's weapon of choice, and he scripted a solution to scour the backups and create a file listing the correct attendance values. All that remained was to import them to the production database.
Which worked.
"As far as I can tell, nobody noticed," Pete told Who, Me?
What happened when you messed with the production database? To share your story, click here to send an email to Who, Me? Our mailbag is close to empty again, so please share a story! ®