forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FB8-187: New variable binlog_rows_event_max_rows to control the numbe…
…r of rows in a single rows event (facebook#974) (facebook#974) Summary: Jira issue: https://jira.percona.com/browse/FB8-187 Reference Patch: facebook@dfe6746cdfd Number of rows in a single event can be indirectly controlled with binlog_rows_event_max_size. This new variable will give more direct control to the user. Originally Reviewed By: anirbanr-fb Pull Request resolved: facebook#974 Reviewed By: lloyd Differential Revision: D14421324 Pulled By: lth
- Loading branch information
1 parent
29d17e6
commit 589ec73
Showing
12 changed files
with
156 additions
and
1 deletion.
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
30 changes: 30 additions & 0 deletions
30
mysql-test/suite/binlog/r/binlog_rows_event_max_rows.result
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,30 @@ | ||
RESET BINARY LOGS AND GTIDS; | ||
SET @old_binlog_rows_event_max_rows = @@global.binlog_rows_event_max_rows; | ||
SET @@global.binlog_rows_event_max_rows= 1; | ||
CREATE TABLE t1 (a INT); | ||
INSERT INTO t1 VALUES (1), (2), (3); | ||
UPDATE t1 SET a = 10; | ||
SET @@global.binlog_rows_event_max_rows= 2; | ||
DELETE FROM t1; | ||
include/show_binlog_events.inc | ||
Log_name Pos Event_type Server_id End_log_pos Info | ||
binlog.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) | ||
binlog.000001 # Query # # BEGIN | ||
binlog.000001 # Table_map # # table_id: # (test.t1) | ||
binlog.000001 # Write_rows # # table_id: # | ||
binlog.000001 # Write_rows # # table_id: # | ||
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F | ||
binlog.000001 # Xid # # COMMIT /* XID */ | ||
binlog.000001 # Query # # BEGIN | ||
binlog.000001 # Table_map # # table_id: # (test.t1) | ||
binlog.000001 # Update_rows # # table_id: # | ||
binlog.000001 # Update_rows # # table_id: # | ||
binlog.000001 # Update_rows # # table_id: # flags: STMT_END_F | ||
binlog.000001 # Xid # # COMMIT /* XID */ | ||
binlog.000001 # Query # # BEGIN | ||
binlog.000001 # Table_map # # table_id: # (test.t1) | ||
binlog.000001 # Delete_rows # # table_id: # | ||
binlog.000001 # Delete_rows # # table_id: # flags: STMT_END_F | ||
binlog.000001 # Xid # # COMMIT /* XID */ | ||
DROP TABLE t1; | ||
SET @@global.binlog_rows_event_max_rows = @old_binlog_rows_event_max_rows; |
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,30 @@ | ||
source include/have_binlog_format_row.inc; | ||
|
||
# Deletes all the binary logs | ||
RESET BINARY LOGS AND GTIDS; | ||
|
||
SET @old_binlog_rows_event_max_rows = @@global.binlog_rows_event_max_rows; | ||
|
||
# setup | ||
let $MYSQLD_DATADIR = `select @@datadir`; | ||
let $MYSQLD_SECURE_FILE_DIR = `select @@secure_file_priv`; | ||
SET @@global.binlog_rows_event_max_rows= 1; | ||
CREATE TABLE t1 (a INT); | ||
|
||
# each insert should be in a separate row event because binlog_rows_event_max_rows = 1 | ||
INSERT INTO t1 VALUES (1), (2), (3); | ||
|
||
# each update should be in a separate row event because binlog_rows_event_max_rows = 1 | ||
UPDATE t1 SET a = 10; | ||
|
||
# there should be two delete events, 1st one with 2 rows and 2nd one with one | ||
# row because binlog_rows_event_max_rows = 2 | ||
SET @@global.binlog_rows_event_max_rows= 2; | ||
DELETE FROM t1; | ||
|
||
--source include/show_binlog_events.inc | ||
|
||
# cleanup | ||
DROP TABLE t1; | ||
|
||
SET @@global.binlog_rows_event_max_rows = @old_binlog_rows_event_max_rows; |
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
45 changes: 45 additions & 0 deletions
45
mysql-test/suite/sys_vars/r/binlog_rows_event_max_rows_basic.result
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,45 @@ | ||
SET @old_binlog_rows_event_max_rows = @@global.binlog_rows_event_max_rows; | ||
SELECT @old_binlog_rows_event_max_rows; | ||
@old_binlog_rows_event_max_rows | ||
18446744073709551615 | ||
SET @@global.binlog_rows_event_max_rows = DEFAULT; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
18446744073709551615 | ||
# binlog_rows_event_max_rows is a global variable. | ||
SET @@session.binlog_rows_event_max_rows = 1; | ||
ERROR HY000: Variable 'binlog_rows_event_max_rows' is a GLOBAL variable and should be set with SET GLOBAL | ||
SELECT @@binlog_rows_event_max_rows; | ||
@@binlog_rows_event_max_rows | ||
18446744073709551615 | ||
SET @@global.binlog_rows_event_max_rows = 512; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
512 | ||
SET @@global.binlog_rows_event_max_rows = 1000000; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
1000000 | ||
SET @@global.binlog_rows_event_max_rows = 1.01; | ||
ERROR 42000: Incorrect argument type to variable 'binlog_rows_event_max_rows' | ||
SET @@global.binlog_rows_event_max_rows = 'ten'; | ||
ERROR 42000: Incorrect argument type to variable 'binlog_rows_event_max_rows' | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
1000000 | ||
# set binlog_rows_event_max_rows to wrong value | ||
SET @@global.binlog_rows_event_max_rows = 1500000; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
1500000 | ||
# set binlog_rows_event_max_rows to wrong value | ||
SET @@global.binlog_rows_event_max_rows = 0; | ||
Warnings: | ||
Warning 1292 Truncated incorrect binlog_rows_event_max_rows value: '0' | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
1 | ||
SET @@global.binlog_rows_event_max_rows = @old_binlog_rows_event_max_rows; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
@@global.binlog_rows_event_max_rows | ||
18446744073709551615 |
33 changes: 33 additions & 0 deletions
33
mysql-test/suite/sys_vars/t/binlog_rows_event_max_rows_basic.test
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,33 @@ | ||
--source include/load_sysvars.inc | ||
|
||
SET @old_binlog_rows_event_max_rows = @@global.binlog_rows_event_max_rows; | ||
SELECT @old_binlog_rows_event_max_rows; | ||
|
||
SET @@global.binlog_rows_event_max_rows = DEFAULT; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
|
||
-- echo # binlog_rows_event_max_rows is a global variable. | ||
--error ER_GLOBAL_VARIABLE | ||
SET @@session.binlog_rows_event_max_rows = 1; | ||
SELECT @@binlog_rows_event_max_rows; | ||
|
||
SET @@global.binlog_rows_event_max_rows = 512; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
SET @@global.binlog_rows_event_max_rows = 1000000; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
|
||
--error ER_WRONG_TYPE_FOR_VAR | ||
SET @@global.binlog_rows_event_max_rows = 1.01; | ||
--error ER_WRONG_TYPE_FOR_VAR | ||
SET @@global.binlog_rows_event_max_rows = 'ten'; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
-- echo # set binlog_rows_event_max_rows to wrong value | ||
SET @@global.binlog_rows_event_max_rows = 1500000; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
-- echo # set binlog_rows_event_max_rows to wrong value | ||
SET @@global.binlog_rows_event_max_rows = 0; | ||
SELECT @@global.binlog_rows_event_max_rows; | ||
|
||
|
||
SET @@global.binlog_rows_event_max_rows = @old_binlog_rows_event_max_rows; | ||
SELECT @@global.binlog_rows_event_max_rows; |
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
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