Description:
MySql server 5.0.77 crashes at every try to execute a statement from the master binlog throwing an exception 0xc0000005 just after starting replication.
After downgrading to 5.0.67 the slave process reported an error "Slave: Error 'Incorrect arguments to NAME_CONST' on query" but the server didn't crash.
The error may be related to the incorrectly formed binlog master record regarding the NAME_CONST function parameters collation (see Bug#39182 and bug #39283) that should be corrected in version 5.0.77:
master statement:
CREATE TABLE IF NOT EXISTS test.daily_avg_level (Station INT(5) NOT NULL,DATSa DATE NOT NULL,DailyAvgLevel FLOAT NOT NULL,PRIMARY KEY (Station,DATSa)) ENGINE MEMORY
SELECT Station,DATE_FORMAT(Dat,'%Y-%m-%d') AS DATSa,ROUND(AVG(auto_hydro_1h.Stoej),0) AS DailyAvgLevel from auto_hydro_1h
WHERE date_format(Dat,'%Y-%m-%d')=date_format(DATS,'%Y-%m-%d')
GROUP BY Station,DATSa;
statement to be executed by the slave:
CREATE TEMPORARY TABLE IF NOT EXISTS test.daily_avg_level (Station INT(5) NOT NULL,DATSa DATE NOT NULL,DailyAvgLevel FLOAT NOT NULL,PRIMARY KEY (Station,DATSa)) ENGINE MEMORY
SELECT Station,DATE_FORMAT(Dat,'%Y-%m-%d') AS DATSa,ROUND(AVG(auto_hydro_1h.Stoej),0) AS DailyAvgLevel from auto_hydro_1h
WHERE date_format(Dat,'%Y-%m-%d')= NAME_CONST('DATS',_binary'2009-02-23' COLLATE 'binary')
GROUP BY Station,DATSa
How to repeat:
In a master-slave configuration version 5.0.77 create a stored routine on the master with one parameter variable YYY of type DATE, containing a select statement with use of the construction "WHERE date_format(xxx,'%Y-%m-%d')=date_format(YYY,'%Y-%m-%d')". The server where the slave process is running will keep crashing.
Suggested fix:
To see if bug 39283 is not appearing in connection with NAME_CONST parameters collation when DATE type is passed to a stored routine