MyBB Community Forums

Full Version: New Thread Contains Old Posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am seeing a new problem on the wiiboost.com forum that has been running fine for a while, but had a full restore done from the backup of the entire hosting account done a few weeks ago. This new problem only started in the last day or two, where if you post a new thread, it already has 2 or 3 old posts from a different thread. Can see the two cases of this I have seen so far at:

http://wiiboost.com/showthread.php?tid=360
http://wiiboost.com/showthread.php?tid=361

Previous new thread is also strange - post titles don't match the thread title:

http://wiiboost.com/showthread.php?tid=359

Last known good post is

http://wiiboost.com/showthread.php?tid=358

Running MyBB 1.4.8, PHP 5.2.9 and MySQL 5.0.81

Is this a known problem, or perhaps a corrupt database?
Are there any tools to check or clean up the DB or should I expect to reload a backup?

Dave
It's either the backup wasn't formed properly or something went wrong.
Firstly you should upgrade to 1.4.9 unless you want to get hacked.
As the posts have some how been assigned to different threads the best plan would be just to delete those extra posts and remake them in the thread needed.
Thanks for the fast response!

OK - upgraded to 1.4.9.

The problem is it seems to happen with every new thread - so I would have to delete a ton of old posts from the new threads on an ongoing basis, and I'm not sure if those old posts would then be lost from the original threads.
Haven't looked at your forum, but if you get old posts in new threads, chances are that you lost entries in your threads table and reset the thread id counter. So a new thread that is created, actually gets the id of an old thread, therefore it contains the posts of this old thread plus probably the new post of the new thread at the end of the thread. If this happened after a restore your backup wasn't complete or the restore failed for the threads table (and probably other tables too).

See what 'SELECT MAX(tid) FROM mybb_posts' and 'SELECT MAX(tid) FROM mybb_threads' gives you. The values should be the same... if mybb_posts is larger then you have missing entries in your threads table.
SELECT MAX(tid) FROM mybb_posts gives 371
SELECT MAX(tid) FROM mybb_threads gives 364

so I am missing 7 threads from my threads table?

Is there an easy way to find out which they are and repair the threads table?

Thanks for the help!
I have added 7 new test threads, which all show old posts, and a final 8th test thread that doesn't contain any old posts, and now both queries above return 372, so apart from having a few extra threads, I hope my DB will be ok going forward.

Is there any other problem that might show up from having missing threads? Now I actually have bogus threads in their place.
There are two possibilities...

1) Make a backup of what you have now, rename all the tables you have now from mybb_xyz to broken_xyz, reimport your old backup. Check that it is complete this time. Then pull only the new users and posts that were created in the meantime from the broken_ tables into the mybb_ tables. This requires some knowledge about SQL and how MyBB organizes its data.

2) Run a full recount & rebuild in the Admin CP, which will hopefully fix wrong firstpost / counters / etc. for the thread entries, and renew all caches. Then use moderation tools (split, join), to sort out posts that ended up in the wrong threads. This solution requires no SQL knowledge but the big question is, if the old restore lacked some entries for the threads table, were other things missing too?