June 5, 2007

MySQL duplicate values due to multiple my.cnf

As we all know, MySQL reads all its individual component configurations from the my.cnf file. The problem is if you have a custom build and installed the binaries with prefix; then that $prefix/etc is also added to the list of paths for searching the my.cnf

We at Yahoo! has the same scheme; where all MySQL installation goes to /home/y and yahoo setup of my.cnf file is installed to /home/y/etc/my.cnf and a symlink is added in /etc/my.cnf.

With the above setup, when you start the mysqld server, it actually reads both the files from /etc/my.cnf and /home/y/etc/my.cnf in the same order.

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf /home/y/etc/my.cnf
The following groups are read: mysql_cluster mysqld server mysqld-5.1</blockquote>

That seems reasonable. The problem is; there are few config parameters which can repeat with different values like Replicate-Wild-Do-Table and Replicate-Wild-Ignore-Table. As MySQL reads both the files and the values are actually repeated as duplicates. For example; for the above parameters, when you run SHOW SLAVE STATUS you will get duplicate values:

Replicate_Wild_Do_Table: test.%,venu.%,test.%,venu.%

I still think this is a bug in MySQL. They should avoid the duplicate values for the same parameter even if they read it multiple times. One solution for this is explicitly passing –defaults-file=#, so that it limits to one particular file.

June 3, 2007

Visual studio 2005 – Adding a .def file

Recently am playing with a DLL project on Windows using visual studio 2005 on Windows Vista 32-bit (its sp1 with vista extentions installed, 8.0.50727.867). When I needed to insert a .def file to the project, it is prompting with an error; which I never seen….the error is not even an error…looks like internal error or kind of assert as in the screen shot below:

Something is wrong..now I need to find a way to add .def file so that I can export some functions as API.