Interview Questions

A Guided Tour Of The MySQL Source Code

MySQL source code off the Internet. Then we'll get a list of the directories and comment on why they're there. Next we'll open up some of the files that are vital to MySQL's working, and comment on specific lines in the source code. We'll close off with a few pictures of file formats.

BitKeeper

We want to download the latest, the very latest, version of the MySQL server. So we won't click “Downloads” on the MySQL Developer Zone page — that's usually a few weeks old. Instead we'll get BitKeeper (tm), which is a revision control package, vaguely like CVS or Perforce. This is what MySQL's developers use every day, so what we download with BitKeeper is usually less than a day old. If you've ever submitted a bug report and gotten the response “thanks, we fixed the bug in the source code repository” that means you can get the fixed version with BitKeeper. First, log on to www.bitkeeper.com and register. One way is:

  • Click “Downloads” which takes you to the downloads page
  • Click on “Software download form”
  • Fill in all the fields, including the Platform name, which was “Linux/x86 ...” for us, but you'll be okay with other choices. Like MySQL, BitKeeper is available on many platforms, so the details will vary here.
  • Submit the form. Then you'll have to wait until BitKeeper mails you some more instructions, which are actually quite simple. There is no fee to use BitKeeper for downloads of open-source code repositories like MySQL's. After you have BitKeeper, you'll be able to clone. That is, you'll be able to get a copy of the source code, using a statement that looks like this:
  • ... that is,
  • Start a shell
  • On the shell, make a directory named (say) mysql-5.0:

(The $HOME directory is usually your personal area that you're allowed to write to. If that's not the case, replace $HOME with your personal choice whenever it appears.) There is a lot of code, so the first time you do this the download will take over an hour. That's if you're lucky. Glitches can occur, for example the 'bk' command fails due to a firewall restriction. If you're glitch-prone, you'll need to read the manual: Section 2.8.3, Installing from the Development Source Tree.

On later occasions, you'll be doing what's called a “bk pull” instead of a “bk clone”, and it will go faster. Typically a “bk pull” takes 10 minutes and is glitch-free.

Directories, Alphabetical Order

After bk clone finishes and says “Clone completed successfully” you'll have 40 new sets of files on your computer, as you'll be able to see with ls or dir. These will all be installed as directories below the $HOME directory. At first all these directory names might intimidate you, and that's natural. After all, MySQL is a big project. But we're here to show you that there's order in this apparent chaos.


Pragna Meter
e-University Search
Related Jobs