Dear LazyWeb, autoconf and #define HAVE_ 0

How do I make an existing project (let’s say, MySQL) switch from generating a config.h that has #undef HAVE_FOO to one that generates #define HAVE_FOO 0 instead?

Why? Well, here’s why:

Testing for features should be done by including “config.h” and using #if HAVE_<feature>. Use of #if (rather than #ifdef) allows the gcc -Wundef flag to warn users about features which aren’t defined 1 or 0 in config.h.

default filesystem and disk parameters are for wusses

I can’t remember the last time i used default mkfs or mount options… oh yeah, that’s right – by accident.

Anyway… I did a little experiment today.

The filesystem is my laptop /home – XFS, 100GB, 95% used (so 5-6GB free), rather aged. This is where a lot of my MySQL development is done. Mkfs options: 128MB log, version2 log. Mount options: logbufs=8, logbsize=256k. All of this geared towards increasing metadata performance.

Why metadata performance? well… source code trees are a lot of metadata :)

So, let’s try some things: cloning a repository and then removing the repository.

Two variables are being tested: mounting the file system with nobarrier (or barrier, the default). Write barriers tell the disk to ensure write order to the platter when write cache is in use. Also testing disabling (or enabling, the default) the disk write cache.

cloneperf1.png

rmperf1.png

NOTE: the last option which has the write cache enabled and write barriers disabled is NOT SAFE. If your machine crashes, you loose data, and potentially your file system ends up corrupted.

So I’m now disabling my disk write cache and mounting with nobarrier.

If you use real disk arrays – e.g. battery backed write cache RAID boxes, the story is likely very different!

Going to MySQL User Conference? Come to LugRadio Live!

LugRadio is possibly the best Linux/Free Software related podcast out there – and it has been for a very long time. LugRadio Live is a live event where lots of people gather together to love freedom.

This year, there’s a LugRadio Live USA – and it’s in San Francisco. So, are you going to be (or are able to be) around SF the weekend before the MySQL UC? If, there is no excuse not to drop in on LugRadio Live USA – it should be awesome! (oh, and it doesn’t cost much… like $10 or something)

Windows finally gets poll() (well…WSAPoll)

Found this today: Windows Core Networking : WSAPoll, A new Winsock API to simplify porting poll() applications to Winsock.

Which means we should be able to squeeze some peformance out of Vista. Although, since poll() we’ve gone and moved on to much better things in the free world.

As part of porting MySQL Cluster to Microsoft Windows platforms, I’m going and redoing a lot of the portable sockets code in MySQL. My goal is to have enforcing of proper use of the portable functions be done by the compiler instead of the programmer – leading to less portability bugs.

Let’s face it: friends don’t let friends have to run Windows to not break the Windows port.

Good news is that so far I’ve found several bugs that could have presented them in real nasty ways at run time but have instead showed up as build errors – brilliant!