Hey, where did my comment go?

Hey, where did my comment go? post image

There’s a saying in the IT world: “If it ain’t broke, don’t fix it!” or perhaps that’s just the advice my Dad gave me.

Either way, I failed to follow that advice and things have gone wrong. An innocuous little tweak has ended up with over half of the posts on this site disappearing.

Oddly (or typically if you work in IT) reversing the very small change I made does not seem to solve the problem, which is a major pain.

Not to worry, I do at least take regular backups of this site, so it should just be a matter of restoring from the backup immediately prior to the change I’d made. Unfortunately, nothing in IT is ever that simple. I kept getting WordPress backup import restore errors like this:

> Duplicate entry ‘15878’ for key ‘PRIMARY’

For some reason the backups I took duplicated many of the comment records, actually in the .sql.gz backup file. I have no idea why this happened, but I had to manually remove the duplicates by deleting one of the offending duplicate INSERT sql statements. Here’s an example of an offending line (email address changed):

INSERT INTO `wp_comments` VALUES (15878, 192, ‘Eric’, ‘eric@eric.com’, ‘Eric’s comment was here’, 0, ‘1’, ‘Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2’, ”, 0, 0, ‘N’, ‘0’);

The really annoying thing was that there’s no way to tell which comments were duplicated without just trying to do the import. This was the process I had to follow, on the database’s Import tab in phpMyAdmin from the cPanel:

– Select the .sql.gz backup file for import
– Click GO
– Wait for it to upload and start the import
– Check the error for the primary key number it was moaning about.
– Unzip the .gz file to get the .sql
– Edit the .sql file and search for the offending primary key number
– Delete one of the duplicates
– Save the .sql file
– Find the .sql file in Windows Explorer and zip it up, ensuring it’s .gzip format
– Repeat the import process

That’s it, for each duplicate, of which there were over 10!

Anyway, the long point of this post is that if you posted a comment on this bloc between 22nd May and 23rd June, it’s probably gone. I’m very sorry about that, as I do appreciate and read every comment that’s posted. Please re-post it.

{ 0 comments… add one }

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.