MySQL table crashed today

[email protected] (Brett Bieber) Wed, 19 Oct 2011 08:57:38 -0500
Newsgroups php.pear.webmaster
Message-ID <CAF6z_LJV+bNJKzLwifsfdsMHO+rvJP1rLZnRbKkK5RhzLzNXVA@mail.gmail.com>
Users on #PEAR, and the pear mailing list, reported an error downloading
packages today.

I logged into the server, and looked in the httpd error_log, and noticed two
errors immediately:

[Wed Oct 19 15:41:31 2011] [error] [client XXXXXX] PHP Fatal error:  Call to
a member function getLastActivity() on a non-object in
/var/www/html/pearweb/pear.php.net/public_html/bugs/report.php on line 480
[Wed Oct 19 15:41:34 2011] [error] [client XXXXXX] pearweb errorhandler: DB
Error: unknown error... \n            SELECT\n                packages.name,
releases.version, downloads,\n
downloads/(CEIL((unix_timestamp(NOW()) -
unix_timestamp(releases.releasedate))/86400)) as d\n                FROM
releases, packages, aggregated_package_stats a\n
WHERE\n                    packages.name <> "pearweb"
AND\n                    packages.name <> "pearweb_phars"
AND\n                    packages.id = releases.package
AND\n                    packages.package_type = 'pear'
AND\n                    a.release_id = releases.id AND\n
a.package_id = packages.id AND\n                    packages.newpk_id IS
NULL AND\n                    packages.unmaintained = 0
AND\n                    a.yearmonth = "2011-10-01
00:00:00"\n                ORDER BY d DESC LIMIT 0, 5 [nativecode=145 **
Table './pear/aggregated_package_stats' is marked as crashed and should be
repaired], referer: XXXXXXXX

I stopped Apache, logged in as mysql root, and ran:
> repair table pear.aggregated_package_stats;

After that, started Apache again, and the website appears to be functioning
correctly.

It would appear that the package download statistics, which are stored in
the db, could interfere with package downloads in the event that the
database fails. Perhaps we should look into alternative ways of storing the
download statistics?

-- 
Brett Bieber