4437 Rohit Kalhans 2012-09-09
WL#6403: Add idempotent mode to mysqlbinlog
-- SET SESSION RBR_EXEC_MODE=IDEMPOTENT will be printed
only once in the output of the mysqlbinlog --idempotent
--added test rbr_exec_mode_basic.test
--fixed few broken test cases.
@ mysql-test/suite/sys_vars/t/rbr_exec_mode_basic.test
basic test for rbr_exec_mode
added:
mysql-test/suite/sys_vars/r/rbr_exec_mode_basic.result
mysql-test/suite/sys_vars/t/rbr_exec_mode_basic.test
modified:
client/mysqlbinlog.cc
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
sql/log_event.cc
sql/log_event.h
sql/sys_vars.cc
4436 Rohit Kalhans 2012-09-07
updated tree name.
modified:
.bzr-mysql/default.conf
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2012-09-07 10:24:44 +0000
+++ b/client/mysqlbinlog.cc 2012-09-09 11:56:47 +0000
@@ -781,7 +781,6 @@ Exit_status process_event(PRINT_EVENT_IN
my_bool destroy_evt= TRUE;
DBUG_ENTER("process_event");
print_event_info->short_form= short_form;
- print_event_info->idempotent_mode= idempotent_mode;
Exit_status retval= OK_CONTINUE;
IO_CACHE *const head= &print_event_info->head_cache;
@@ -2725,6 +2724,13 @@ int main(int argc, char** argv)
"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
"\n/*!40101 SET NAMES %s */;\n", charset);
}
+ /*
+ In case '--idempotent' or '-i' options has been used, we will notify the
+ server to use idempotent mode for the following events.
+ */
+ if (idempotent_mode)
+ fprintf(result_file,
+ "/*!50700 SET @@SESSION.RBR_EXEC_MODE=IDEMPOTENT*/;\n\n");
for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
(--argc >= 0) ; )
=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result 2012-08-28 08:26:19 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result 2012-09-09 11:56:47 +0000
@@ -678,6 +678,12 @@ The following options may be given as th
--range-alloc-block-size=#
Allocation block size for storing ranges during
optimization
+ --rbr-exec-mode=name
+ Modes for how row events should be executed. Legal values
+ are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode,
+ the server will not throw errors for operations that are
+ idempotent. In STRICT mode, server will throw errors for
+ the operations that cause a conflict.
--read-buffer-size=#
Each thread that does a sequential scan allocates a
buffer of this size for each table it scans. If you do
@@ -1174,6 +1180,7 @@ query-cache-type ON
query-cache-wlock-invalidate FALSE
query-prealloc-size 8192
range-alloc-block-size 4096
+rbr-exec-mode STRICT
read-buffer-size 131072
read-only FALSE
read-rnd-buffer-size 262144
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2012-08-28 08:26:19 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2012-09-09 11:56:47 +0000
@@ -678,6 +678,12 @@ The following options may be given as th
--range-alloc-block-size=#
Allocation block size for storing ranges during
optimization
+ --rbr-exec-mode=name
+ Modes for how row events should be executed. Legal values
+ are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode,
+ the server will not throw errors for operations that are
+ idempotent. In STRICT mode, server will throw errors for
+ the operations that cause a conflict.
--read-buffer-size=#
Each thread that does a sequential scan allocates a
buffer of this size for each table it scans. If you do
=== added file 'mysql-test/suite/sys_vars/r/rbr_exec_mode_basic.result'
--- a/mysql-test/suite/sys_vars/r/rbr_exec_mode_basic.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/rbr_exec_mode_basic.result 2012-09-09 11:56:47 +0000
@@ -0,0 +1,74 @@
+set @saved_session_rbr_exec_mode = @@session.rbr_exec_mode;
+set @saved_global_rbr_exec_mode = @@global.rbr_exec_mode;
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+SET global rbr_exec_mode=DEFAULT;
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+SET global rbr_exec_mode='IDEMPOTENT';
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+IDEMPOTENT
+SET global rbr_exec_mode='STRICT';
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET session rbr_exec_mode=DEFAULT;
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET session rbr_exec_mode='IDEMPOTENT';
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+IDEMPOTENT
+SET session rbr_exec_mode='STRICT';
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET session rbr_exec_mode='STIRCT';
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of 'STIRCT'
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET session rbr_exec_mode='';
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of ''
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET session rbr_exec_mode='1';
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of '1'
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET session rbr_exec_mode=NULL;
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of 'NULL'
+SELECT @@session.rbr_exec_mode;
+@@session.rbr_exec_mode
+STRICT
+SET global rbr_exec_mode='STIRCT';
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of 'STIRCT'
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+SET global rbr_exec_mode='';
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of ''
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+SET global rbr_exec_mode='1';
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of '1'
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+SET global rbr_exec_mode=NULL;
+ERROR 42000: Variable 'rbr_exec_mode' can't be set to the value of 'NULL'
+SELECT @@global.rbr_exec_mode;
+@@global.rbr_exec_mode
+STRICT
+set session rbr_exec_mode = @saved_session_rbr_exec_mode;
+set global rbr_exec_mode = @saved_global_rbr_exec_mode;
=== added file 'mysql-test/suite/sys_vars/t/rbr_exec_mode_basic.test'
--- a/mysql-test/suite/sys_vars/t/rbr_exec_mode_basic.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/rbr_exec_mode_basic.test 2012-09-09 11:56:47 +0000
@@ -0,0 +1,70 @@
+###############################################################################
+# This test checks the basics of setting the variable rbr_exec_mode
+#
+###############################################################################
+--source include/not_embedded.inc
+
+set @saved_session_rbr_exec_mode = @@session.rbr_exec_mode;
+set @saved_global_rbr_exec_mode = @@global.rbr_exec_mode;
+
+# GLOBAL SETTINGS
+SELECT @@global.rbr_exec_mode;
+
+SET global rbr_exec_mode=DEFAULT;
+SELECT @@global.rbr_exec_mode;
+
+SET global rbr_exec_mode='IDEMPOTENT';
+SELECT @@global.rbr_exec_mode;
+
+SET global rbr_exec_mode='STRICT';
+SELECT @@global.rbr_exec_mode;
+
+# SESSION SETTINGS
+SELECT @@session.rbr_exec_mode;
+
+SET session rbr_exec_mode=DEFAULT;
+SELECT @@session.rbr_exec_mode;
+
+SET session rbr_exec_mode='IDEMPOTENT';
+SELECT @@session.rbr_exec_mode;
+
+SET session rbr_exec_mode='STRICT';
+SELECT @@session.rbr_exec_mode;
+
+# checking that setting variable to a non existing value raises error
+# INVALID SESSION SETTINGS
+--error ER_WRONG_VALUE_FOR_VAR
+SET session rbr_exec_mode='STIRCT';
+SELECT @@session.rbr_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET session rbr_exec_mode='';
+SELECT @@session.rbr_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET session rbr_exec_mode='1';
+SELECT @@session.rbr_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET session rbr_exec_mode=NULL;
+SELECT @@session.rbr_exec_mode;
+
+# INVALID GLOBAL SETTING
+--error ER_WRONG_VALUE_FOR_VAR
+SET global rbr_exec_mode='STIRCT';
+SELECT @@global.rbr_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET global rbr_exec_mode='';
+SELECT @@global.rbr_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET global rbr_exec_mode='1';
+SELECT @@global.rbr_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET global rbr_exec_mode=NULL;
+SELECT @@global.rbr_exec_mode;
+
+set session rbr_exec_mode = @saved_session_rbr_exec_mode;
+set global rbr_exec_mode = @saved_global_rbr_exec_mode;
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2012-09-07 10:24:44 +0000
+++ b/sql/log_event.cc 2012-09-09 11:56:47 +0000
@@ -4142,9 +4142,6 @@ void Query_log_event::print_query_header
print_event_info->thread_id_printed= 1;
}
- if (print_event_info->idempotent_mode)
- my_b_printf(file, "SET @@session.rbr_exec_mode=IDEMPOTENT%s\n",
- print_event_info->delimiter);
/*
If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
print (remember we don't produce mixed relay logs so there cannot be
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2012-09-07 10:24:44 +0000
+++ b/sql/log_event.h 2012-09-09 11:56:47 +0000
@@ -798,7 +798,6 @@ typedef struct st_print_event_info
/* Settings on how to print the events */
- bool idempotent_mode;
bool short_form;
enum_base64_output_mode base64_output_mode;
/*
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2012-09-07 10:24:44 +0000
+++ b/sql/sys_vars.cc 2012-09-09 11:56:47 +0000
@@ -2568,7 +2568,7 @@ static Sys_var_enum rbr_exec_mode(
"Modes for how row events should be executed. Legal values "
"are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, "
"the server will not throw errors for operations that are idempotent. "
- "In STRICT mode, server will throw errors for the operations that"
+ "In STRICT mode, server will throw errors for the operations that "
"cause a conflict.",
SESSION_VAR(rbr_exec_mode_options), CMD_LINE(REQUIRED_ARG),
rbr_exec_mode_names, DEFAULT(RBR_EXEC_MODE_STRICT));
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl6403 branch (rohit.kalhans:4436 to 4437) WL#6403 | Rohit Kalhans | 12 Sep |