Repeated Query on MySQL Log Files

Since we migrated to MySQL, we have been getting this query repeat at a high rate filling the MySQL Logs,

I tried to look in the documentation on what could be causing that (it seems it's a test query of some sort) but could not find anything , any help would be appreciated

131201 16:43:09 1382741 Query SET autocommit=0
 1382741 Query select 1
 1382741 Query select count(id) from agent where authorized = 1
 1382741 Query commit
 1382741 Query rollback
 1382741 Query SET autocommit=1
 1382741 Query SET autocommit=0
 1382741 Query select 1
 1382741 Query select count(id) from agent where authorized = 1
 1382741 Query commit
 1382741 Query rollback
 1382741 Query SET autocommit=1
 1382741 Query SET autocommit=0
 1382741 Query select 1
 1382741 Query select count(id) from agent where authorized = 1
 1382741 Query commit
 1382741 Query rollback
 1382741 Query SET autocommit=1

1 comment
Comment actions Permalink

Hello Hassan,
I'll try to explain.

The query 'select 1' is performed to ensure that the connection is still not broken. You can disable this check,
adding property testOnBorrow=true into your database.properties file.

Queries that selects data from TeamCity tables are perfrom when TeamCity works. It's how TC works.

Commits always performed at the end of successfull transaction. Even if that didn't change something (the transactions framework doesn't track weather anyone has modified data inside transaction or not). Moreover, in some RDBMS (including MySQL) even selects can capture locks, so each transaction MUST be completed by commit or rollback.

Switching autocommit on/off is not needed, it's a side effect of using Spring transaction framework. The same is for unnecessary rollbacks. You're welcome to vote for http://youtrack.jetbrains.com/issue/TW-34231

Best regards

0

Please sign in to leave a comment.