Monty Taylor: Changes in Option Processing

Change is in this air this summer in Drizzle-land. One of our GSoC students, Vijay Samuel, has been hard at work replacing the options processing system we inherited from MySQL, my_getopt, with one based on boost::program_options. We've been merging his work in to trunk for a while now, and he's made really excellent progress, so it's probably about time to point out how the new system will be different from the MySQL one. There are three main changes afoot here, and I'm actually pretty pleased with all three of them:

 

  1. Plugin Option Prefixing
  2. Dashes v. Underscores
  3. Config Files

 

A few of these changes are still in the middle of their transition, so I'm just going to describe the finished system, but we've essentially got all of the client programs and most of the plugins done at this point. 

Plugin Option Prefixing

In the old system, when a module re! gistered a new option or variable, we would concatenate the module's name on to the front of the option name with a "_". So, for instance, the mysql_protocol module has an option for setting the port, which wound up being named "mysql_protocol_port". In the new system, boost actually understands grouping and namespacing of options, and we decided to take advantage of that by mapping a plugin module to a group. This means that the concat character is now a "." (that's a dot if your eyesight is bad)

Dashes v. Underscores

In addition to that, boost doesn't know anything about the long-standing MySQL tradition of going out of the way to allow you to do things as many ways as humanly possible. To Boost, the strings "mysql_protocol" and "mysql-protocol" are, well, different. We considered writing a parser plugin for it to do normalization for us, but then we made the other decision.

Dashes and Underscores are dif! ferent.

Now this may royal screw some people who may have enjoye d making art by listing an option like "auto-increment_increment" before, and to those people I'm sorry, because I really do like injecting art into day to day life. Nonetheless, from this day forth let the decree be heard...

Options have all been normalized to use no underscores and to use only dashes.

On the off chance you can't follow the logic there, that means that the command line option for setting the MySQL protocol port in Drizzle is now: --mysql-protocol.port=3306

Config File Changes

But wait, there's more...

First of all, we changed from having one master config file for everything with sections in it for different programs to having one config file per program. drizzled will read "/etc/drizzle/drizzled.cnf". The command line clients will also read a few more, since you might want to repeat yourself - so drizzleddump will read ~/.conf/drizzle/drizzledump.cnf, ~/.conf/drizzle/client.cnf, /etc/drizzle/drizzledump.cn! f and /etc/drizzle/client.cnf, with files listed first in that list overriding values in files later in the list. (In case you're wondering about the ~/.config part, it's part of the freedesktop.org Base Directory Specification. Since we didn't have a system for this before, it seemed sensible enough to just follow the standard for user/client utilities here.

The files are still mostly ini-style files, except they do not require a base [section] header. So just stick "datadir=/var/lib/drizzle" into /etc/drizzle/drizzled.cnf and you're off to the races. However - remember that grouping thing I mentioned before- in the boost world, section headings translate to option prefixes joined by, you guessed it, a dot. This means you can do:

datadir=/var/lib/drizzle 
[innodb]
buffer-pool-size=100G
log-file-size=1M 
And be good to go. We're also thinking about having /etc/drizzle/${plugin_name}.cnf added for each plugin... but ! haven't actually looked at what that will look like yet, so don't hold me to that.

URL: http://inaugust.com/post/81



_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to