we're using grafana with mysql backend and a master-master setup and we get replication errors from time to time. There is an error case when side B had a new session record after the GC was triggered on side A, leading to expiry > UNIX_TIMESTAMP(NOW()) when the statement is executed on side B (since NOW() was replaced with the actual timestamp on side A, see http://dev.mysql.com/doc/refman/5.7/en/replication-features-functions.html). As expiry is unsigned, this results in a failed query and broken replication.
The error we got:
Last_SQL_Error: Error 'BIGINT UNSIGNED value is out of range in '(unix_timestamp(now()) - `grafana`.`session`.`expiry`)'' on query. Default database: 'grafana'.
Query: 'DELETE FROM session WHERE UNIX_TIMESTAMP(NOW()) - expiry > 86400'
Hi there,
we're using grafana with mysql backend and a master-master setup and we get replication errors from time to time. There is an error case when side B had a new session record after the GC was triggered on side A, leading to
expiry > UNIX_TIMESTAMP(NOW())
when the statement is executed on side B (sinceNOW()
was replaced with the actual timestamp on side A, see http://dev.mysql.com/doc/refman/5.7/en/replication-features-functions.html). As expiry is unsigned, this results in a failed query and broken replication.The error we got:
This change fixes the out of range error.