0

I enabled my general log to check some of the queries in my database and i found out that there are inserts on my selects db (using a master slaves where inserts are on master and selects on slave). Now they all came from connection id 1 but apparently i cant find the connection log actually happening. So i was wondering, maybe its just the slave replication connection? Basically inserts should happen on slave through the binlog but i didnt figure it would be written in my general log... Thank you very much

0

If your server is running the MySQL Event Scheduler, and the event scheduler hasn't been disabled and re-enabled since the server was last restarted, the event scheduler "daemon" will be on connection 1.

mysql> SELECT * FROM information_schema.processlist WHERE id = 1;
+----+-----------------+-----------+------+---------+------+-----------------------------+------+
| ID | USER            | HOST      | DB   | COMMAND | TIME | STATE                       | INFO |
+----+-----------------+-----------+------+---------+------+-----------------------------+------+
|  1 | event_scheduler | localhost | NULL | Daemon  |   90 | Waiting for next activation | NULL |
+----+-----------------+-----------+------+---------+------+-----------------------------+------+
1 row in set (0.00 sec)
| improve this answer | |
  • And what is the meaning of inserts by this connection? I tried making an insert on the master and it was written on the slave log aswell with connection 1, but can i be sure this is it? Thank you for your answer. – user69153 Sep 29 '15 at 23:50
  • Hmmm. No, if the inserts in the master are showing on the slave as connection 1, that would not be the event scheduler. Can you update your question with an example of the general log entry? Also SELECT @@BINLOG_FORMAT; on the master and include the output. – Michael - sqlbot Sep 30 '15 at 2:51
  • I think its statement based (not in the office till Tuesday but pretty sure it is). Is it even reasonable that inserts on the master will be written in the slave log? I mean those inserts obviously happen but its wierd to me that they are written in the log – user69153 Sep 30 '15 at 23:26
  • When using statement-based binary logging on a replication master server, statements received by its slaves are written to the query log of each slave. dev.mysql.com/doc/refman/5.6/en/query-log.html ... not so strange, for statement mode (which I rarely use, so wasn't sure). If the slave sql thread is connection 1, mystery solved, but that seems a little unlikely; also, I would have assumed the pseudo-thread-id, copied from the master, would be the logged id (that is how SBR keeps temp tables straight among events) but perhaps not. – Michael - sqlbot Oct 1 '15 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.