Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1295 from robgolebiowski/5.7-ps-bug995624
5.7 ps bug995624
- Loading branch information
Showing
6 changed files
with
148 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
# | ||
# Bug 995624 RBR events are not reflected in userstat's | ||
# Rows_updated | ||
# | ||
STOP SLAVE SQL_THREAD; | ||
CHANGE REPLICATION FILTER | ||
REPLICATE_DO_TABLE= (test.t1, test.t2); | ||
START SLAVE SQL_THREAD; | ||
SET @slave_userstat_saved= @@global.userstat; | ||
SET GLOBAL userstat=ON; | ||
include/assert.inc [Rows updated on slave should be equal to 0] | ||
SET @master_userstat_saved= @@global.userstat; | ||
SET GLOBAL userstat=ON; | ||
include/assert.inc [Rows updated on master should be equal to 0] | ||
CREATE TABLE t1 (m INT); | ||
3 "updates" to rows | ||
INSERT INTO t1 VALUES(15),(16),(17); | ||
1 "update" to rows (4 in total) | ||
UPDATE t1 SET m=20 WHERE m=16; | ||
1 "update" to rows (5 in total) | ||
DELETE FROM t1 WHERE m=17; | ||
CREATE TABLE t2 (n INT); | ||
2 "updates" to rows (7 in total) | ||
INSERT INTO t2 VALUES(30),(30); | ||
2 "updates" to rows (9 in total) | ||
UPDATE t2 SET n=10 WHERE n=30; | ||
2 "updates" to rows (11 in total) | ||
DELETE FROM t2 WHERE n=10; | ||
2 "updates" to rows (13 in total) | ||
INSERT INTO t2 (n) | ||
SELECT t1.m | ||
FROM t1; | ||
include/assert.inc [Rows updated on master should be equal to 13] | ||
t3 is not replicated. Let us make some updates | ||
and check if they do not affect userstat | ||
CREATE TABLE t3(x INT); | ||
INSERT INTO t3 VALUE(1),(2),(3); | ||
UPDATE t3 SET x=1 WHERE x=2; | ||
DELETE FROM t3 WHERE x=1; | ||
include/sync_slave_sql_with_master.inc | ||
include/assert.inc [Rows updated on slave should be equal to 13 (i.e. Number of RBR rows updates replicated from master)] | ||
SET GLOBAL userstat=@slave_userstat_saved; | ||
SELECT * FROM t1 ORDER BY m; | ||
m | ||
15 | ||
20 | ||
SET GLOBAL userstat=@master_userstat_saved; | ||
DROP TABLE t1, t2; | ||
DROP TABLE t3; | ||
include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--source include/not_embedded.inc | ||
--source include/master-slave.inc | ||
|
||
--echo # | ||
--echo # Bug 995624 RBR events are not reflected in userstat's | ||
--echo # Rows_updated | ||
--echo # | ||
|
||
connection slave; | ||
|
||
STOP SLAVE SQL_THREAD; | ||
CHANGE REPLICATION FILTER | ||
REPLICATE_DO_TABLE= (test.t1, test.t2); | ||
START SLAVE SQL_THREAD; | ||
|
||
SET @slave_userstat_saved= @@global.userstat; | ||
SET GLOBAL userstat=ON; | ||
|
||
--let $assert_text= Rows updated on slave should be equal to 0 | ||
--let $assert_cond= [SELECT ROWS_UPDATED FROM information_schema.client_statistics] = 0 | ||
--source include/assert.inc | ||
|
||
connection master; | ||
SET @master_userstat_saved= @@global.userstat; | ||
SET GLOBAL userstat=ON; | ||
|
||
--let $assert_text= Rows updated on master should be equal to 0 | ||
--let $assert_cond= [SELECT ROWS_UPDATED FROM information_schema.client_statistics] = 0 | ||
--source include/assert.inc | ||
|
||
CREATE TABLE t1 (m INT); | ||
--echo 3 "updates" to rows | ||
INSERT INTO t1 VALUES(15),(16),(17); | ||
--echo 1 "update" to rows (4 in total) | ||
UPDATE t1 SET m=20 WHERE m=16; | ||
--echo 1 "update" to rows (5 in total) | ||
DELETE FROM t1 WHERE m=17; | ||
CREATE TABLE t2 (n INT); | ||
--echo 2 "updates" to rows (7 in total) | ||
INSERT INTO t2 VALUES(30),(30); | ||
--echo 2 "updates" to rows (9 in total) | ||
UPDATE t2 SET n=10 WHERE n=30; | ||
--echo 2 "updates" to rows (11 in total) | ||
DELETE FROM t2 WHERE n=10; | ||
|
||
--echo 2 "updates" to rows (13 in total) | ||
INSERT INTO t2 (n) | ||
SELECT t1.m | ||
FROM t1; | ||
|
||
--let $assert_text= Rows updated on master should be equal to 13 | ||
--let $assert_cond= [SELECT ROWS_UPDATED FROM information_schema.client_statistics] = 13 | ||
--source include/assert.inc | ||
|
||
--echo t3 is not replicated. Let us make some updates | ||
--echo and check if they do not affect userstat | ||
CREATE TABLE t3(x INT); | ||
INSERT INTO t3 VALUE(1),(2),(3); | ||
UPDATE t3 SET x=1 WHERE x=2; | ||
DELETE FROM t3 WHERE x=1; | ||
|
||
--source include/sync_slave_sql_with_master.inc | ||
|
||
--let $assert_text= Rows updated on slave should be equal to 13 (i.e. Number of RBR rows updates replicated from master) | ||
--let $assert_cond= [SELECT ROWS_UPDATED FROM information_schema.client_statistics WHERE CLIENT != \'localhost\'] = 13 | ||
--source include/assert.inc | ||
|
||
SET GLOBAL userstat=@slave_userstat_saved; | ||
|
||
SELECT * FROM t1 ORDER BY m; | ||
|
||
connection master; | ||
SET GLOBAL userstat=@master_userstat_saved; | ||
DROP TABLE t1, t2; | ||
DROP TABLE t3; | ||
--source include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters