-
Hakan Kuecuekyilmaz authored
mysqlslap: setting --engine does not get replicated http://bugs.mysql.com/bug.php?id=46967 and mysqlslap: specifying --engine and --create does not work with --engine=<storage_engine>:<option> https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html ... "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ | | single | replication | +-------------------------------+--------+-------------+ | Before patch | +-------------------------------+--------+-------------+ | --engine[1] | +-----+-------------------------+--------+-------------+ | 1.1 | eng1 | OK | Not OK | | 1.2 | eng1,eng2 | OK | Not OK | | 1.3 | eng1,eng2,eng3 | OK | Not OK | | 1.4 | memory:option | OK | Not OK | | 1.5 | memory:option,eng1 | OK | Not OK | | 1.6 | eng1,memory:option | Not OK | Not OK | | 1.7 | memory:option,eng1,eng2 | Crash | Not OK | | 1.8 | eng1,memory:option,eng2 | OK | Not OK | | 1.9 | eng1,eng2,memory:option | Not OK | Not OK | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2] | +-----+-------------------------+--------+-------------+ | 2.1 | eng1 | OK | Not OK | | 2.2 | eng1,eng2 | OK | Not OK | | 2.3 | eng1,eng2,eng3 | OK | Not OK | | 2.4 | memory:option | Not OK | Not OK | | 2.5 | memory:option,eng1 | Not OK | Not OK | | 2.6 | eng1,memory:option | Not OK | Not OK | | 2.7 | memory:option,eng1,eng2 | Crash | Not OK | | 2.8 | eng1,memory:option,eng2 | Not OK | Not OK | | 2.9 | eng1,eng2,memory:option | Not OK | Not OK | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ | | single | replication | +-------------------------------+--------+-------------+ | After third patch | +-------------------------------+--------+-------------+ | --engine[1] | +-----+-------------------------+--------+-------------+ | 1.1 | eng1 | OK | OK | | 1.2 | eng1,eng2 | OK | OK | | 1.3 | eng1,eng2,eng3 | OK | OK | | 1.4 | memory:option | OK | OK | | 1.5 | memory:option,eng1 | OK | OK | | 1.6 | eng1,memory:option | OK | OK | | 1.7 | memory:option,eng1,eng2 | OK | OK | | 1.8 | eng1,memory:option,eng2 | OK | OK | | 1.9 | eng1,eng2,memory:option | OK | OK | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2] | +-----+-------------------------+--------+-------------+ | 2.1 | eng1 | OK | OK | | 2.2 | eng1,eng2 | OK | OK | | 2.3 | eng1,eng2,eng3 | OK | OK | | 2.4 | memory:option | OK | OK | | 2.5 | memory:option,eng1 | OK | OK | | 2.6 | eng1,memory:option | OK | OK | | 2.7 | memory:option,eng1,eng2 | OK | OK | | 2.8 | eng1,memory:option,eng2 | OK | OK | | 2.9 | eng1,eng2,memory:option | OK | OK | +-----+-------------------------+--------+-------------+
1ee2d817