MySQL bug in Mercury on Ubuntu has comments incorrectly ordered in the core comments block

Events happening in the community are now at Drupal community events on www.drupal.org.
burningdog's picture

I'm responsible for some big sites for a publishing company based in Cape Town, and we're in the process of testing Project Mercury so we can move the sites to it. Very cool - I like the idea of having a best practice for scalable drupal sites. However, I've hit some snags.

Php isn't compiled with GD (imagecache needs it), PECL Upload progress (for monitoring file upload progress) or mcrypt (a requirement for phpMyAdmin). Our sysadmin has recompiled php with all of these in it, and will add to the Ubuntu PPA - will post a link once that's done and you can check it out. Not sure why these aren't added into the version Mercury uses?

The mysql version Mercury uses on Ubuntu is 5.1.41. Unfortunately, that version has a bug in which descend sorting does not work in some special cases. This happens after importing a db dump and where the query uses a WHERE and adds a LIMIT after DESC, which happens in the comment module (line 325) when db_query_range() adds a LIMIT after the query.

I first noticed that something was amiss when the comments ordering in the core comments block was wrong. Tracking down the error led me to line 325 in the comments module.

Incorrect behaviour: ... ORDER BY c.cid DESC LIMIT 10 <- gives an ascending order
Correct behaviour: ... ORDER BY c.cid DESC <- gives a descending order

Bug report on mysql.com: http://bugs.mysql.com/bug.php?id=51431
Commit which fixes it: http://lists.mysql.com/commits/112578

All mysql versions from 5.1.49 have this bug fixed. The latest mysql version we can find for Ubuntu is 5.1.48 - https://launchpad.net/~ubuntu-server-edgers/+archive/server-edgers-mysql... Building it ourselves failed - we've asked the maintainer if he wouldn't mind updating.

Unless anyone here is skilled in that sort of thing?

Comments

Greg Coit's picture

Roger,

Thanks for the heads up!

We try to use default OS packages as often as possible to minimize maintenance and security issues. The lack of compiled GD on Ubuntu has been an issue for a couple of years now but I wasn't aware of the missing PECL Upload progress and mcrypt issues.

We'll keep an eye out for updated mysql versions.

Greg

--
Greg Coit
Systems Administrator
http://www.chapterthree.com

Thanks Greg - would it be

burningdog's picture

Thanks Greg - would it be useful if I put the compiled versions of php and mysql I'm using on the Ubuntu Launchpad PPA?

Update

burningdog's picture

Now that we're using mysql 5.1.50 on Mercury, I've moved across one site onto the server, and it's snappy :) Next up: testing more than one site (not multi-sites, rather completely separate sites with separate codebases).

Just to be clear about the

brianmercer's picture

Just to be clear about the problem...

I assume from your mysql version that you're running on Ubuntu 10.04.

Ubuntu does not compile mcrypt or gd into PHP but instead installs them as sharable modules. To install them you'd do

sudo apt-get install php5-mcrypt php5-gd

There is no need to recompile PHP for those. What Greg is referring to about GD is the fact that Debian/Ubuntu uses the official GD library, which has fewer features than the modified GD that the PHP.net project bundles with PHP. (and you get an imagecache warning, which is annoying) It's an ongoing debate, but that's Debian's policy. Some folks do recompile PHP to get the extra features of the "bundled" GD.

As for PECL uploadprogress, the Debian/Ubuntu way to install that is

sudo apt-get install php5-dev php-pear

and then
sudo pecl install uploadprogress

Debian doesn't make apt packages of all the popular PECL extensions, but there is a Debian helper script in the dh-make-php package for converting PECL packages to apt packages. I used it for my php5-xhprof package and it works fairly well with some tweaking.

If you're installing something to several servers, especially if you update it often, it's easier to debianize the PECL package or updated software and then use apt and a Launchpad repo to distribute them to your servers. And other people can use it, of course.

Brian Mercer
my Launchpad Repo: https://launchpad.net/~brianmercer

Mercury

Group organizers

Group categories

Post Type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: