Bug #72265 MEM tries to explain INSERT/UPDATE/DELETE type statements on a read-only slave
Submitted: 7 Apr 2014 16:59 Modified: 8 Apr 2014 4:55
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Agent Severity:S3 (Non-critical)
Version:3.0.8 OS:Any
Assigned to: CPU Architecture:Any
Tags: explain, read-only, sbr, windmill

[7 Apr 2014 16:59] Simon Mudd
Description:
MEM agents try to EXPLAIN the statements they see.
However, on a read-only slave if you have a user which doesn't have full write privileges you can not do an EXPLAIN of such a statement. It generates an error.

That leaves a lot of confusing logging in the agent log files which are rather alarming.

How to repeat:
Run MEM3 agent on a MySQL server and enable QUAN for this server.
Run enough INSERTS, UPDATEs etc to trigger the errors when QUAN tries to EXPLAIN these statements.

Suggested fix:
The error message you get is quite clear:

User has only SELECT on this table:

simon@myhost [db]> EXPLAIN FORMAT=JSON INSERT INTO some_table ( id ) VALUES ( NULL );
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement

So ideally if you can recognise the type of statement and it seems to come from the replication threads and you get this error from MySQL while doing an explain then don't treat this as a problem, and log it.

I don't know if you can catch a similar but worrying configuration of an application actually trying (and failing) to do the same statement (ie. not the replication user) as reporting that as an error would make sense.
[8 Apr 2014 4:55] MySQL Verification Team
Hello Simon,

Thank you for the bug report.

Thanks,
Umesh