log_slow_slave_statements doesn't work

Bug #379115 reported by Aleksandr Kuzminsky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona patches
Fix Released
Medium
Unassigned

Bug Description

Queries issued on a master are not logged on a slave's slow log.

From mysq-test test(microslow_innodb_log_slow_slave_statements):
..
connection master;
CREATE TABLE t1(
  id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
  name VARCHAR(255)
  );
INSERT INTO t1(name) VALUES('aaa');

connection slave;
SELECT * FROM t1;
...

The test was run as:
./mtr --record --mysqld=--log_slow_slave_statements=1 microslow_innodb_log_slow_slave_statements

The slave's slow log(CREATE and INSERT are missing in it):
SET long_query_time=0;
# User@Host: root[root] @ localhost [127.0.0.1]
# Thread_id: 2 Schema: test
# Query_time: 0.000401 Lock_time: 0.000289 Rows_sent: 0 Rows_examined: 0 Rows_affected: 0 Rows_read: 1
SET timestamp=1242924506;
SELECT * FROM t1;

Revision history for this message
Vadim Tkachenko (vadim-tk) wrote : Re: [Bug 379115] [NEW] log_slow_slave_statements doesn't work

Please specify version you are testing.
If this is for 5.1 - please report the same bug for official MySQL 5.1, as
this is standard feature.

On Thu, May 21, 2009 at 9:56 AM, Aleksandr Kuzminsky <
<email address hidden>> wrote:

> Public bug reported:
>
> Queries issued on a master are not logged on a slave's slow log.
>
> >From mysq-test test(microslow_innodb_log_slow_slave_statements):
> ..
> connection master;
> CREATE TABLE t1(
> id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
> name VARCHAR(255)
> );
> INSERT INTO t1(name) VALUES('aaa');
>
> connection slave;
> SELECT * FROM t1;
> ...
>
> The test was run as:
> ./mtr --record --mysqld=--log_slow_slave_statements=1
> microslow_innodb_log_slow_slave_statements
>
> The slave's slow log(CREATE and INSERT are missing in it):
> SET long_query_time=0;
> # User@Host: root[root] @ localhost [127.0.0.1]
> # Thread_id: 2 Schema: test
> # Query_time: 0.000401 Lock_time: 0.000289 Rows_sent: 0 Rows_examined: 0
> Rows_affected: 0 Rows_read: 1
> SET timestamp=1242924506;
> SELECT * FROM t1;
>
> ** Affects: percona-patches
> Importance: Undecided
> Status: New
>
> --
> log_slow_slave_statements doesn't work
> https://bugs.launchpad.net/bugs/379115
> You received this bug notification because you are a member of Percona
> developers, which is the registrant for Percona patches.
>
> Status in Patches for MySQL by Percona: New
>
> Bug description:
> Queries issued on a master are not logged on a slave's slow log.
>
> >From mysq-test test(microslow_innodb_log_slow_slave_statements):
> ..
> connection master;
> CREATE TABLE t1(
> id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
> name VARCHAR(255)
> );
> INSERT INTO t1(name) VALUES('aaa');
>
> connection slave;
> SELECT * FROM t1;
> ...
>
> The test was run as:
> ./mtr --record --mysqld=--log_slow_slave_statements=1
> microslow_innodb_log_slow_slave_statements
>
> The slave's slow log(CREATE and INSERT are missing in it):
> SET long_query_time=0;
> # User@Host: root[root] @ localhost [127.0.0.1]
> # Thread_id: 2 Schema: test
> # Query_time: 0.000401 Lock_time: 0.000289 Rows_sent: 0 Rows_examined: 0
> Rows_affected: 0 Rows_read: 1
> SET timestamp=1242924506;
> SELECT * FROM t1;
>

Revision history for this message
Aleksandr Kuzminsky (akuzminsky) wrote :

Sorry version gone during copy&paste.
It is applicable to lp:~percona-dev/percona-patches/5.1.34

Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

5.1.34

Changed in percona-patches:
assignee: nobody → Yasufumi Kinoshita (yasufumi-kinoshita)
importance: Undecided → Medium
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

For 5.1.34, log_slow_slave_statements is native option of MySQL.
http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_log-slow-slave-statements

I think the patches of 5.1.34 does not touch the option....
I will investigate it. So, where the test-script is?

Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :
Changed in percona-patches:
status: New → Fix Committed
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

If you want to log "CREATE TABLE" here, log-slow-admin-statements option is also needed.

Revision history for this message
Aleksandr Kuzminsky (akuzminsky) wrote : Re: [Bug 379115] Re: log_slow_slave_statements doesn't work

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yasufumi Kinoshita schrieb:
> For 5.1.34, log_slow_slave_statements is native option of MySQL.
> http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_log-slow-slave-statements
>
> I think the patches of 5.1.34 does not touch the option....
> I will investigate it. So, where the test-script is?
>

Yasufumi,

Here is a draft on the test, which can be used. If success - you have to
see "INSERT" in a slow log.

t/microslow_innodb_log_slow_slave_statements.test

- --source include/master-slave.inc

connection master;
- --disable_warnings
DROP TABLE IF EXISTS t1;
- --enable_warnings

connection slave;

SET @old_slow_query_log=@@slow_query_log;
SET @old_long_query_time=@@long_query_time;

SET GLOBAL slow_query_log=on;
SET long_query_time=0;
SET log_slow_slave_statements=1;

connection master;
CREATE TABLE t1(
  id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
  name VARCHAR(255)
  );
INSERT INTO t1(name) VALUES('aaa');

connection slave;
SELECT * FROM t1;

SELECT @@slow_query_log_file;
SET GLOBAL slow_query_log=@old_slow_query_log;
SET long_query_time=@old_long_query_time;
#--exec bash -c "cat $f| sed 's/Tcp port: [0-9]*/Tcp port: PORT/' | sed
's/Unix socket: .*/Unix socket: SOCKET/' | sed 's/^\/.*mysqld/mysqld/' |
sed 's/Version: .*/Version: VERSION/' | grep -v '^# Time' | sed 's/^#
Query_time: [0-9]*.[0-9]*/# Query_time: TIME/' | sed 's/Lock_time:
[0-9]*.[0-9]*/Lock_time: TIME/' | sed 's/SET timestamp=[0-9]*;/SET
timestamp=TIME;/'"

connection master;
DROP TABLE t1;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoeN3EACgkQQ6p+ZxjCGwVwtACdFWlum2jcr1cV5dq0O6bHiJWt
+jEAnidHc3dwnDJTuajakfFdPgNqi8M3
=Kd2M
-----END PGP SIGNATURE-----

Changed in percona-patches:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.