Merge dsl-hkibras-fe36f900-97.dhcp.inet.fi:/home/elkin/MySQL/TEAM/BARE/5.1

into  dsl-hkibras-fe36f900-97.dhcp.inet.fi:/home/elkin/MySQL/TEAM/FIXES/5.1/bug16567_binlog_verbose_help_jeb
parents 74f74899 639a8681
...@@ -7,8 +7,31 @@ start slave; ...@@ -7,8 +7,31 @@ start slave;
drop database if exists mysqltest1; drop database if exists mysqltest1;
create database mysqltest1; create database mysqltest1;
use mysqltest1; use mysqltest1;
set session binlog_format=mixed;
show session variables like "binlog_format%";
Variable_name Value
binlog_format MIXED
set session binlog_format=statement;
show session variables like "binlog_format%";
Variable_name Value
binlog_format STATEMENT
set session binlog_format=row; set session binlog_format=row;
set global binlog_format=row; show session variables like "binlog_format%";
Variable_name Value
binlog_format ROW
set global binlog_format=DEFAULT;
show global variables like "binlog_format%";
Variable_name Value
binlog_format MIXED
set global binlog_format=MIXED;
show global variables like "binlog_format%";
Variable_name Value
binlog_format MIXED
set global binlog_format=STATEMENT;
show global variables like "binlog_format%";
Variable_name Value
binlog_format STATEMENT
set global binlog_format=ROW;
show global variables like "binlog_format%"; show global variables like "binlog_format%";
Variable_name Value Variable_name Value
binlog_format ROW binlog_format ROW
...@@ -67,12 +90,11 @@ execute stmt1 using @string; ...@@ -67,12 +90,11 @@ execute stmt1 using @string;
deallocate prepare stmt1; deallocate prepare stmt1;
insert into t1 values("for_10_"); insert into t1 values("for_10_");
insert into t1 select "yesterday_11_"; insert into t1 select "yesterday_11_";
set binlog_format=default; set binlog_format=statement;
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format @@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT STATEMENT STATEMENT
set global binlog_format=default; set global binlog_format=statement;
ERROR 42000: Variable 'binlog_format' doesn't have a default value
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format @@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT STATEMENT STATEMENT
...@@ -87,11 +109,11 @@ execute stmt1 using @string; ...@@ -87,11 +109,11 @@ execute stmt1 using @string;
deallocate prepare stmt1; deallocate prepare stmt1;
insert into t1 values("for_15_"); insert into t1 values("for_15_");
insert into t1 select "yesterday_16_"; insert into t1 select "yesterday_16_";
set binlog_format=mixed; set global binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format @@global.binlog_format @@session.binlog_format
STATEMENT MIXED MIXED STATEMENT
set global binlog_format=mixed; set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format @@global.binlog_format @@session.binlog_format
MIXED MIXED MIXED MIXED
......
#
# rpl_switch_stm_row_mixed tests covers
#
# - switching explicitly between STATEMENT, ROW, and MIXED binlog format
# showing when it is possible and when not.
# - switching from MIXED to RBR implicitly listing all use cases,
# e.g a query invokes UUID(), thereafter to serve as the definition
# of MIXED binlog format
# - correctness of execution
-- source include/not_ndb_default.inc -- source include/not_ndb_default.inc
-- source include/master-slave.inc -- source include/master-slave.inc
...@@ -8,9 +19,22 @@ create database mysqltest1; ...@@ -8,9 +19,22 @@ create database mysqltest1;
--enable_warnings --enable_warnings
use mysqltest1; use mysqltest1;
# play with switching
set session binlog_format=mixed;
show session variables like "binlog_format%";
set session binlog_format=statement;
show session variables like "binlog_format%";
set session binlog_format=row; set session binlog_format=row;
set global binlog_format=row; show session variables like "binlog_format%";
set global binlog_format=DEFAULT;
show global variables like "binlog_format%";
set global binlog_format=MIXED;
show global variables like "binlog_format%";
set global binlog_format=STATEMENT;
show global variables like "binlog_format%";
set global binlog_format=ROW;
show global variables like "binlog_format%"; show global variables like "binlog_format%";
show session variables like "binlog_format%"; show session variables like "binlog_format%";
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
...@@ -63,12 +87,10 @@ deallocate prepare stmt1; ...@@ -63,12 +87,10 @@ deallocate prepare stmt1;
insert into t1 values("for_10_"); insert into t1 values("for_10_");
insert into t1 select "yesterday_11_"; insert into t1 select "yesterday_11_";
# test SET DEFAULT (=statement at this point of test) # test statement (is not default after wl#3368)
set binlog_format=default; set binlog_format=statement;
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
# due to cluster it's hard to set back to default set global binlog_format=statement;
--error ER_NO_DEFAULT
set global binlog_format=default;
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
prepare stmt1 from 'insert into t1 select ?'; prepare stmt1 from 'insert into t1 select ?';
...@@ -87,10 +109,10 @@ insert into t1 select "yesterday_16_"; ...@@ -87,10 +109,10 @@ insert into t1 select "yesterday_16_";
# and now the mixed mode # and now the mixed mode
set binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format;
set global binlog_format=mixed; set global binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format; select @@global.binlog_format, @@session.binlog_format;
set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
set @string="emergency_17_"; set @string="emergency_17_";
......
...@@ -448,9 +448,10 @@ my_bool sp_automatic_privileges= 1; ...@@ -448,9 +448,10 @@ my_bool sp_automatic_privileges= 1;
ulong opt_binlog_rows_event_max_size; ulong opt_binlog_rows_event_max_size;
const char *binlog_format_names[]= {"STATEMENT", "ROW", "MIXED", NullS}; const char *binlog_format_names[]= {"STATEMENT", "ROW", "MIXED", NullS};
TYPELIB binlog_format_typelib= TYPELIB binlog_format_typelib=
{ array_elements(binlog_format_names)-1,"", { array_elements(binlog_format_names) - 1, "",
binlog_format_names, NULL }; binlog_format_names, NULL };
ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC;
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id];
#ifdef HAVE_INITGROUPS #ifdef HAVE_INITGROUPS
static bool calling_initgroups= FALSE; /* Used in SIGSEGV handler. */ static bool calling_initgroups= FALSE; /* Used in SIGSEGV handler. */
#endif #endif
...@@ -3153,17 +3154,24 @@ with --log-bin instead."); ...@@ -3153,17 +3154,24 @@ with --log-bin instead.");
"--log-slave-updates work."); "--log-slave-updates work.");
unireg_abort(1); unireg_abort(1);
} }
if (!opt_bin_log)
if (!opt_bin_log && (global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC)) if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
{ {
sql_print_error("You need to use --log-bin to make " sql_print_error("You need to use --log-bin to make "
"--binlog-format work."); "--binlog-format work.");
unireg_abort(1); unireg_abort(1);
} }
if (global_system_variables.binlog_format == BINLOG_FORMAT_UNSPEC) else
{ {
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
}
else
if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC)
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED; global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
} else
{
DBUG_ASSERT(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
}
/* Check that we have not let the format to unspecified at this point */ /* Check that we have not let the format to unspecified at this point */
DBUG_ASSERT((uint)global_system_variables.binlog_format <= DBUG_ASSERT((uint)global_system_variables.binlog_format <=
...@@ -4914,6 +4922,7 @@ struct my_option my_long_options[] = ...@@ -4914,6 +4922,7 @@ struct my_option my_long_options[] =
(gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR, (gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog_format", OPT_BINLOG_FORMAT, {"binlog_format", OPT_BINLOG_FORMAT,
"Does not have any effect without '--log-bin'. "
"Tell the master the form of binary logging to use: either 'row' for " "Tell the master the form of binary logging to use: either 'row' for "
"row-based binary logging, or 'statement' for statement-based binary " "row-based binary logging, or 'statement' for statement-based binary "
"logging, or 'mixed'. 'mixed' is statement-based binary logging except " "logging, or 'mixed'. 'mixed' is statement-based binary logging except "
...@@ -4921,11 +4930,12 @@ struct my_option my_long_options[] = ...@@ -4921,11 +4930,12 @@ struct my_option my_long_options[] =
"involve user-defined functions (i.e. UDFs) or the UUID() function; for " "involve user-defined functions (i.e. UDFs) or the UUID() function; for "
"those, row-based binary logging is automatically used. " "those, row-based binary logging is automatically used. "
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
"If ndbcluster is enabled, the default is 'row'." "If ndbcluster is enabled and binlog_format is `mixed', the format switches"
" to 'row' and back implicitly per each query accessing a NDB table."
#endif #endif
, 0, 0, 0, GET_STR, REQUIRED_ARG, ,(gptr*) &opt_binlog_format, (gptr*) &opt_binlog_format,
BINLOG_FORMAT_MIXED 0, GET_STR, REQUIRED_ARG, BINLOG_FORMAT_MIXED, BINLOG_FORMAT_STMT,
, 0, 0, 0, 0, 0 }, BINLOG_FORMAT_MIXED, 0, 0, 0},
{"binlog-do-db", OPT_BINLOG_DO_DB, {"binlog-do-db", OPT_BINLOG_DO_DB,
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
...@@ -7291,7 +7301,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -7291,7 +7301,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
binlog_format_names[BINLOG_FORMAT_MIXED]); binlog_format_names[BINLOG_FORMAT_MIXED]);
exit(1); exit(1);
} }
global_system_variables.binlog_format= id-1; global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
break; break;
} }
case (int)OPT_BINLOG_DO_DB: case (int)OPT_BINLOG_DO_DB:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment