← Back to team overview

maria-discuss team mailing list archive

Re: Problem in replication with NOW('2012-03-07 17:32:03')


I can't switch to statement based replication that easy. Actually, I hope that all that is obsolete if galera works out for me. I thought this NOW(timestamp) syntax was a modification coming from the binlog somehow to keep the timestamps in sync when using replication, but I remember there were some environment variables for that... I'll try to figure out where that weird syntax comes from... I am pretty sure it is an old phpmyadmin running somewhere... Is there an option in 5.2 I could set so the old server refuses that syntax at the very beginning?

Hi Jan,

The function NOW() was never supposed to take a timestamp as an argument, neither in MySQL nor in MariaDB. In earlier versions any argument was ignored. Starting from MariaDB 5.3 (and MySQL 5.6), when microseconds support was implemented, it takes an optional integer argument, which indicates a microsecond precision, so a value which cannot be interpreted as such causes a parsing error.

I'd say that the application that produces these statements should be fixed -- depending on where it takes the argument from, best case scenario is that it just does something meaningless, but it's also quite possible that it does not work as expected.

If you cannot change the behavior of the application, you might want to consider switching to row-based replication, this way you won't have a problem with the statement on newer servers.


On 2/12/2013 1:56 AM, Jan Kirchhoff wrote:

I set up 2 hosts as a galera cluster, one of them is a slave of my main

The galera hosts are 5.5.28a-MariaDB-a1~precise-log, all other databases

The 5.5 slave stops with 1064 errors. I figured this is because of
updates using NOW() on timestamp columns, I think they come from a
phpmyadmin frontend.
In the error log the queries look like this:

UPDATE ..., some_timestamp_field = NOW('2012-03-07 17:32:03') WHERE
...primary keys...

when I manually execute the query and just remove the NOW so it is a
simple update some_timestamp_field = '2012-03-07 17:32:03' and then
execute  set global sql_slave_skip_counter=1;slave start; everything is
fine again.

All 5.2 hosts replicate just fine.

is this a bug in 5.5?


Mailing list: https://launchpad.net/~maria-discuss
Post to     : maria-discuss@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~maria-discuss
More help   : https://help.launchpad.net/ListHelp

Mit freundlichen Grüßen

Jan Kirchhoff
Leitung Entwicklung / CTO

logical line GmbH
AID Aktieninformationsdienst

Hamburger Allee 23
30161 Hannover
HRB 56320/AG Hannover
Geschäftsführer: Dr. Rüdiger Lemke
Fon: +49 511 936 208 - 35
Fax: +49 511 936 208 - 11

Follow ups