1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge mysql.com:/users/lthalmann/bkroot/mysql-5.1-new-rpl

into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.1-merge
This commit is contained in:
lars/lthalmann@dl145h.mysql.com
2006-09-23 06:06:06 +02:00
113 changed files with 4369 additions and 715 deletions

View File

@ -24,11 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
@sql_union_dirs@ storage plugin \ @sql_union_dirs@ unittest storage plugin \
@sql_server@ scripts @man_dirs@ tests \ @sql_server@ scripts @man_dirs@ tests \
netware @libmysqld_dirs@ \ netware @libmysqld_dirs@ \
mysql-test support-files @tools_dirs@ \ mysql-test support-files @tools_dirs@ \
unittest win win
DIST_SUBDIRS = $(SUBDIRS) BUILD DIST_SUBDIRS = $(SUBDIRS) BUILD
@ -114,7 +114,7 @@ test-unit:
test-ps: test-ps:
cd mysql-test ; \ cd mysql-test ; \
./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=statement ./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=mixed
test-nr: test-nr:
cd mysql-test ; \ cd mysql-test ; \
@ -125,6 +125,10 @@ test-pr:
./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=row ./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=row
test-ns: test-ns:
cd mysql-test ; \
./mysql-test-run.pl $(force) --mysqld=--binlog-format=mixed
test-binlog-statement:
cd mysql-test ; \ cd mysql-test ; \
./mysql-test-run.pl $(force) --mysqld=--binlog-format=statement ./mysql-test-run.pl $(force) --mysqld=--binlog-format=statement

View File

@ -671,13 +671,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
tty_password=1; tty_password=1;
break; break;
case 'r': case 'r':
if (!(md_result_file = my_fopen(argument, O_WRONLY | FILE_BINARY, if (!(md_result_file= my_fopen(argument, O_WRONLY | FILE_BINARY,
MYF(MY_WME)))) MYF(MY_WME))))
exit(1); exit(1);
break; break;
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol= MYSQL_PROTOCOL_PIPE;
#endif #endif
break; break;
case 'N': case 'N':
@ -692,7 +692,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#include <sslopt-case.h> #include <sslopt-case.h>
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
case 'X': case 'X':
opt_xml = 1; opt_xml= 1;
extended_insert= opt_drop= opt_lock= extended_insert= opt_drop= opt_lock=
opt_disable_keys= opt_autocommit= opt_create_db= 0; opt_disable_keys= opt_autocommit= opt_create_db= 0;
break; break;
@ -1582,7 +1582,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
const char *insert_option; const char *insert_option;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH]; char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH];
FILE *sql_file = md_result_file; FILE *sql_file= md_result_file;
int len; int len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
@ -1626,7 +1626,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
if (opt_order_by_primary) if (opt_order_by_primary)
order_by = primary_key_fields(result_table); order_by= primary_key_fields(result_table);
if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff)) if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff))
{ {
@ -1678,7 +1678,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
field= mysql_fetch_field_direct(result, 0); field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0) if (strcmp(field->name, "View") == 0)
{ {
char *scv_buff = NULL; char *scv_buff= NULL;
verbose_msg("-- It's a view, create dummy table for view\n"); verbose_msg("-- It's a view, create dummy table for view\n");
@ -1715,7 +1715,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else else
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
@ -2085,7 +2085,7 @@ static void dump_triggers_for_table (char *table, char *db)
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
char query_buff[QUERY_LENGTH]; char query_buff[QUERY_LENGTH];
uint old_opt_compatible_mode=opt_compatible_mode; uint old_opt_compatible_mode=opt_compatible_mode;
FILE *sql_file = md_result_file; FILE *sql_file= md_result_file;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
@ -2329,15 +2329,15 @@ static void dump_table(char *table, char *db)
end= strmov(end,buff); end= strmov(end,buff);
if (where || order_by) if (where || order_by)
{ {
query = alloc_query_str((ulong) ((end - query) + 1 + query= alloc_query_str((ulong) ((end - query) + 1 +
(where ? strlen(where) + 7 : 0) + (where ? strlen(where) + 7 : 0) +
(order_by ? strlen(order_by) + 10 : 0))); (order_by ? strlen(order_by) + 10 : 0)));
end = strmov(query, query_buf); end= strmov(query, query_buf);
if (where) if (where)
end = strxmov(end, " WHERE ", where, NullS); end= strxmov(end, " WHERE ", where, NullS);
if (order_by) if (order_by)
end = strxmov(end, " ORDER BY ", order_by, NullS); end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
if (mysql_real_query(mysql, query, (uint) (end - query))) if (mysql_real_query(mysql, query, (uint) (end - query)))
{ {
@ -2358,10 +2358,10 @@ static void dump_table(char *table, char *db)
result_table); result_table);
if (where || order_by) if (where || order_by)
{ {
query = alloc_query_str((ulong) (strlen(query) + 1 + query= alloc_query_str((ulong) (strlen(query) + 1 +
(where ? strlen(where) + 7 : 0) + (where ? strlen(where) + 7 : 0) +
(order_by ? strlen(order_by) + 10 : 0))); (order_by ? strlen(order_by) + 10 : 0)));
end = strmov(query, query_buf); end= strmov(query, query_buf);
if (where) if (where)
{ {
@ -2370,7 +2370,7 @@ static void dump_table(char *table, char *db)
fprintf(md_result_file, "-- WHERE: %s\n", where); fprintf(md_result_file, "-- WHERE: %s\n", where);
check_io(md_result_file); check_io(md_result_file);
} }
end = strxmov(end, " WHERE ", where, NullS); end= strxmov(end, " WHERE ", where, NullS);
} }
if (order_by) if (order_by)
{ {
@ -2379,7 +2379,7 @@ static void dump_table(char *table, char *db)
fprintf(md_result_file, "-- ORDER BY: %s\n", order_by); fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
check_io(md_result_file); check_io(md_result_file);
} }
end = strxmov(end, " ORDER BY ", order_by, NullS); end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
} }
if (!opt_xml && !opt_compact) if (!opt_xml && !opt_compact)
@ -2455,12 +2455,12 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
} }
for (i = 0; i < mysql_num_fields(res); i++) for (i= 0; i < mysql_num_fields(res); i++)
{ {
int is_blob; int is_blob;
ulong length= lengths[i]; ulong length= lengths[i];
if (!(field = mysql_fetch_field(res))) if (!(field= mysql_fetch_field(res)))
{ {
my_snprintf(query, QUERY_LENGTH, my_snprintf(query, QUERY_LENGTH,
"%s: Not enough fields from table %s! Aborting.\n", "%s: Not enough fields from table %s! Aborting.\n",
@ -2532,7 +2532,7 @@ static void dump_table(char *table, char *db)
else else
{ {
/* change any strings ("inf", "-inf", "nan") into NULL */ /* change any strings ("inf", "-inf", "nan") into NULL */
char *ptr = row[i]; char *ptr= row[i];
if (my_isalpha(charset_info, *ptr) || (*ptr == '-' && if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
my_isalpha(charset_info, ptr[1]))) my_isalpha(charset_info, ptr[1])))
dynstr_append(&extended_row, "NULL"); dynstr_append(&extended_row, "NULL");
@ -2592,7 +2592,7 @@ static void dump_table(char *table, char *db)
else else
{ {
/* change any strings ("inf", "-inf", "nan") into NULL */ /* change any strings ("inf", "-inf", "nan") into NULL */
char *ptr = row[i]; char *ptr= row[i];
if (opt_xml) if (opt_xml)
{ {
print_xml_tag1(md_result_file, "\t\t", "field name=", print_xml_tag1(md_result_file, "\t\t", "field name=",
@ -2638,10 +2638,10 @@ static void dump_table(char *table, char *db)
{ {
ulong row_length; ulong row_length;
dynstr_append(&extended_row,")"); dynstr_append(&extended_row,")");
row_length = 2 + extended_row.length; row_length= 2 + extended_row.length;
if (total_length + row_length < opt_net_buffer_length) if (total_length + row_length < opt_net_buffer_length)
{ {
total_length += row_length; total_length+= row_length;
fputc(',',md_result_file); /* Always row break */ fputc(',',md_result_file); /* Always row break */
fputs(extended_row.str,md_result_file); fputs(extended_row.str,md_result_file);
} }
@ -2653,7 +2653,7 @@ static void dump_table(char *table, char *db)
fputs(insert_pat.str,md_result_file); fputs(insert_pat.str,md_result_file);
fputs(extended_row.str,md_result_file); fputs(extended_row.str,md_result_file);
total_length = row_length+init_length; total_length= row_length+init_length;
} }
check_io(md_result_file); check_io(md_result_file);
} }
@ -2718,15 +2718,15 @@ err:
static char *getTableName(int reset) static char *getTableName(int reset)
{ {
static MYSQL_RES *res = NULL; static MYSQL_RES *res= NULL;
MYSQL_ROW row; MYSQL_ROW row;
if (!res) if (!res)
{ {
if (!(res = mysql_list_tables(mysql,NullS))) if (!(res= mysql_list_tables(mysql,NullS)))
return(NULL); return(NULL);
} }
if ((row = mysql_fetch_row(res))) if ((row= mysql_fetch_row(res)))
return((char*) row[0]); return((char*) row[0]);
if (reset) if (reset)
@ -2734,7 +2734,7 @@ static char *getTableName(int reset)
else else
{ {
mysql_free_result(res); mysql_free_result(res);
res = NULL; res= NULL;
} }
return(NULL); return(NULL);
} /* getTableName */ } /* getTableName */
@ -2872,7 +2872,7 @@ static int dump_all_databases()
if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES")) if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES"))
return 1; return 1;
while ((row = mysql_fetch_row(tableres))) while ((row= mysql_fetch_row(tableres)))
{ {
if (dump_all_tables_in_db(row[0])) if (dump_all_tables_in_db(row[0]))
result=1; result=1;
@ -2880,13 +2880,13 @@ static int dump_all_databases()
if (seen_views) if (seen_views)
{ {
if (mysql_query(mysql, "SHOW DATABASES") || if (mysql_query(mysql, "SHOW DATABASES") ||
!(tableres = mysql_store_result(mysql))) !(tableres= mysql_store_result(mysql)))
{ {
my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s", my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
MYF(0), mysql_error(mysql)); MYF(0), mysql_error(mysql));
return 1; return 1;
} }
while ((row = mysql_fetch_row(tableres))) while ((row= mysql_fetch_row(tableres)))
{ {
if (dump_all_views_in_db(row[0])) if (dump_all_views_in_db(row[0]))
result=1; result=1;
@ -3332,7 +3332,7 @@ static int do_show_master_status(MYSQL *mysql_con)
} }
else else
{ {
row = mysql_fetch_row(master); row= mysql_fetch_row(master);
if (row && row[0] && row[1]) if (row && row[0] && row[1])
{ {
/* SHOW MASTER STATUS reports file and position */ /* SHOW MASTER STATUS reports file and position */
@ -3459,7 +3459,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
MYSQL_FIELD *field; MYSQL_FIELD *field;
mysql_field_seek(result, 0); mysql_field_seek(result, 0);
for ( ; (field = mysql_fetch_field(result)) ; row++) for ( ; (field= mysql_fetch_field(result)) ; row++)
{ {
if (!strcmp(field->name,name)) if (!strcmp(field->name,name))
{ {
@ -3587,17 +3587,19 @@ char check_if_ignore_table(const char *table_name, char *table_type)
static char *primary_key_fields(const char *table_name) static char *primary_key_fields(const char *table_name)
{ {
MYSQL_RES *res = NULL; MYSQL_RES *res= NULL;
MYSQL_ROW row; MYSQL_ROW row;
/* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */ /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
char show_keys_buff[15 + NAME_LEN * 2 + 3]; char show_keys_buff[15 + NAME_LEN * 2 + 3];
uint result_length = 0; uint result_length= 0;
char *result = 0; char *result= 0;
char buff[NAME_LEN * 2 + 3];
char *quoted_field;
my_snprintf(show_keys_buff, sizeof(show_keys_buff), my_snprintf(show_keys_buff, sizeof(show_keys_buff),
"SHOW KEYS FROM %s", table_name); "SHOW KEYS FROM %s", table_name);
if (mysql_query(mysql, show_keys_buff) || if (mysql_query(mysql, show_keys_buff) ||
!(res = mysql_store_result(mysql))) !(res= mysql_store_result(mysql)))
{ {
fprintf(stderr, "Warning: Couldn't read keys from table %s;" fprintf(stderr, "Warning: Couldn't read keys from table %s;"
" records are NOT sorted (%s)\n", " records are NOT sorted (%s)\n",
@ -3612,12 +3614,14 @@ static char *primary_key_fields(const char *table_name)
* row, and UNIQUE keys come before others. So we only need to check * row, and UNIQUE keys come before others. So we only need to check
* the first key, not all keys. * the first key, not all keys.
*/ */
if ((row = mysql_fetch_row(res)) && atoi(row[1]) == 0) if ((row= mysql_fetch_row(res)) && atoi(row[1]) == 0)
{ {
/* Key is unique */ /* Key is unique */
do do
result_length += strlen(row[4]) + 1; /* + 1 for ',' or \0 */ {
while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1); quoted_field= quote_name(row[4], buff, 0);
result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
} while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
} }
/* Build the ORDER BY clause result */ /* Build the ORDER BY clause result */
@ -3625,17 +3629,21 @@ static char *primary_key_fields(const char *table_name)
{ {
char *end; char *end;
/* result (terminating \0 is already in result_length) */ /* result (terminating \0 is already in result_length) */
result = my_malloc(result_length + 10, MYF(MY_WME)); result= my_malloc(result_length + 10, MYF(MY_WME));
if (!result) if (!result)
{ {
fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n"); fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n");
goto cleanup; goto cleanup;
} }
mysql_data_seek(res, 0); mysql_data_seek(res, 0);
row = mysql_fetch_row(res); row= mysql_fetch_row(res);
end = strmov(result, row[4]); quoted_field= quote_name(row[4], buff, 0);
while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1) end= strmov(result, quoted_field);
end = strxmov(end, ",", row[4], NullS); while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1)
{
quoted_field= quote_name(row[4], buff, 0);
end= strxmov(end, ",", quoted_field, NullS);
}
} }
cleanup: cleanup:
@ -3703,7 +3711,7 @@ static my_bool get_view_structure(char *table, char* db)
char table_buff[NAME_LEN*2+3]; char table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3];
char query[QUERY_LENGTH]; char query[QUERY_LENGTH];
FILE *sql_file = md_result_file; FILE *sql_file= md_result_file;
DBUG_ENTER("get_view_structure"); DBUG_ENTER("get_view_structure");
if (opt_no_create_info) /* Don't write table creation info */ if (opt_no_create_info) /* Don't write table creation info */

View File

@ -280,6 +280,8 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[
_MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
AC_SUBST([mysql_se_dirs]) AC_SUBST([mysql_se_dirs])
AC_SUBST([mysql_pg_dirs]) AC_SUBST([mysql_pg_dirs])
AC_SUBST([mysql_se_unittest_dirs])
AC_SUBST([mysql_pg_unittest_dirs])
]) ])
]) ])
]) ])
@ -410,9 +412,15 @@ dnl Although this is "pretty", it breaks libmysqld build
[AC_CONFIG_FILES($6/Makefile)] [AC_CONFIG_FILES($6/Makefile)]
) )
ifelse(m4_substr($6, 0, 8), [storage/], ifelse(m4_substr($6, 0, 8), [storage/],
[mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)", [
[mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)"
mysql_se_unittest_dirs="$mysql_se_unittest_dirs ../$6"
],
m4_substr($6, 0, 7), [plugin/], m4_substr($6, 0, 7), [plugin/],
[mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)", [
[mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)"
mysql_pg_unittest_dirs="$mysql_pg_unittest_dirs ../$6"
],
[AC_FATAL([don't know how to handle plugin dir ]$6)]) [AC_FATAL([don't know how to handle plugin dir ]$6)])
fi fi
]) ])

View File

@ -59,24 +59,4 @@ insert into t1 values(null);
select * from t1; select * from t1;
drop table t1; drop table t1;
# Test of binlogging of INSERT_ID with INSERT DELAYED -- source extra/binlog_tests/binlog_insert_delayed.test
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
# First, avoid BUG#20627:
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
# Verify that only one INSERT_ID event is binlogged.
insert delayed into t1 values (207);
# We use sleeps between statements, that's the only way to get a
# repeatable binlog in a normal test run and under Valgrind.
# It may be that the "binlog missing rows" of BUG#20821 shows up
# here.
sleep 2;
insert delayed into t1 values (null);
sleep 2;
insert delayed into t1 values (300);
sleep 2; # time for the delayed queries to reach disk
select * from t1;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events from 102;
drop table t1;

View File

@ -0,0 +1,28 @@
# Test of binlogging of INSERT_ID with INSERT DELAYED
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
# First, avoid BUG#20627:
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
# Verify that only one INSERT_ID event is binlogged.
# Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed
insert delayed into t1 values (207);
# We use sleeps between statements, that's the only way to get a
# repeatable binlog in a normal test run and under Valgrind. The
# reason is that without sleeps, rows of different INSERT DELAYEDs
# sometimes group together and sometimes not, so the table may be
# unlocked/relocked causing a different number of table map log
# events.
sleep 2;
insert delayed into t1 values (null);
sleep 2;
insert delayed into t1 values (300);
sleep 2; # time for the delayed queries to reach disk
insert delayed into t1 values (null),(null),(null),(null);
sleep 2;
insert delayed into t1 values (null),(null),(400),(null);
sleep 2;
select * from t1;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events from 102;
drop table t1;

View File

@ -31,4 +31,4 @@ connection master;
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS t1,t2,t3; DROP TABLE IF EXISTS t1,t2,t3;
SET FOREIGN_KEY_CHECKS=1; SET FOREIGN_KEY_CHECKS=1;
sync_slave_with_master;

View File

@ -9,8 +9,21 @@
# column and index but without primary key. # column and index but without primary key.
############################################################## ##############################################################
--echo #
--echo # Setup
--echo #
# We also check how the foreign_key_check variable is replicated use test;
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
--echo #
--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
--echo # are replicated well
--echo #
--echo # We also check how the foreign_key_check variable is replicated
--echo #
-- source include/master-slave.inc -- source include/master-slave.inc
#should work for both SBR and RBR #should work for both SBR and RBR
@ -49,7 +62,9 @@ select * from t1;
select * from t2; select * from t2;
connection master; connection master;
# check if INSERT SELECT in auto_increment is well replicated (bug #490) --echo #
--echo # check if INSERT SELECT in auto_increment is well replicated (bug #490)
--echo #
drop table t2; drop table t2;
drop table t1; drop table t1;
@ -72,10 +87,11 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
# --echo #
# Bug#8412: Error codes reported in binary log for CHARACTER SET, --echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS --echo # FOREIGN_KEY_CHECKS
# --echo #
connection master; connection master;
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
@ -88,11 +104,10 @@ connection master;
drop table t1; drop table t1;
sync_slave_with_master; sync_slave_with_master;
# End of 4.1 tests --echo #
--echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID
# --echo #
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
#
connection master; connection master;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(a int); create table t2(a int);
@ -107,11 +122,16 @@ connection master;
drop table t1; drop table t1;
drop table t2; drop table t2;
# --echo #
# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0 --echo # End of 4.1 tests
# --echo #
# The solution is not to reset last_insert_id on enter to sub-statement.
# --echo #
--echo # BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
--echo #
--echo # The solution is not to reset last_insert_id on enter to sub-statement.
--echo #
connection master; connection master;
--disable_warnings --disable_warnings
drop function if exists bug15728; drop function if exists bug15728;
@ -254,12 +274,16 @@ select * from t1 order by n;
connection master; connection master;
drop table t1; drop table t1;
sync_slave_with_master;
# End of 5.0 tests --echo #
--echo # End of 5.0 tests
--echo #
# Test for BUG#20341 "stored function inserting into one # Test for BUG#20341 "stored function inserting into one
# auto_increment puts bad data in slave" # auto_increment puts bad data in slave"
connection master;
truncate table t2; truncate table t2;
create table t1 (id tinyint primary key); # no auto_increment create table t1 (id tinyint primary key); # no auto_increment
@ -289,8 +313,30 @@ select * from t1;
select * from t2; select * from t2;
connection master; connection master;
drop table t1, t2; drop table t1;
drop function insid; drop function insid;
sync_slave_with_master; truncate table t2;
create table t1 (n int primary key auto_increment not null,
b int, unique(b));
delimiter |;
create procedure foo()
begin
insert into t1 values(null,10);
insert ignore into t1 values(null,10);
insert ignore into t1 values(null,10);
insert into t2 values(null,3);
end|
delimiter ;|
call foo();
select * from t1;
select * from t2;
sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
drop table t1, t2;
drop procedure foo;
sync_slave_with_master;

View File

@ -1,5 +1,5 @@
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# See if replication of a "LOAD DATA in an autoincrement column" # See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values # Honours autoincrement values

View File

@ -9,7 +9,10 @@
connection slave; connection slave;
stop slave; stop slave;
connection master; connection master;
# Generate a big enough master's binlog to cause relay log rotations
--echo #
--echo # Generate a big enough master's binlog to cause relay log rotations
--echo #
create table t1 (a int); create table t1 (a int);
let $1=800; let $1=800;
@ -26,6 +29,11 @@ drop table t1;
save_master_pos; save_master_pos;
connection slave; connection slave;
reset slave; reset slave;
--echo #
--echo # Test 1
--echo #
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096 set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@ -33,7 +41,13 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 2
--echo #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
@ -42,7 +56,13 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 3: max_relay_log_size = 0
--echo #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
@ -51,9 +71,12 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status; show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions --echo #
--echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
--echo #
stop slave; stop slave;
reset slave; reset slave;
@ -62,8 +85,13 @@ reset slave;
flush logs; flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 5
--echo #
reset slave; reset slave;
start slave; start slave;
sync_with_master; sync_with_master;
@ -78,8 +106,13 @@ connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status; show slave status;
# one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #
--echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #
flush logs; flush logs;
connection master; connection master;
drop table t1; drop table t1;
@ -88,6 +121,7 @@ connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status; show slave status;
connection master; connection master;
@ -95,3 +129,7 @@ connection master;
flush logs; flush logs;
-- replace_column 3 <Binlog_Ignore_DB> -- replace_column 3 <Binlog_Ignore_DB>
show master status; show master status;
--echo #
--echo # End of 4.1 tests
--echo #

View File

@ -3,27 +3,51 @@
# Consider making these part of the basic RBR tests. # Consider making these part of the basic RBR tests.
-- source include/have_binlog_format_row.inc connection master;
-- source include/master-slave.inc --disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t9;
--enable_query_log
--enable_warnings
sync_slave_with_master;
STOP SLAVE;
SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
START SLAVE;
connection master; connection master;
eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type; eval CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
eval CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
eval CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
eval CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type; eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
eval CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type; eval CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type; eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
eval CREATE TABLE t5 (a INT, b INT, c INT) ENGINE=$engine_type; eval CREATE TABLE t5 (a INT, b INT, c INT) ENGINE=$engine_type;
eval CREATE TABLE t6 (a INT, b INT, c INT) ENGINE=$engine_type; eval CREATE TABLE t6 (a INT, b INT, c INT) ENGINE=$engine_type;
eval CREATE TABLE t7 (a INT NOT NULL) ENGINE=$engine_type;
eval CREATE TABLE t8 (a INT NOT NULL) ENGINE=$engine_type;
# Table used to detect that slave is running # Table used to detect that slave is running
eval CREATE TABLE t9 (a INT PRIMARY KEY) ENGINE=$engine_type; eval CREATE TABLE t9 (a INT) ENGINE=$engine_type;
sync_slave_with_master; sync_slave_with_master;
# On the slave, we add one column last in table 't1',
ALTER TABLE t1 ADD x INT DEFAULT 42; # On the slave, we add one INT column last in table 't1_int',
# ... add one column in the middle of table 't2', and ALTER TABLE t1_int ADD x INT DEFAULT 42;
ALTER TABLE t2 ADD x INT DEFAULT 42 AFTER a; # ... and add BIT columns last in table 't1_bit' to ensure that we
# ... add one column first in table 't3'. # have at least one extra null byte on the slave,
ALTER TABLE t3 ADD x INT DEFAULT 42 FIRST; ALTER TABLE t1_bit
ADD x BIT(3) DEFAULT b'011',
ADD y BIT(5) DEFAULT b'10101',
ADD z BIT(2) DEFAULT b'10';
# ... and add one CHAR column last in table 't1_char',
ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
# ... and add one non-nullable INT column last in table 't1_text'
# with no default,
ALTER TABLE t1_nodef ADD x INT NOT NULL;
# ... and remove the last column in t2
ALTER TABLE t2 DROP b;
# ... change the type of the single column in table 't4' # ... change the type of the single column in table 't4'
ALTER TABLE t4 MODIFY a FLOAT; ALTER TABLE t4 MODIFY a FLOAT;
# ... change the type of the middle column of table 't5' # ... change the type of the middle column of table 't5'
@ -31,19 +55,67 @@ ALTER TABLE t5 MODIFY b FLOAT;
# ... change the type of the last column of table 't6' # ... change the type of the last column of table 't6'
ALTER TABLE t6 MODIFY c FLOAT; ALTER TABLE t6 MODIFY c FLOAT;
# Each of these should generate an error and stop the slave # ... add one byte worth of null bytes to the table on the slave
ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
# ... add 8 columns that are nullable: t8 will not be entirely
# nullable and have no null bits (just an X bit)
ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
# Insert some values for tables on slave side. These should not be
# modified when the row from the master is applied.
INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
--echo **** On Master ****
connection master; connection master;
INSERT INTO t9 VALUES (1); INSERT INTO t1_int VALUES (1,2);
INSERT INTO t1_int VALUES (2,5);
INSERT INTO t1_bit VALUES (1,2);
INSERT INTO t1_bit VALUES (2,5);
INSERT INTO t1_char VALUES (1,2);
INSERT INTO t1_char VALUES (2,5);
SELECT * FROM t1_int;
SELECT * FROM t1_bit;
SELECT * FROM t1_char;
--echo **** On Slave ****
sync_slave_with_master;
SELECT a,b,x FROM t1_int;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
SELECT a,b,x FROM t1_char;
--echo **** On Master ****
connection master;
UPDATE t1_int SET b=2*b WHERE a=2;
UPDATE t1_char SET b=2*b WHERE a=2;
UPDATE t1_bit SET b=2*b WHERE a=2;
SELECT * FROM t1_int;
SELECT * FROM t1_bit;
SELECT * FROM t1_char;
--echo **** On Slave ****
sync_slave_with_master;
SELECT a,b,x FROM t1_int;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
SELECT a,b,x FROM t1_char;
# Each of these inserts should generate an error and stop the slave
connection master;
INSERT INTO t9 VALUES (2);
sync_slave_with_master; sync_slave_with_master;
# Now slave is guaranteed to be running # Now slave is guaranteed to be running
connection master; connection master;
INSERT INTO t1 VALUES (1,2); INSERT INTO t1_nodef VALUES (1,2);
connection slave; connection slave;
wait_for_slave_to_stop; wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--vertical_results --query_vertical SHOW SLAVE STATUS
SHOW SLAVE STATUS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE; START SLAVE;
@ -56,24 +128,8 @@ INSERT INTO t2 VALUES (2,4);
connection slave; connection slave;
wait_for_slave_to_stop; wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--vertical_results --query_vertical SHOW SLAVE STATUS
SHOW SLAVE STATUS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
connection master;
INSERT INTO t9 VALUES (3);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
INSERT INTO t3 VALUES (3,6);
connection slave;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
SHOW SLAVE STATUS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE; START SLAVE;
@ -86,9 +142,8 @@ INSERT INTO t4 VALUES (4);
connection slave; connection slave;
wait_for_slave_to_stop; wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--vertical_results --query_vertical SHOW SLAVE STATUS
SHOW SLAVE STATUS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE; START SLAVE;
@ -101,9 +156,8 @@ INSERT INTO t5 VALUES (5,10,25);
connection slave; connection slave;
wait_for_slave_to_stop; wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--vertical_results --query_vertical SHOW SLAVE STATUS
SHOW SLAVE STATUS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE; START SLAVE;
@ -116,14 +170,71 @@ INSERT INTO t6 VALUES (6,12,36);
connection slave; connection slave;
wait_for_slave_to_stop; wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--vertical_results --query_vertical SHOW SLAVE STATUS
SHOW SLAVE STATUS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE; START SLAVE;
connection master;
INSERT INTO t9 VALUES (6);
sync_slave_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
# Testing some tables extra field that can be null and cannot be null
# (but have default values)
connection master;
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7;
SELECT * FROM t8;
sync_slave_with_master;
SELECT * FROM t7;
SELECT * FROM t8;
# We will now try to update and then delete a row on the master where
# the extra field on the slave does not have a default value. This
# update should not generate an error even though there is no default
# for the extra column.
--echo **** On Master ****
connection master;
TRUNCATE t1_nodef;
SET SQL_LOG_BIN=0;
INSERT INTO t1_nodef VALUES (1,2);
INSERT INTO t1_nodef VALUES (2,4);
SET SQL_LOG_BIN=1;
sync_slave_with_master;
--echo **** On Slave ****
connection slave;
INSERT INTO t1_nodef VALUES (1,2,3);
INSERT INTO t1_nodef VALUES (2,4,6);
--echo **** On Master ****
connection master;
UPDATE t1_nodef SET b=2*b WHERE a=1;
SELECT * FROM t1_nodef;
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1_nodef;
--echo **** On Master ****
connection master;
DELETE FROM t1_nodef WHERE a=2;
SELECT * FROM t1_nodef;
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1_nodef;
--echo **** Cleanup ****
connection master; connection master;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t9; DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings --enable_warnings
sync_slave_with_master; sync_slave_with_master;

View File

@ -1,4 +1,4 @@
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
create table t1 (word char(20) not null); create table t1 (word char(20) not null);

View File

@ -2,7 +2,7 @@
# This test will fail if the server/client does not support enough charsets. # This test will fail if the server/client does not support enough charsets.
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings --disable_warnings

View File

@ -0,0 +1,4 @@
-- require r/have_binlog_format_mixed.require
disable_query_log;
show variables like "binlog_format";
enable_query_log;

View File

@ -0,0 +1,5 @@
--require r/have_binlog_format_statement.require
--disable_query_log
--replace_result MIXED STATEMENT
show variables like "binlog_format";
--enable_query_log

View File

@ -28,7 +28,6 @@ INSERT INTO t1 VALUES(412,1,'Testing MySQL databases is a cool ',
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
sync_slave_with_master; sync_slave_with_master;
--sleep 5
--echo --- Select from t1 on slave --- --echo --- Select from t1 on slave ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@ -44,7 +43,6 @@ SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
# into the binlog other wise we will miss the update. # into the binlog other wise we will miss the update.
sync_slave_with_master; sync_slave_with_master;
--sleep 5
--echo --- Check Update on slave --- --echo --- Check Update on slave ---
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
@ -56,7 +54,6 @@ DELETE FROM t1 WHERE id = 42;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
sync_slave_with_master; sync_slave_with_master;
--sleep 5
--echo --- Show current count on slave for t1 --- --echo --- Show current count on slave for t1 ---
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;

View File

@ -0,0 +1,23 @@
# to mask out the error - never abort neither log in result file - in setting
# to read-only variable.
# It is assumed that the new value is equal to one the var was set to.
# Such situation happens particularily with binlog_format that becomes read-only
# with ndb default storage.
#
# when generate results always watch the file to find what is expected,
# the SET query may fail
# script accepts $maybe_ro_var the var name and $val4var the value
### USAGE:
### let $maybe_ro_var= ...
### let $val4var= ...
### include/safe_set_to_maybe_ro_var.inc
--disable_result_log
--disable_abort_on_error
eval SET $maybe_ro_var = $val4var;
--enable_abort_on_error
--enable_result_log
eval SELECT $maybe_ro_var;

View File

@ -250,11 +250,21 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207); insert delayed into t1 values (207);
insert delayed into t1 values (null); insert delayed into t1 values (null);
insert delayed into t1 values (300); insert delayed into t1 values (300);
insert delayed into t1 values (null),(null),(null),(null);
insert delayed into t1 values (null),(null),(400),(null);
select * from t1; select * from t1;
a a
207 207
208 208
300 300
301
302
303
304
305
306
400
401
show binlog events from 102; show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key)
@ -268,4 +278,12 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
drop table t1; drop table t1;

View File

@ -0,0 +1,32 @@
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207);
insert delayed into t1 values (null);
insert delayed into t1 values (300);
insert delayed into t1 values (null),(null),(null),(null);
insert delayed into t1 values (null),(null),(400),(null);
select * from t1;
a
207
208
300
301
302
303
304
305
306
400
401
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207)
master-bin.000001 # Intvar 1 # INSERT_ID=208
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null)
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300)
master-bin.000001 # Intvar 1 # INSERT_ID=301
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null),(null),(null),(null)
master-bin.000001 # Intvar 1 # INSERT_ID=305
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null),(null),(400),(null)
drop table t1;

View File

@ -160,11 +160,21 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207); insert delayed into t1 values (207);
insert delayed into t1 values (null); insert delayed into t1 values (null);
insert delayed into t1 values (300); insert delayed into t1 values (300);
insert delayed into t1 values (null),(null),(null),(null);
insert delayed into t1 values (null),(null),(400),(null);
select * from t1; select * from t1;
a a
207 207
208 208
300 300
301
302
303
304
305
306
400
401
show binlog events from 102; show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key)
@ -172,8 +182,18 @@ master-bin.000001 # Intvar 1 # INSERT_ID=127
master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) master-bin.000001 # Query 1 # use `test`; insert into t1 values(null)
master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Intvar 1 # INSERT_ID=208 master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
drop table t1; drop table t1;

View File

@ -0,0 +1,2 @@
Variable_name Value
binlog_format MIXED

View File

@ -46,6 +46,8 @@ COLUMN_PRIVILEGES
ENGINES ENGINES
EVENTS EVENTS
FILES FILES
GLOBAL_STATUS
GLOBAL_VARIABLES
KEY_COLUMN_USAGE KEY_COLUMN_USAGE
PARTITIONS PARTITIONS
PLUGINS PLUGINS
@ -54,6 +56,8 @@ REFERENTIAL_CONSTRAINTS
ROUTINES ROUTINES
SCHEMATA SCHEMATA
SCHEMA_PRIVILEGES SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
STATISTICS STATISTICS
TABLES TABLES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
@ -758,6 +762,7 @@ table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE information_schema COLUMNS COLUMN_TYPE
information_schema EVENTS EVENT_DEFINITION information_schema EVENTS EVENT_DEFINITION
information_schema EVENTS SQL_MODE information_schema EVENTS SQL_MODE
information_schema GLOBAL_VARIABLES VARIABLE_VALUE
information_schema PARTITIONS PARTITION_EXPRESSION information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION information_schema PARTITIONS SUBPARTITION_EXPRESSION
information_schema PARTITIONS PARTITION_DESCRIPTION information_schema PARTITIONS PARTITION_DESCRIPTION
@ -765,6 +770,7 @@ information_schema PLUGINS PLUGIN_DESCRIPTION
information_schema PROCESSLIST INFO information_schema PROCESSLIST INFO
information_schema ROUTINES ROUTINE_DEFINITION information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE information_schema ROUTINES SQL_MODE
information_schema SESSION_VARIABLES VARIABLE_VALUE
information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT information_schema TRIGGERS ACTION_STATEMENT
information_schema TRIGGERS SQL_MODE information_schema TRIGGERS SQL_MODE
@ -847,7 +853,7 @@ delete from mysql.db where user='mysqltest_4';
flush privileges; flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES where TABLE_SCHEMA!='cluster' GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES where TABLE_SCHEMA!='cluster' GROUP BY TABLE_SCHEMA;
table_schema count(*) table_schema count(*)
information_schema 23 information_schema 27
mysql 21 mysql 21
create table t1 (i int, j int); create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row create trigger trg1 before insert on t1 for each row
@ -1240,6 +1246,8 @@ COLUMN_PRIVILEGES TABLE_SCHEMA
ENGINES ENGINE ENGINES ENGINE
EVENTS EVENT_SCHEMA EVENTS EVENT_SCHEMA
FILES TABLE_SCHEMA FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARTITIONS TABLE_SCHEMA PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME PLUGINS PLUGIN_NAME
@ -1248,6 +1256,8 @@ REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME SCHEMATA SCHEMA_NAME
SCHEMA_PRIVILEGES TABLE_SCHEMA SCHEMA_PRIVILEGES TABLE_SCHEMA
SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA TABLES TABLE_SCHEMA
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
@ -1278,6 +1288,8 @@ COLUMN_PRIVILEGES TABLE_SCHEMA
ENGINES ENGINE ENGINES ENGINE
EVENTS EVENT_SCHEMA EVENTS EVENT_SCHEMA
FILES TABLE_SCHEMA FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARTITIONS TABLE_SCHEMA PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME PLUGINS PLUGIN_NAME
@ -1286,6 +1298,8 @@ REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME SCHEMATA SCHEMA_NAME
SCHEMA_PRIVILEGES TABLE_SCHEMA SCHEMA_PRIVILEGES TABLE_SCHEMA
SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA TABLES TABLE_SCHEMA
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA TABLE_CONSTRAINTS CONSTRAINT_SCHEMA

View File

@ -13,6 +13,8 @@ COLUMN_PRIVILEGES
ENGINES ENGINES
EVENTS EVENTS
FILES FILES
GLOBAL_STATUS
GLOBAL_VARIABLES
KEY_COLUMN_USAGE KEY_COLUMN_USAGE
PARTITIONS PARTITIONS
PLUGINS PLUGINS
@ -21,6 +23,8 @@ REFERENTIAL_CONSTRAINTS
ROUTINES ROUTINES
SCHEMATA SCHEMATA
SCHEMA_PRIVILEGES SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
STATISTICS STATISTICS
TABLES TABLES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS

View File

@ -23,6 +23,9 @@ INSERT INTO t1 VALUES (1), (2);
</database> </database>
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
#
# Bug #2005
#
CREATE TABLE t1 (a decimal(64, 20)); CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321"); ("0987654321098765432109876543210987654321");
@ -31,6 +34,9 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000'); INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1; DROP TABLE t1;
#
# Bug #2055
#
CREATE TABLE t1 (a double); CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999'); INSERT INTO t1 VALUES ('-9e999999');
Warnings: Warnings:
@ -40,6 +46,9 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES (RES); INSERT INTO `t1` VALUES (RES);
DROP TABLE t1; DROP TABLE t1;
#
# Bug #3361 mysqldump quotes DECIMAL values inconsistently
#
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT); CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
INSERT INTO t1 VALUES (1.2345, 2.3456); INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456); INSERT INTO t1 VALUES ('1.2345', 2.3456);
@ -137,6 +146,9 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
</database> </database>
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
#
# Bug #1707
#
CREATE TABLE t1 (`a"b"` char(2)); CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2"); INSERT INTO t1 VALUES ("1\""), ("\"2");
<?xml version="1.0"?> <?xml version="1.0"?>
@ -156,6 +168,10 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
</database> </database>
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
#
# Bug #1994
# Bug #4261
#
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
@ -191,6 +207,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #2634
#
CREATE TABLE t1 (a int) ENGINE=MYISAM; CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
@ -240,11 +259,17 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
#
create table ```a` (i int); create table ```a` (i int);
CREATE TABLE ```a` ( CREATE TABLE ```a` (
`i` int(11) DEFAULT NULL `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table ```a`; drop table ```a`;
#
# Bug #2591 "mysqldump quotes names inconsistently"
#
create table t1(a int); create table t1(a int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@ -353,6 +378,9 @@ UNLOCK TABLES;
set global sql_mode=''; set global sql_mode='';
drop table t1; drop table t1;
#
# Bug #2705 'mysqldump --tab extra output'
#
create table t1(a int); create table t1(a int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
@ -381,6 +409,9 @@ CREATE TABLE `t1` (
2 2
3 3
drop table t1; drop table t1;
#
# Bug #6101: create database problem
#
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -433,6 +464,12 @@ USE `mysqldump_test_db`;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop database mysqldump_test_db; drop database mysqldump_test_db;
#
# Bug #7020
# Check that we don't dump in UTF8 in compatible mode by default,
# but use the default compiled values, or the values given in
# --default-character-set=xxx. However, we should dump in UTF8
# if it is explicitely set.
CREATE TABLE t1 (a CHAR(10)); CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 '<27><><EFBFBD><EFBFBD>'); INSERT INTO t1 VALUES (_latin1 '<27><><EFBFBD><EFBFBD>');
@ -466,6 +503,13 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
#
# Bug#8063: make test mysqldump [ fail ]
# We cannot tes this command because its output depends
# on --default-character-set incompiled into "mysqldump" program.
# If the future we can move this command into a separate test with
# checking that "mysqldump" is compiled with "latin1"
#
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */; /*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
@ -536,6 +580,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# WL #2319: Exclude Tables from dump
#
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
@ -573,6 +620,9 @@ UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
#
# Bug #8830
#
CREATE TABLE t1 (`b` blob); CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A); INSERT INTO `t1` VALUES (0x602010000280100005E71A);
@ -607,6 +657,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# Test for --insert-ignore
#
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6); INSERT INTO t1 VALUES (4),(5),(6);
@ -671,6 +724,10 @@ INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #10286: mysqldump -c crashes on table that has many fields with long
# names
#
create table t1 ( create table t1 (
F_c4ca4238a0b923820dcc509a6f75849b int, F_c4ca4238a0b923820dcc509a6f75849b int,
F_c81e728d9d4c2f636f067f89cc14862c int, F_c81e728d9d4c2f636f067f89cc14862c int,
@ -1364,6 +1421,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1; drop table t1;
#
# Test for --add-drop-database
#
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
@ -1404,6 +1464,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
#
CREATE DATABASE mysqldump_test_db; CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db; USE mysqldump_test_db;
CREATE TABLE t1 ( a INT ); CREATE TABLE t1 ( a INT );
@ -1492,6 +1555,11 @@ CREATE TABLE `t2` (
</mysqldump> </mysqldump>
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP DATABASE mysqldump_test_db; DROP DATABASE mysqldump_test_db;
#
# Testing with tables and databases that don't exists
# or contains illegal characters
# (Bug #9358 mysqldump crashes if tablename starts with \)
#
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
create table t1(a varchar(30) primary key, b int not null); create table t1(a varchar(30) primary key, b int not null);
@ -1530,6 +1598,9 @@ mysqldump: Got error: 1049: Unknown database 'mysqld\ump_test_db' when selecting
drop table t1, t2, t3; drop table t1, t2, t3;
drop database mysqldump_test_db; drop database mysqldump_test_db;
use test; use test;
#
# Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
#
create table t1 (a int(10)); create table t1 (a int(10));
create table t2 (pk int primary key auto_increment, create table t2 (pk int primary key auto_increment,
a int(10), b varchar(30), c datetime, d blob, e text); a int(10), b varchar(30), c datetime, d blob, e text);
@ -1586,6 +1657,9 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
</database> </database>
</mysqldump> </mysqldump>
drop table t1, t2; drop table t1, t2;
#
# BUG #12123
#
create table t1 (a text character set utf8, b text character set latin1); create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1; select * from t1;
@ -1596,7 +1670,13 @@ select * from t1;
a b a b
Osnabr<EFBFBD>ck K<>ln Osnabr<EFBFBD>ck K<>ln
drop table t1; drop table t1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--fields-optionally-enclosed-by=" --fields-optionally-enclosed-by="
#
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
#
create table `t1` ( create table `t1` (
t1_name varchar(255) default null, t1_name varchar(255) default null,
t1_id int(10) unsigned not null auto_increment, t1_id int(10) unsigned not null auto_increment,
@ -1634,6 +1714,9 @@ t1 CREATE TABLE `t1` (
KEY `t1_name` (`t1_name`) KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 ) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
drop table `t1`; drop table `t1`;
#
# Bug #18536: wrong table order
#
create table t1(a int); create table t1(a int);
create table t2(a int); create table t2(a int);
create table t3(a int); create table t3(a int);
@ -1671,6 +1754,9 @@ CREATE TABLE `t2` (
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Bug #21288: mysqldump segmentation fault when using --where
#
create table t1 (a int); create table t1 (a int);
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
@ -1702,6 +1788,9 @@ CREATE TABLE `t1` (
drop table t1; drop table t1;
End of 4.1 tests End of 4.1 tests
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database db1; create database db1;
use db1; use db1;
CREATE TABLE t2 ( CREATE TABLE t2 (
@ -1761,6 +1850,9 @@ drop table t2;
drop view v2; drop view v2;
drop database db1; drop database db1;
use test; use test;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
#
create database db2; create database db2;
use db2; use db2;
create table t1 (a int); create table t1 (a int);
@ -1790,6 +1882,9 @@ a b
drop table t1, t2; drop table t1, t2;
drop database db1; drop database db1;
use test; use test;
#
# dump of view
#
create table t1(a int); create table t1(a int);
create view v1 as select * from t1; create view v1 as select * from t1;
@ -1834,6 +1929,9 @@ DROP TABLE IF EXISTS `v1`;
drop view v1; drop view v1;
drop table t1; drop table t1;
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
CREATE TABLE t2 ( CREATE TABLE t2 (
@ -1893,6 +1991,9 @@ drop table t2;
drop view v2; drop view v2;
drop database mysqldump_test_db; drop database mysqldump_test_db;
use test; use test;
#
# Bug #9756
#
CREATE TABLE t1 (a char(10)); CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\''); INSERT INTO t1 VALUES ('\'');
@ -1927,6 +2028,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #10927 mysqldump: Can't reload dump with view that consist of other view
#
create table t1(a int, b int, c varchar(30)); create table t1(a int, b int, c varchar(30));
insert into t1 values(1, 2, "one"), (2, 4, "two"), (3, 6, "three"); insert into t1 values(1, 2, "one"), (2, 4, "two"), (3, 6, "three");
create view v3 as create view v3 as
@ -2004,6 +2108,9 @@ DROP TABLE IF EXISTS `v3`;
drop view v1, v2, v3; drop view v1, v2, v3;
drop table t1; drop table t1;
#
# Test for dumping triggers
#
CREATE TABLE t1 (a int, b bigint default NULL); CREATE TABLE t1 (a int, b bigint default NULL);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
create trigger trg1 before insert on t1 for each row create trigger trg1 before insert on t1 for each row
@ -2202,8 +2309,14 @@ set @fired:= "No";
end if; end if;
end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bugs #9136, #12917: problems with --defaults-extra-file option
#
--port=1234 --port=1234
--port=1234 --port=1234
#
# Test of fix to BUG 12597
#
DROP TABLE IF EXISTS `test1`; DROP TABLE IF EXISTS `test1`;
Warnings: Warnings:
Note 1051 Unknown table 'test1' Note 1051 Unknown table 'test1'
@ -2235,6 +2348,9 @@ a2
DROP TRIGGER testref; DROP TRIGGER testref;
DROP TABLE test1; DROP TABLE test1;
DROP TABLE test2; DROP TABLE test2;
#
# BUG#9056 - mysqldump does not dump routines
#
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS bug9056_func1; DROP FUNCTION IF EXISTS bug9056_func1;
DROP FUNCTION IF EXISTS bug9056_func2; DROP FUNCTION IF EXISTS bug9056_func2;
@ -2331,6 +2447,9 @@ DROP PROCEDURE bug9056_proc1;
DROP PROCEDURE bug9056_proc2; DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`; DROP PROCEDURE `a'b`;
drop table t1; drop table t1;
#
# BUG# 13052 - mysqldump timestamp reloads broken
#
drop table if exists t1; drop table if exists t1;
create table t1 (`d` timestamp, unique (`d`)); create table t1 (`d` timestamp, unique (`d`));
set time_zone='+00:00'; set time_zone='+00:00';
@ -2417,6 +2536,9 @@ UNLOCK TABLES;
drop table t1; drop table t1;
set global time_zone=default; set global time_zone=default;
set time_zone=default; set time_zone=default;
#
# Test of fix to BUG 13146 - ansi quotes break loading of triggers
#
DROP TABLE IF EXISTS `t1 test`; DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`; DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t1 test` ( CREATE TABLE `t1 test` (
@ -2480,6 +2602,9 @@ UNLOCK TABLES;
DROP TRIGGER `test trig`; DROP TRIGGER `test trig`;
DROP TABLE `t1 test`; DROP TABLE `t1 test`;
DROP TABLE `t2 test`; DROP TABLE `t2 test`;
#
# BUG# 12838 mysqldump -x with views exits with error
#
drop table if exists t1; drop table if exists t1;
create table t1 (a int, b varchar(32), c varchar(32)); create table t1 (a int, b varchar(32), c varchar(32));
insert into t1 values (1, 'first value', 'xxxx'); insert into t1 values (1, 'first value', 'xxxx');
@ -2572,6 +2697,10 @@ drop view v2;
drop view v0; drop view v0;
drop view v1; drop view v1;
drop table t1; drop table t1;
#
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode.
#
SET @old_sql_mode = @@SQL_MODE; SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE; SET SQL_MODE = IGNORE_SPACE;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -2627,6 +2756,9 @@ DELIMITER ;
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #13318: Bad result with empty field and --hex-blob
#
create table t1 (a binary(1), b blob); create table t1 (a binary(1), b blob);
insert into t1 values ('',''); insert into t1 values ('','');
@ -2694,6 +2826,9 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1; drop table t1;
#
# Bug 14871 Invalid view dump output
#
create table t1 (a int); create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789); insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1; create definer = CURRENT_USER view v1 as select * from t1;
@ -2720,6 +2855,9 @@ a
789 789
drop table t1; drop table t1;
drop view v1, v2, v3, v4, v5; drop view v1, v2, v3, v4, v5;
#
# Bug #16878 dump of trigger
#
create table t1 (a int, created datetime); create table t1 (a int, created datetime);
create table t2 (b int, created datetime); create table t2 (b int, created datetime);
create trigger tr1 before insert on t1 for each row set create trigger tr1 before insert on t1 for each row set
@ -2742,6 +2880,9 @@ end AFTER # root@localhost
drop trigger tr1; drop trigger tr1;
drop trigger tr2; drop trigger tr2;
drop table t1, t2; drop table t1, t2;
#
# Bug#18462 mysqldump does not dump view structures correctly
#
create table t (qty int, price int); create table t (qty int, price int);
insert into t values(3, 50); insert into t values(3, 50);
insert into t values(5, 51); insert into t values(5, 51);
@ -2761,6 +2902,10 @@ mysqldump {
drop view v1; drop view v1;
drop view v2; drop view v2;
drop table t; drop table t;
#
# Bug#14857 Reading dump files with single statement stored routines fails.
# fixed by patch for bug#16878
#
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20) /*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */| return 42 */|
/*!50003 CREATE PROCEDURE `p`() /*!50003 CREATE PROCEDURE `p`()
@ -2775,6 +2920,9 @@ p CREATE DEFINER=`root`@`localhost` PROCEDURE `p`()
select 42 select 42
drop function f; drop function f;
drop procedure p; drop procedure p;
#
# Bug #17371 Unable to dump a schema with invalid views
#
create table t1 ( id serial ); create table t1 ( id serial );
create view v1 as select * from t1; create view v1 as select * from t1;
drop table t1; drop table t1;
@ -2784,6 +2932,9 @@ mysqldump {
} mysqldump } mysqldump
drop view v1; drop view v1;
# BUG#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views.
# Example code from Markus Popp
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
create table t1 (id int); create table t1 (id int);
@ -2844,6 +2995,9 @@ USE `mysqldump_test_db`;
drop view v1; drop view v1;
drop table t1; drop table t1;
drop database mysqldump_test_db; drop database mysqldump_test_db;
#
# Bug21014 Segmentation fault of mysqldump on view
#
create database mysqldump_tables; create database mysqldump_tables;
use mysqldump_tables; use mysqldump_tables;
create table basetable ( id serial, tag varchar(64) ); create table basetable ( id serial, tag varchar(64) );
@ -2877,6 +3031,9 @@ drop view nasishnasifu;
drop database mysqldump_views; drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
#
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
#
create database mysqldump_dba; create database mysqldump_dba;
use mysqldump_dba; use mysqldump_dba;
create table t1 (f1 int, f2 int); create table t1 (f1 int, f2 int);
@ -2909,6 +3066,9 @@ drop view v1;
drop table t1; drop table t1;
drop database mysqldump_dbb; drop database mysqldump_dbb;
use test; use test;
#
# Bug#21215 mysqldump creating incomplete backups without warning
#
create user mysqltest_1@localhost; create user mysqltest_1@localhost;
create table t1(a int, b varchar(34)); create table t1(a int, b varchar(34));
reset master; reset master;
@ -2920,6 +3080,12 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
# Bug #21424 mysqldump failing to export/import views
#
create database mysqldump_myDB; create database mysqldump_myDB;
use mysqldump_myDB; use mysqldump_myDB;
create user myDB_User; create user myDB_User;
@ -2938,6 +3104,9 @@ revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User; drop user myDB_User;
drop database mysqldump_myDB; drop database mysqldump_myDB;
flush privileges; flush privileges;
# Bug #21424 continues from here.
# Restore. Flush Privileges test ends.
#
use mysqldump_myDB; use mysqldump_myDB;
select * from mysqldump_myDB.v1; select * from mysqldump_myDB.v1;
c1 c1
@ -2953,7 +3122,81 @@ revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User; drop user myDB_User;
drop database mysqldump_myDB; drop database mysqldump_myDB;
use test; use test;
End of 5.0 tests #
# BUG#13926: --order-by-primary fails if PKEY contains quote character
#
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a b" int(11) NOT NULL DEFAULT '0',
"c""d" int(11) NOT NULL DEFAULT '0',
"e`f" int(11) NOT NULL DEFAULT '0',
PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
INSERT INTO "t1" VALUES (815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL DEFAULT '0',
`c"d` int(11) NOT NULL DEFAULT '0',
`e``f` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE `t1`;
#
# End of 5.0 tests
#
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1(a int, b int); CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1); INSERT INTO t1 VALUES (1,1);
@ -3167,6 +3410,9 @@ mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: w
drop table t1; drop table t1;
drop table t2; drop table t2;
drop table words2; drop table words2;
#
# BUG# 16853: mysqldump doesn't show events
#
create database first; create database first;
use first; use first;
set time_zone = 'UTC'; set time_zone = 'UTC';
@ -3204,6 +3450,11 @@ third ee3 root@localhost ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLE
drop database third; drop database third;
set time_zone = 'SYSTEM'; set time_zone = 'SYSTEM';
use test; use test;
#
# BUG#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views.
# Example code from Markus Popp
#
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
create table t1 (id int); create table t1 (id int);
@ -3264,4 +3515,6 @@ USE `mysqldump_test_db`;
drop view v1; drop view v1;
drop table t1; drop table t1;
drop database mysqldump_test_db; drop database mysqldump_test_db;
End of 5.1 tests #
# End of 5.1 tests
#

View File

@ -87,6 +87,8 @@ Database: information_schema
| ENGINES | | ENGINES |
| EVENTS | | EVENTS |
| FILES | | FILES |
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE | | KEY_COLUMN_USAGE |
| PARTITIONS | | PARTITIONS |
| PLUGINS | | PLUGINS |
@ -95,6 +97,8 @@ Database: information_schema
| ROUTINES | | ROUTINES |
| SCHEMATA | | SCHEMATA |
| SCHEMA_PRIVILEGES | | SCHEMA_PRIVILEGES |
| SESSION_STATUS |
| SESSION_VARIABLES |
| STATISTICS | | STATISTICS |
| TABLES | | TABLES |
| TABLE_CONSTRAINTS | | TABLE_CONSTRAINTS |
@ -115,6 +119,8 @@ Database: INFORMATION_SCHEMA
| ENGINES | | ENGINES |
| EVENTS | | EVENTS |
| FILES | | FILES |
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE | | KEY_COLUMN_USAGE |
| PARTITIONS | | PARTITIONS |
| PLUGINS | | PLUGINS |
@ -123,6 +129,8 @@ Database: INFORMATION_SCHEMA
| ROUTINES | | ROUTINES |
| SCHEMATA | | SCHEMATA |
| SCHEMA_PRIVILEGES | | SCHEMA_PRIVILEGES |
| SESSION_STATUS |
| SESSION_VARIABLES |
| STATISTICS | | STATISTICS |
| TABLES | | TABLES |
| TABLE_CONSTRAINTS | | TABLE_CONSTRAINTS |

View File

@ -1,3 +1,6 @@
#
# Bug#20821: INSERT DELAYED fails to write some rows to binlog
#
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
@ -13,4 +16,8 @@ COUNT(*)
SELECT COUNT(*) FROM mysqlslap.t1; SELECT COUNT(*) FROM mysqlslap.t1;
COUNT(*) COUNT(*)
5000 5000
DROP SCHEMA IF EXISTS mysqlslap; #
# Cleanup
#
USE test;
DROP SCHEMA mysqlslap;

View File

@ -1,3 +1,14 @@
#
# Setup
#
use test;
drop table if exists t1, t2, t3;
#
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
#
# We also check how the foreign_key_check variable is replicated
#
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
@ -38,6 +49,9 @@ select * from t2;
b c b c
5 0 5 0
6 11 6 11
#
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
#
drop table t2; drop table t2;
drop table t1; drop table t1;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
@ -68,12 +82,19 @@ b c
9 13 9 13
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS
#
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1); INSERT INTO t1 VALUES (1),(1);
Got one of the listed errors Got one of the listed errors
drop table t1; drop table t1;
#
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
#
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(a int); create table t2(a int);
insert into t1 (a) values (null); insert into t1 (a) values (null);
@ -87,6 +108,14 @@ a
1 1
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# End of 4.1 tests
#
#
# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
#
# The solution is not to reset last_insert_id on enter to sub-statement.
#
drop function if exists bug15728; drop function if exists bug15728;
drop function if exists bug15728_insert; drop function if exists bug15728_insert;
drop table if exists t1, t2; drop table if exists t1, t2;
@ -234,6 +263,9 @@ n b
2 100 2 100
3 350 3 350
drop table t1; drop table t1;
#
# End of 5.0 tests
#
truncate table t2; truncate table t2;
create table t1 (id tinyint primary key); create table t1 (id tinyint primary key);
create function insid() returns int create function insid() returns int
@ -267,5 +299,30 @@ select * from t2;
id last_id id last_id
4 0 4 0
8 0 8 0
drop table t1, t2; drop table t1;
drop function insid; drop function insid;
truncate table t2;
create table t1 (n int primary key auto_increment not null,
b int, unique(b));
create procedure foo()
begin
insert into t1 values(null,10);
insert ignore into t1 values(null,10);
insert ignore into t1 values(null,10);
insert into t2 values(null,3);
end|
call foo();
select * from t1;
n b
1 10
select * from t2;
id last_id
1 3
select * from t1;
n b
1 10
select * from t2;
id last_id
1 3
drop table t1, t2;
drop procedure foo;

View File

@ -28,7 +28,7 @@ day id category name
2003-03-22 2416 a bbbbb 2003-03-22 2416 a bbbbb
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
slave-bin.000001 1248 slave-bin.000001 1276
drop table t1; drop table t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
@ -39,7 +39,7 @@ set global sql_slave_skip_counter=1;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1765 # # master-bin.000001 Yes Yes # 0 0 1765 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1793 # # master-bin.000001 Yes Yes # 0 0 1793 # None 0 No #
set sql_log_bin=0; set sql_log_bin=0;
delete from t1; delete from t1;
set sql_log_bin=1; set sql_log_bin=1;
@ -49,7 +49,7 @@ change master to master_user='test';
change master to master_user='root'; change master to master_user='root';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1800 # # master-bin.000001 No No # 0 0 1800 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1828 # # master-bin.000001 No No # 0 0 1828 # None 0 No #
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
start slave; start slave;
set sql_log_bin=0; set sql_log_bin=0;

View File

@ -30,16 +30,16 @@ a b
2 2 2 2
3 3 3 3
4 4 4 4
7 5 5 5
10 6 6 6
SELECT * FROM t1 ORDER BY a; SELECT * FROM t1 ORDER BY a;
a b a b
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
7 5 5 5
10 6 6 6
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int unsigned not null auto_increment primary key, a int unsigned not null auto_increment primary key,

View File

@ -5,9 +5,6 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
SET BINLOG_FORMAT=MIXED; SET BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
STATEMENT MIXED
SET GLOBAL 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

View File

@ -60,3 +60,43 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) master-bin.000001 188 Table_map 1 227 table_id: # (test.t1)
master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F
DROP TABLE t1;
================ Test for BUG#17620 ================
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** On Slave ****
SET GLOBAL QUERY_CACHE_SIZE=0;
**** On Master ****
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
**** On Slave ****
SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024;
**** On Master ****
INSERT INTO t1 VALUES (4),(5),(6);
**** On Slave ****
SELECT * FROM t1;
a
1
2
3
4
5
6
**** On Master ****
INSERT INTO t1 VALUES (7),(8),(9);
**** On Slave ****
SELECT * FROM t1;
a
1
2
3
4
5
6
7
8
9
DROP TABLE t1;

View File

@ -5,7 +5,10 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
SET BINLOG_FORMAT=ROW; SET @@BINLOG_FORMAT = ROW;
SELECT @@BINLOG_FORMAT;
@@BINLOG_FORMAT
ROW
**** Partition RANGE testing **** **** Partition RANGE testing ****
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,

View File

@ -1,3 +1,5 @@
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
@ -5,9 +7,15 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
stop slave; stop slave;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int); create table t1 (a int);
drop table t1; drop table t1;
reset slave; reset slave;
#
# Test 1
#
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; set global max_relay_log_size=8192-1;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@ -15,47 +23,251 @@ select @@global.max_relay_log_size;
4096 4096
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 58664 # # master-bin.000001 Yes Yes # 0 0 58664 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 58664
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 58664
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 2
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 20480
20480
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 58664 # # master-bin.000001 Yes Yes # 0 0 58664 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 58664
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 58664
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 3: max_relay_log_size = 0
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 0
0
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 58664 # # master-bin.000001 Yes Yes # 0 0 58664 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 58664
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 58664
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave; stop slave;
reset slave; reset slave;
flush logs; flush logs;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
Read_Master_Log_Pos 4
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 5
#
reset slave; reset slave;
start slave; start slave;
flush logs; flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 58750 # # master-bin.000001 Yes Yes # 0 0 58750 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 58750
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 58750
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 58826 # # master-bin.000001 Yes Yes # 0 0 58826 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 58826
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 58826
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
flush logs; flush logs;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File master-bin.000002
master-bin.000002 102 <Binlog_Ignore_DB> Position 102
Binlog_Do_DB <Binlog_Ignore_DB>
Binlog_Ignore_DB
#
# End of 4.1 tests
#

View File

@ -0,0 +1,381 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
STOP SLAVE;
SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
START SLAVE;
CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
CREATE TABLE t4 (a INT) ENGINE='MyISAM';
CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='MyISAM';
CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='MyISAM';
CREATE TABLE t7 (a INT NOT NULL) ENGINE='MyISAM';
CREATE TABLE t8 (a INT NOT NULL) ENGINE='MyISAM';
CREATE TABLE t9 (a INT) ENGINE='MyISAM';
ALTER TABLE t1_int ADD x INT DEFAULT 42;
ALTER TABLE t1_bit
ADD x BIT(3) DEFAULT b'011',
ADD y BIT(5) DEFAULT b'10101',
ADD z BIT(2) DEFAULT b'10';
ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
ALTER TABLE t1_nodef ADD x INT NOT NULL;
ALTER TABLE t2 DROP b;
ALTER TABLE t4 MODIFY a FLOAT;
ALTER TABLE t5 MODIFY b FLOAT;
ALTER TABLE t6 MODIFY c FLOAT;
ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
**** On Master ****
INSERT INTO t1_int VALUES (1,2);
INSERT INTO t1_int VALUES (2,5);
INSERT INTO t1_bit VALUES (1,2);
INSERT INTO t1_bit VALUES (2,5);
INSERT INTO t1_char VALUES (1,2);
INSERT INTO t1_char VALUES (2,5);
SELECT * FROM t1_int;
a b
1 2
2 5
SELECT * FROM t1_bit;
a b
1 2
2 5
SELECT * FROM t1_char;
a b
1 2
2 5
**** On Slave ****
SELECT a,b,x FROM t1_int;
a b x
2 5 4711
1 2 42
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
a b HEX(x) HEX(y) HEX(z)
2 5 5 1C 1
1 2 3 15 2
SELECT a,b,x FROM t1_char;
a b x
2 5 Foo is a bar
1 2 Just a test
**** On Master ****
UPDATE t1_int SET b=2*b WHERE a=2;
UPDATE t1_char SET b=2*b WHERE a=2;
UPDATE t1_bit SET b=2*b WHERE a=2;
SELECT * FROM t1_int;
a b
1 2
2 10
SELECT * FROM t1_bit;
a b
1 2
2 10
SELECT * FROM t1_char;
a b
1 2
2 10
**** On Slave ****
SELECT a,b,x FROM t1_int;
a b x
2 10 4711
1 2 42
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
a b HEX(x) HEX(y) HEX(z)
2 10 5 1C 1
1 2 3 15 2
SELECT a,b,x FROM t1_char;
a b x
2 10 Foo is a bar
1 2 Just a test
INSERT INTO t9 VALUES (2);
INSERT INTO t1_nodef VALUES (1,2);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1364
Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
INSERT INTO t2 VALUES (2,4);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (4);
INSERT INTO t4 VALUES (4);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
INSERT INTO t5 VALUES (5,10,25);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
INSERT INTO t6 VALUES (6,12,36);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7;
a
1
2
3
SELECT * FROM t8;
a
1
2
3
SELECT * FROM t7;
a e1 e2 e3 e4 e5 e6 e7 e8
1 NULL NULL NULL NULL NULL NULL NULL NULL
2 NULL NULL NULL NULL NULL NULL NULL NULL
3 NULL NULL NULL NULL NULL NULL NULL NULL
SELECT * FROM t8;
a e1 e2 e3 e4 e5 e6 e7 e8
1 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0
**** On Master ****
TRUNCATE t1_nodef;
SET SQL_LOG_BIN=0;
INSERT INTO t1_nodef VALUES (1,2);
INSERT INTO t1_nodef VALUES (2,4);
SET SQL_LOG_BIN=1;
**** On Slave ****
INSERT INTO t1_nodef VALUES (1,2,3);
INSERT INTO t1_nodef VALUES (2,4,6);
**** On Master ****
UPDATE t1_nodef SET b=2*b WHERE a=1;
SELECT * FROM t1_nodef;
a b
1 4
2 4
**** On Slave ****
SELECT * FROM t1_nodef;
a b x
1 4 3
2 4 6
**** On Master ****
DELETE FROM t1_nodef WHERE a=2;
SELECT * FROM t1_nodef;
a b
1 4
**** On Slave ****
SELECT * FROM t1_nodef;
a b x
1 4 3
**** Cleanup ****
DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;

View File

@ -0,0 +1,381 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
STOP SLAVE;
SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
START SLAVE;
CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
CREATE TABLE t4 (a INT) ENGINE='InnoDB';
CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='InnoDB';
CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='InnoDB';
CREATE TABLE t7 (a INT NOT NULL) ENGINE='InnoDB';
CREATE TABLE t8 (a INT NOT NULL) ENGINE='InnoDB';
CREATE TABLE t9 (a INT) ENGINE='InnoDB';
ALTER TABLE t1_int ADD x INT DEFAULT 42;
ALTER TABLE t1_bit
ADD x BIT(3) DEFAULT b'011',
ADD y BIT(5) DEFAULT b'10101',
ADD z BIT(2) DEFAULT b'10';
ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
ALTER TABLE t1_nodef ADD x INT NOT NULL;
ALTER TABLE t2 DROP b;
ALTER TABLE t4 MODIFY a FLOAT;
ALTER TABLE t5 MODIFY b FLOAT;
ALTER TABLE t6 MODIFY c FLOAT;
ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
**** On Master ****
INSERT INTO t1_int VALUES (1,2);
INSERT INTO t1_int VALUES (2,5);
INSERT INTO t1_bit VALUES (1,2);
INSERT INTO t1_bit VALUES (2,5);
INSERT INTO t1_char VALUES (1,2);
INSERT INTO t1_char VALUES (2,5);
SELECT * FROM t1_int;
a b
1 2
2 5
SELECT * FROM t1_bit;
a b
1 2
2 5
SELECT * FROM t1_char;
a b
1 2
2 5
**** On Slave ****
SELECT a,b,x FROM t1_int;
a b x
2 5 4711
1 2 42
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
a b HEX(x) HEX(y) HEX(z)
2 5 5 1C 1
1 2 3 15 2
SELECT a,b,x FROM t1_char;
a b x
2 5 Foo is a bar
1 2 Just a test
**** On Master ****
UPDATE t1_int SET b=2*b WHERE a=2;
UPDATE t1_char SET b=2*b WHERE a=2;
UPDATE t1_bit SET b=2*b WHERE a=2;
SELECT * FROM t1_int;
a b
1 2
2 10
SELECT * FROM t1_bit;
a b
1 2
2 10
SELECT * FROM t1_char;
a b
1 2
2 10
**** On Slave ****
SELECT a,b,x FROM t1_int;
a b x
2 10 4711
1 2 42
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
a b HEX(x) HEX(y) HEX(z)
2 10 5 1C 1
1 2 3 15 2
SELECT a,b,x FROM t1_char;
a b x
2 10 Foo is a bar
1 2 Just a test
INSERT INTO t9 VALUES (2);
INSERT INTO t1_nodef VALUES (1,2);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1364
Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
INSERT INTO t2 VALUES (2,4);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (4);
INSERT INTO t4 VALUES (4);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
INSERT INTO t5 VALUES (5,10,25);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
INSERT INTO t6 VALUES (6,12,36);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1522
Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7;
a
1
2
3
SELECT * FROM t8;
a
1
2
3
SELECT * FROM t7;
a e1 e2 e3 e4 e5 e6 e7 e8
1 NULL NULL NULL NULL NULL NULL NULL NULL
2 NULL NULL NULL NULL NULL NULL NULL NULL
3 NULL NULL NULL NULL NULL NULL NULL NULL
SELECT * FROM t8;
a e1 e2 e3 e4 e5 e6 e7 e8
1 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0
**** On Master ****
TRUNCATE t1_nodef;
SET SQL_LOG_BIN=0;
INSERT INTO t1_nodef VALUES (1,2);
INSERT INTO t1_nodef VALUES (2,4);
SET SQL_LOG_BIN=1;
**** On Slave ****
INSERT INTO t1_nodef VALUES (1,2,3);
INSERT INTO t1_nodef VALUES (2,4,6);
**** On Master ****
UPDATE t1_nodef SET b=2*b WHERE a=1;
SELECT * FROM t1_nodef;
a b
1 4
2 4
**** On Slave ****
SELECT * FROM t1_nodef;
a b x
1 4 3
2 4 6
**** On Master ****
DELETE FROM t1_nodef WHERE a=2;
SELECT * FROM t1_nodef;
a b
1 4
**** On Slave ****
SELECT * FROM t1_nodef;
a b x
1 4 3
**** Cleanup ****
DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;

View File

@ -4,21 +4,96 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; STOP SLAVE;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=myisam; SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; START SLAVE;
CREATE TABLE t4 (a INT) ENGINE=myisam; CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='NDB';
CREATE TABLE t5 (a INT, b INT, c INT) ENGINE=myisam; CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='NDB';
CREATE TABLE t6 (a INT, b INT, c INT) ENGINE=myisam; CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='NDB';
CREATE TABLE t9 (a INT PRIMARY KEY) ENGINE=myisam; CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='NDB';
ALTER TABLE t1 ADD x INT DEFAULT 42; CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='NDB';
ALTER TABLE t2 ADD x INT DEFAULT 42 AFTER a; CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='NDB';
ALTER TABLE t3 ADD x INT DEFAULT 42 FIRST; CREATE TABLE t4 (a INT) ENGINE='NDB';
CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='NDB';
CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='NDB';
CREATE TABLE t9 (a INT) ENGINE='NDB';
ALTER TABLE t1_int ADD x INT DEFAULT 42;
ALTER TABLE t1_bit
ADD x BIT(3) DEFAULT b'011',
ADD y BIT(5) DEFAULT b'10101',
ADD z BIT(2) DEFAULT b'10';
ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
ALTER TABLE t1_nodef ADD x INT NOT NULL;
ALTER TABLE t2 DROP b;
ALTER TABLE t4 MODIFY a FLOAT; ALTER TABLE t4 MODIFY a FLOAT;
ALTER TABLE t5 MODIFY b FLOAT; ALTER TABLE t5 MODIFY b FLOAT;
ALTER TABLE t6 MODIFY c FLOAT; ALTER TABLE t6 MODIFY c FLOAT;
INSERT INTO t9 VALUES (1); INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1 VALUES (1,2); INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
**** On Master ****
INSERT INTO t1_int VALUES (1,2);
INSERT INTO t1_int VALUES (2,5);
INSERT INTO t1_bit VALUES (1,2);
INSERT INTO t1_bit VALUES (2,5);
INSERT INTO t1_char VALUES (1,2);
INSERT INTO t1_char VALUES (2,5);
SELECT * FROM t1_int;
a b
1 2
2 5
SELECT * FROM t1_bit;
a b
1 2
2 5
SELECT * FROM t1_char;
a b
1 2
2 5
**** On Slave ****
SELECT a,b,x FROM t1_int;
a b x
1 2 42
2 5 42
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
a b HEX(x) HEX(y) HEX(z)
1 2 3 15 2
2 5 3 15 2
SELECT a,b,x FROM t1_char;
a b x
1 2 Just a test
2 5 Just a test
**** On Master ****
UPDATE t1_int SET b=2*b WHERE a=2;
UPDATE t1_char SET b=2*b WHERE a=2;
UPDATE t1_bit SET b=2*b WHERE a=2;
SELECT * FROM t1_int;
a b
1 2
2 10
SELECT * FROM t1_bit;
a b
1 2
2 10
SELECT * FROM t1_char;
a b
1 2
2 10
**** On Slave ****
SELECT a,b,x FROM t1_int;
a b x
1 2 42
2 10 42
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
a b HEX(x) HEX(y) HEX(z)
1 2 3 15 2
2 10 3 15 2
SELECT a,b,x FROM t1_char;
a b x
1 2 Just a test
2 10 Just a test
INSERT INTO t9 VALUES (2);
INSERT INTO t1_nodef VALUES (1,2);
SHOW SLAVE STATUS; SHOW SLAVE STATUS;
Slave_IO_State # Slave_IO_State #
Master_Host 127.0.0.1 Master_Host 127.0.0.1
@ -26,7 +101,7 @@ Master_User root
Master_Port MASTER_PORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 1042 Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
@ -38,10 +113,10 @@ Replicate_Do_Table
Replicate_Ignore_Table Replicate_Ignore_Table
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table Replicate_Wild_Ignore_Table
Last_Errno 1454 Last_Errno 1364
Last_Error Table width mismatch - received 2 columns, test.t1 has 3 columns Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 968 Exec_Master_Log_Pos #
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
@ -64,7 +139,7 @@ Master_User root
Master_Port MASTER_PORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 1185 Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
@ -76,48 +151,10 @@ Replicate_Do_Table
Replicate_Ignore_Table Replicate_Ignore_Table
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table Replicate_Wild_Ignore_Table
Last_Errno 1454 Last_Errno 1514
Last_Error Table width mismatch - received 2 columns, test.t2 has 3 columns Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 1111 Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (3);
INSERT INTO t3 VALUES (3,6);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 1328
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1454
Last_Error Table width mismatch - received 2 columns, test.t3 has 3 columns
Skip_Counter 0
Exec_Master_Log_Pos 1254
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
@ -140,7 +177,7 @@ Master_User root
Master_Port MASTER_PORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 1466 Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
@ -152,10 +189,10 @@ Replicate_Do_Table
Replicate_Ignore_Table Replicate_Ignore_Table
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table Replicate_Wild_Ignore_Table
Last_Errno 1454 Last_Errno 1514
Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4 Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 1397 Exec_Master_Log_Pos #
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
@ -178,7 +215,7 @@ Master_User root
Master_Port MASTER_PORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 1614 Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
@ -190,10 +227,10 @@ Replicate_Do_Table
Replicate_Ignore_Table Replicate_Ignore_Table
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table Replicate_Wild_Ignore_Table
Last_Errno 1454 Last_Errno 1514
Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4 Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 1535 Exec_Master_Log_Pos #
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
@ -216,7 +253,7 @@ Master_User root
Master_Port MASTER_PORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 1762 Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
@ -228,10 +265,10 @@ Replicate_Do_Table
Replicate_Ignore_Table Replicate_Ignore_Table
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table Replicate_Wild_Ignore_Table
Last_Errno 1454 Last_Errno 1514
Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4 Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 1683 Exec_Master_Log_Pos #
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
@ -245,4 +282,5 @@ Master_SSL_Key
Seconds_Behind_Master # Seconds_Behind_Master #
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE; START SLAVE;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t9; DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t9;

View File

@ -5,9 +5,15 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
stop slave; stop slave;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int); create table t1 (a int);
drop table t1; drop table t1;
reset slave; reset slave;
#
# Test 1
#
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; set global max_relay_log_size=8192-1;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@ -15,47 +21,251 @@ select @@global.max_relay_log_size;
4096 4096
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72956 # # master-bin.000001 Yes Yes # 0 0 72956 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 72956
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 72956
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 2
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 20480
20480
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72956 # # master-bin.000001 Yes Yes # 0 0 72956 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 72956
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 72956
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 3: max_relay_log_size = 0
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 0
0
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72956 # # master-bin.000001 Yes Yes # 0 0 72956 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 72956
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 72956
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave; stop slave;
reset slave; reset slave;
flush logs; flush logs;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
Read_Master_Log_Pos 4
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 5
#
reset slave; reset slave;
start slave; start slave;
flush logs; flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73042 # # master-bin.000001 Yes Yes # 0 0 73042 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 73042
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 73042
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73118 # # master-bin.000001 Yes Yes # 0 0 73118 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 73118
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 73118
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
flush logs; flush logs;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File master-bin.000002
master-bin.000002 102 <Binlog_Ignore_DB> Position 102
Binlog_Do_DB <Binlog_Ignore_DB>
Binlog_Ignore_DB
#
# End of 4.1 tests
#

View File

@ -7,6 +7,8 @@ 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=row;
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
@ -358,6 +360,28 @@ count(*)
select count(*) from t16; select count(*) from t16;
count(*) count(*)
3 3
DROP TABLE IF EXISTS t11;
SET SESSION BINLOG_FORMAT=STATEMENT;
CREATE TABLE t11 (song VARCHAR(255));
LOCK TABLES t11 WRITE;
SET SESSION BINLOG_FORMAT=ROW;
INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
UNLOCK TABLES;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
USE mysqltest1;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
show binlog events from 102; show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest1 master-bin.000001 # Query 1 # drop database if exists mysqltest1
@ -659,4 +683,323 @@ master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16) master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_") master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_")
master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t11
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t12
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest1
master-bin.000001 # Query 1 # create database mysqltest1
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_8_")
master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_9_")
master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_10_")
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_11_"
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_13_")
master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_14_")
master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_15_")
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_16_"
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_18_")
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_21_"
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_24_"
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` (
`rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT ''
)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` (
`1` varbinary(36) NOT NULL DEFAULT ''
)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t4` (
`a` varchar(100) DEFAULT NULL
)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t4)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t5)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
begin
insert into t1 values("work_25_");
insert into t1 values(concat("for_26_",UUID()));
insert into t1 select "yesterday_27_";
end
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
begin
insert into t1 values(concat("emergency_28_",UUID()));
insert into t1 values("work_29_");
insert into t1 values(concat("for_30_",UUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work_31_");
set session binlog_format=mixed;
end
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
begin
set session binlog_format=row; # rejected for stored funcs
insert into t1 values("alarm");
return 100;
end
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100))
begin
insert into t1 values(concat("work_250_",x));
insert into t1 select "yesterday_270_";
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_"
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_"
master-bin.000001 # Query 1 # use `mysqltest1`; drop function foo3
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
begin
insert into t1 values("foo3_32_");
call foo();
return 100;
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned
begin
insert into t2 select foo3();
return 100;
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned
begin
insert into t2 select UUID();
return 100;
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned
begin
insert into t2 select x;
return 100;
end
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `foo6`(_latin1'foo6_1_')
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
master-bin.000001 # Query 1 # use `mysqltest1`; create table t11 (data varchar(255))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row
begin
set NEW.data = concat(NEW.data,UUID());
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; create table t20 select * from t1
master-bin.000001 # Query 1 # use `mysqltest1`; create table t21 select * from t2
master-bin.000001 # Query 1 # use `mysqltest1`; create table t22 select * from t3
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1,t2,t3
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
master-bin.000001 # Query 1 # use `mysqltest1`; create table t3 (b varchar(100))
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic
begin
insert into t1 values(null,x);
insert into t2 values(null,x);
return 1;
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Intvar 1 # INSERT_ID=3
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_44_")
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t1
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
master-bin.000001 # Intvar 1 # INSERT_ID=4
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f`(_latin1'try_45_')
master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
master-bin.000001 # Query 1 # use `mysqltest1`; drop function f
master-bin.000001 # Query 1 # use `mysqltest1`; create table t14 (unique (a)) select * from t2
master-bin.000001 # Query 1 # use `mysqltest1`; truncate table t2
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic
begin
insert into t1 values(null,x);
return 1;
end
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
begin
insert into t2 values(null,x);
return 1;
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
begin
declare y int;
insert into t1 values(null,x);
set y = (select count(*) from t2);
return y;
end
master-bin.000001 # Intvar 1 # INSERT_ID=4
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f1`(_latin1'try_53_')
master-bin.000001 # Intvar 1 # INSERT_ID=5
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f2`(_latin1'try_54_')
master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row
begin
insert into t2 values(null,"try_55_");
end
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t1 modify a int, drop primary key
master-bin.000001 # Intvar 1 # INSERT_ID=5
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_57_")
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t16` (
`UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_")
master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t11
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t12
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
drop database mysqltest1; drop database mysqltest1;

View File

@ -80,4 +80,19 @@ c
---> Cleaning up... ---> Cleaning up...
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
b decimal(32,0) YES NULL
show create table v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
select * from v1;
a b
1 6
drop table t1;
drop view v1;
End of 5.0 tests End of 5.0 tests

View File

@ -3,6 +3,10 @@ show status like 'Table_lock%';
Variable_name Value Variable_name Value
Table_locks_immediate 0 Table_locks_immediate 0
Table_locks_waited 0 Table_locks_waited 0
select * from information_schema.session_status where variable_name like 'Table_lock%';
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 0.0000000
TABLE_LOCKS_WAITED 0.0000000
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
drop table if exists t1; drop table if exists t1;
create table t1(n int) engine=myisam; create table t1(n int) engine=myisam;
@ -16,6 +20,10 @@ show status like 'Table_lock%';
Variable_name Value Variable_name Value
Table_locks_immediate 3 Table_locks_immediate 3
Table_locks_waited 1 Table_locks_waited 1
select * from information_schema.session_status where variable_name like 'Table_lock%';
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 3.0000000
TABLE_LOCKS_WAITED 1.0000000
drop table t1; drop table t1;
select 1; select 1;
1 1
@ -53,21 +61,36 @@ FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 1 Max_used_connections 1
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 1.0000000
SET @save_thread_cache_size=@@thread_cache_size; SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3; SET GLOBAL thread_cache_size=3;
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 3 Max_used_connections 3
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 3.0000000
FLUSH STATUS; FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 2 Max_used_connections 2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 2.0000000
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 3 Max_used_connections 3
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 3.0000000
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 4 Max_used_connections 4
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 4.0000000
SET GLOBAL thread_cache_size=@save_thread_cache_size; SET GLOBAL thread_cache_size=@save_thread_cache_size;
show status like 'com_show_status'; show status like 'com_show_status';
Variable_name Value Variable_name Value

View File

@ -103,21 +103,36 @@ set max_join_size=100;
show variables like 'max_join_size'; show variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size 100 max_join_size 100
select * from information_schema.session_variables where variable_name like 'max_join_size';
VARIABLE_NAME VARIABLE_VALUE
MAX_JOIN_SIZE 100
show global variables like 'max_join_size'; show global variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size 10 max_join_size 10
select * from information_schema.global_variables where variable_name like 'max_join_size';
VARIABLE_NAME VARIABLE_VALUE
MAX_JOIN_SIZE 10
set GLOBAL max_join_size=2000; set GLOBAL max_join_size=2000;
show global variables like 'max_join_size'; show global variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size 2000 max_join_size 2000
select * from information_schema.global_variables where variable_name like 'max_join_size';
VARIABLE_NAME VARIABLE_VALUE
MAX_JOIN_SIZE 2000
set max_join_size=DEFAULT; set max_join_size=DEFAULT;
show variables like 'max_join_size'; show variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size 2000 max_join_size 2000
select * from information_schema.session_variables where variable_name like 'max_join_size';
VARIABLE_NAME VARIABLE_VALUE
MAX_JOIN_SIZE 2000
set GLOBAL max_join_size=DEFAULT; set GLOBAL max_join_size=DEFAULT;
show global variables like 'max_join_size'; show global variables like 'max_join_size';
Variable_name Value Variable_name Value
max_join_size HA_POS_ERROR max_join_size HA_POS_ERROR
select * from information_schema.global_variables where variable_name like 'max_join_size';
VARIABLE_NAME VARIABLE_VALUE
MAX_JOIN_SIZE HA_POS_ERROR
set @@max_join_size=1000, @@global.max_join_size=2000; set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size; select @@local.max_join_size, @@global.max_join_size;
@@local.max_join_size @@global.max_join_size @@local.max_join_size @@global.max_join_size
@ -149,14 +164,23 @@ set global concurrent_insert=2;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
Variable_name Value Variable_name Value
concurrent_insert 2 concurrent_insert 2
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
VARIABLE_NAME VARIABLE_VALUE
CONCURRENT_INSERT 2
set global concurrent_insert=1; set global concurrent_insert=1;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
Variable_name Value Variable_name Value
concurrent_insert 1 concurrent_insert 1
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
VARIABLE_NAME VARIABLE_VALUE
CONCURRENT_INSERT 1
set global concurrent_insert=0; set global concurrent_insert=0;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
Variable_name Value Variable_name Value
concurrent_insert 0 concurrent_insert 0
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
VARIABLE_NAME VARIABLE_VALUE
CONCURRENT_INSERT 0
set global concurrent_insert=DEFAULT; set global concurrent_insert=DEFAULT;
select @@concurrent_insert; select @@concurrent_insert;
@@concurrent_insert @@concurrent_insert
@ -165,26 +189,44 @@ set global timed_mutexes=ON;
show variables like 'timed_mutexes'; show variables like 'timed_mutexes';
Variable_name Value Variable_name Value
timed_mutexes ON timed_mutexes ON
select * from information_schema.session_variables where variable_name like 'timed_mutexes';
VARIABLE_NAME VARIABLE_VALUE
TIMED_MUTEXES ON
set global timed_mutexes=0; set global timed_mutexes=0;
show variables like 'timed_mutexes'; show variables like 'timed_mutexes';
Variable_name Value Variable_name Value
timed_mutexes OFF timed_mutexes OFF
select * from information_schema.session_variables where variable_name like 'timed_mutexes';
VARIABLE_NAME VARIABLE_VALUE
TIMED_MUTEXES OFF
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE"; set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine'; show local variables like 'storage_engine';
Variable_name Value Variable_name Value
storage_engine MEMORY storage_engine MEMORY
select * from information_schema.session_variables where variable_name like 'storage_engine';
VARIABLE_NAME VARIABLE_VALUE
STORAGE_ENGINE MEMORY
show global variables like 'storage_engine'; show global variables like 'storage_engine';
Variable_name Value Variable_name Value
storage_engine MRG_MYISAM storage_engine MRG_MYISAM
select * from information_schema.global_variables where variable_name like 'storage_engine';
VARIABLE_NAME VARIABLE_VALUE
STORAGE_ENGINE MRG_MYISAM
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
Variable_name Value Variable_name Value
myisam_max_sort_file_size 1048576 myisam_max_sort_file_size 1048576
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE 1048576
set GLOBAL myisam_max_sort_file_size=default; set GLOBAL myisam_max_sort_file_size=default;
show variables like 'myisam_max_sort_file_size'; show variables like 'myisam_max_sort_file_size';
Variable_name Value Variable_name Value
myisam_max_sort_file_size FILE_SIZE myisam_max_sort_file_size FILE_SIZE
select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE
set global net_retry_count=10, session net_retry_count=10; set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
@ -194,12 +236,24 @@ net_buffer_length 1024
net_read_timeout 300 net_read_timeout 300
net_retry_count 10 net_retry_count 10
net_write_timeout 200 net_write_timeout 200
select * from information_schema.global_variables where variable_name like 'net_%';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024
NET_READ_TIMEOUT 300
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 200
show session variables like 'net_%'; show session variables like 'net_%';
Variable_name Value Variable_name Value
net_buffer_length 2048 net_buffer_length 2048
net_read_timeout 600 net_read_timeout 600
net_retry_count 10 net_retry_count 10
net_write_timeout 500 net_write_timeout 500
select * from information_schema.session_variables where variable_name like 'net_%';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 2048
NET_READ_TIMEOUT 600
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%'; show global variables like 'net_%';
Variable_name Value Variable_name Value
@ -207,24 +261,45 @@ net_buffer_length 1024
net_read_timeout 900 net_read_timeout 900
net_retry_count 10 net_retry_count 10
net_write_timeout 1000 net_write_timeout 1000
select * from information_schema.global_variables where variable_name like 'net_%';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024
NET_READ_TIMEOUT 900
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 1000
show session variables like 'net_%'; show session variables like 'net_%';
Variable_name Value Variable_name Value
net_buffer_length 7168 net_buffer_length 7168
net_read_timeout 600 net_read_timeout 600
net_retry_count 10 net_retry_count 10
net_write_timeout 500 net_write_timeout 500
select * from information_schema.session_variables where variable_name like 'net_%';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 600
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500
set net_buffer_length=1; set net_buffer_length=1;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
Variable_name Value Variable_name Value
net_buffer_length 1024 net_buffer_length 1024
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024
set net_buffer_length=2000000000; set net_buffer_length=2000000000;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
Variable_name Value Variable_name Value
net_buffer_length 1048576 net_buffer_length 1048576
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1048576
set character set cp1251_koi8; set character set cp1251_koi8;
show variables like "character_set_client"; show variables like "character_set_client";
Variable_name Value Variable_name Value
character_set_client cp1251 character_set_client cp1251
select * from information_schema.session_variables where variable_name like 'character_set_client';
VARIABLE_NAME VARIABLE_VALUE
CHARACTER_SET_CLIENT cp1251
select @@timestamp>0; select @@timestamp>0;
@@timestamp>0 @@timestamp>0
1 1
@ -239,6 +314,13 @@ query_prealloc_size 8192
range_alloc_block_size 2048 range_alloc_block_size 2048
transaction_alloc_block_size 8192 transaction_alloc_block_size 8192
transaction_prealloc_size 4096 transaction_prealloc_size 4096
select * from information_schema.session_variables where variable_name like '%alloc%';
VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 8192
QUERY_PREALLOC_SIZE 8192
RANGE_ALLOC_BLOCK_SIZE 2048
TRANSACTION_ALLOC_BLOCK_SIZE 8192
TRANSACTION_PREALLOC_SIZE 4096
set @@range_alloc_block_size=1024*16; set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2; set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18; set @@query_prealloc_size=1024*18;
@ -254,6 +336,13 @@ query_prealloc_size 18432
range_alloc_block_size 16384 range_alloc_block_size 16384
transaction_alloc_block_size 19456 transaction_alloc_block_size 19456
transaction_prealloc_size 20480 transaction_prealloc_size 20480
select * from information_schema.session_variables where variable_name like '%alloc%';
VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 17408
QUERY_PREALLOC_SIZE 18432
RANGE_ALLOC_BLOCK_SIZE 16384
TRANSACTION_ALLOC_BLOCK_SIZE 19456
TRANSACTION_PREALLOC_SIZE 20480
set @@range_alloc_block_size=default; set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default; set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default; set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
@ -264,6 +353,13 @@ query_prealloc_size 8192
range_alloc_block_size 2048 range_alloc_block_size 2048
transaction_alloc_block_size 8192 transaction_alloc_block_size 8192
transaction_prealloc_size 4096 transaction_prealloc_size 4096
select * from information_schema.session_variables where variable_name like '%alloc%';
VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 8192
QUERY_PREALLOC_SIZE 8192
RANGE_ALLOC_BLOCK_SIZE 2048
TRANSACTION_ALLOC_BLOCK_SIZE 8192
TRANSACTION_PREALLOC_SIZE 4096
SELECT @@version LIKE 'non-existent'; SELECT @@version LIKE 'non-existent';
@@version LIKE 'non-existent' @@version LIKE 'non-existent'
0 0
@ -485,6 +581,9 @@ set global myisam_max_sort_file_size=4294967296;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
Variable_name Value Variable_name Value
myisam_max_sort_file_size MAX_FILE_SIZE myisam_max_sort_file_size MAX_FILE_SIZE
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE MAX_FILE_SIZE
set global myisam_max_sort_file_size=default; set global myisam_max_sort_file_size=default;
select @@global.max_user_connections,@@local.max_join_size; select @@global.max_user_connections,@@local.max_join_size;
@@global.max_user_connections @@local.max_join_size @@global.max_user_connections @@local.max_join_size
@ -524,18 +623,30 @@ set @tstlw = @@log_warnings;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
Variable_name Value Variable_name Value
log_warnings 1 log_warnings 1
select * from information_schema.global_variables where variable_name like 'log_warnings';
VARIABLE_NAME VARIABLE_VALUE
LOG_WARNINGS 1
set global log_warnings = 0; set global log_warnings = 0;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
Variable_name Value Variable_name Value
log_warnings 0 log_warnings 0
select * from information_schema.global_variables where variable_name like 'log_warnings';
VARIABLE_NAME VARIABLE_VALUE
LOG_WARNINGS 0
set global log_warnings = 42; set global log_warnings = 42;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
Variable_name Value Variable_name Value
log_warnings 42 log_warnings 42
select * from information_schema.global_variables where variable_name like 'log_warnings';
VARIABLE_NAME VARIABLE_VALUE
LOG_WARNINGS 42
set global log_warnings = @tstlw; set global log_warnings = @tstlw;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
Variable_name Value Variable_name Value
log_warnings 1 log_warnings 1
select * from information_schema.global_variables where variable_name like 'log_warnings';
VARIABLE_NAME VARIABLE_VALUE
LOG_WARNINGS 1
create table t1 ( create table t1 (
c1 tinyint, c1 tinyint,
c2 smallint, c2 smallint,
@ -567,10 +678,16 @@ SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
Variable_name Value Variable_name Value
myisam_data_pointer_size 7 myisam_data_pointer_size 7
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYISAM_DATA_POINTER_SIZE';
VARIABLE_NAME VARIABLE_VALUE
MYISAM_DATA_POINTER_SIZE 7
SET GLOBAL table_open_cache=-1; SET GLOBAL table_open_cache=-1;
SHOW VARIABLES LIKE 'table_open_cache'; SHOW VARIABLES LIKE 'table_open_cache';
Variable_name Value Variable_name Value
table_open_cache 1 table_open_cache 1
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
VARIABLE_NAME VARIABLE_VALUE
TABLE_OPEN_CACHE 1
SET GLOBAL table_open_cache=DEFAULT; SET GLOBAL table_open_cache=DEFAULT;
set character_set_results=NULL; set character_set_results=NULL;
select ifnull(@@character_set_results,"really null"); select ifnull(@@character_set_results,"really null");
@ -639,21 +756,36 @@ set @@sql_big_selects = 1;
show variables like 'sql_big_selects'; show variables like 'sql_big_selects';
Variable_name Value Variable_name Value
sql_big_selects ON sql_big_selects ON
select * from information_schema.session_variables where variable_name like 'sql_big_selects';
VARIABLE_NAME VARIABLE_VALUE
SQL_BIG_SELECTS ON
set @@sql_big_selects = @old_sql_big_selects; set @@sql_big_selects = @old_sql_big_selects;
set @@sql_notes = 0, @@sql_warnings = 0; set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes'; show variables like 'sql_notes';
Variable_name Value Variable_name Value
sql_notes OFF sql_notes OFF
select * from information_schema.session_variables where variable_name like 'sql_notes';
VARIABLE_NAME VARIABLE_VALUE
SQL_NOTES OFF
show variables like 'sql_warnings'; show variables like 'sql_warnings';
Variable_name Value Variable_name Value
sql_warnings OFF sql_warnings OFF
select * from information_schema.session_variables where variable_name like 'sql_warnings';
VARIABLE_NAME VARIABLE_VALUE
SQL_WARNINGS OFF
set @@sql_notes = 1, @@sql_warnings = 1; set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes'; show variables like 'sql_notes';
Variable_name Value Variable_name Value
sql_notes ON sql_notes ON
select * from information_schema.session_variables where variable_name like 'sql_notes';
VARIABLE_NAME VARIABLE_VALUE
SQL_NOTES ON
show variables like 'sql_warnings'; show variables like 'sql_warnings';
Variable_name Value Variable_name Value
sql_warnings ON sql_warnings ON
select * from information_schema.session_variables where variable_name like 'sql_warnings';
VARIABLE_NAME VARIABLE_VALUE
SQL_WARNINGS ON
select @@system_time_zone; select @@system_time_zone;
@@system_time_zone @@system_time_zone
# #
@ -667,12 +799,21 @@ select @@basedir, @@datadir, @@tmpdir;
show variables like 'basedir'; show variables like 'basedir';
Variable_name Value Variable_name Value
basedir # basedir #
select * from information_schema.session_variables where variable_name like 'basedir';
VARIABLE_NAME VARIABLE_VALUE
BASEDIR #
show variables like 'datadir'; show variables like 'datadir';
Variable_name Value Variable_name Value
datadir # datadir #
select * from information_schema.session_variables where variable_name like 'datadir';
VARIABLE_NAME VARIABLE_VALUE
DATADIR #
show variables like 'tmpdir'; show variables like 'tmpdir';
Variable_name Value Variable_name Value
tmpdir # tmpdir #
select * from information_schema.session_variables where variable_name like 'tmpdir';
VARIABLE_NAME VARIABLE_VALUE
TMPDIR #
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key; select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
@@ssl_ca @@ssl_capath @@ssl_cert @@ssl_cipher @@ssl_key @@ssl_ca @@ssl_capath @@ssl_cert @@ssl_cipher @@ssl_key
# # # # # # # # # #
@ -683,12 +824,22 @@ ssl_capath #
ssl_cert # ssl_cert #
ssl_cipher # ssl_cipher #
ssl_key # ssl_key #
select * from information_schema.session_variables where variable_name like 'ssl%';
VARIABLE_NAME VARIABLE_VALUE
SSL_CA #
SSL_CAPATH #
SSL_CERT #
SSL_CIPHER #
SSL_KEY #
select @@log_queries_not_using_indexes; select @@log_queries_not_using_indexes;
@@log_queries_not_using_indexes @@log_queries_not_using_indexes
0 0
show variables like 'log_queries_not_using_indexes'; show variables like 'log_queries_not_using_indexes';
Variable_name Value Variable_name Value
log_queries_not_using_indexes OFF log_queries_not_using_indexes OFF
select * from information_schema.session_variables where variable_name like 'log_queries_not_using_indexes';
VARIABLE_NAME VARIABLE_VALUE
LOG_QUERIES_NOT_USING_INDEXES OFF
select @@""; select @@"";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1
select @@&; select @@&;

View File

@ -3,7 +3,7 @@
# Taken FROM the select test # Taken FROM the select test
# #
-- source include/have_archive.inc -- source include/have_archive.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;

View File

@ -0,0 +1,9 @@
# This test is to verify replication with INSERT DELAY through
# unrecommended STATEMENT binlog format
-- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc
-- disable_query_log
reset master; # get rid of previous tests binlog
-- enable_query_log
-- source extra/binlog_tests/binlog_insert_delayed.test

View File

@ -13,6 +13,6 @@ drop table t1;
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed.inc
-- source extra/binlog_tests/binlog.test -- source extra/binlog_tests/binlog.test

View File

@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/blackhole.test -- source extra/binlog_tests/blackhole.test

View File

@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_cp932.test -- source extra/binlog_tests/ctype_cp932.test

View File

@ -1,6 +1,6 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_ucs_binlog.test -- source extra/binlog_tests/ctype_ucs_binlog.test

View File

@ -1,5 +1,5 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/drop_temp_table.test -- source extra/binlog_tests/drop_temp_table.test

View File

@ -1,5 +1,5 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/innodb_stat.test -- source extra/binlog_tests/innodb_stat.test

View File

@ -1,5 +1,5 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/insert_select-binlog.test -- source extra/binlog_tests/insert_select-binlog.test

View File

@ -1,7 +1,7 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test -- source extra/binlog_tests/mix_innodb_myisam_binlog.test
# This piece below cannot be put into # This piece below cannot be put into

View File

@ -6,7 +6,7 @@
# inconsistency between binlog and the internal list of temp tables. # inconsistency between binlog and the internal list of temp tables.
# This does not work for RBR yet. # This does not work for RBR yet.
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
--disable_warnings --disable_warnings

View File

@ -1,7 +1,7 @@
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 11/07/2005 [jbm] # For both statement and row based bin logs 11/07/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_cp932_binlog.test -- source extra/binlog_tests/ctype_cp932_binlog.test
# #

View File

@ -6,9 +6,9 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
--replace_result ROW <format> STATEMENT <format> --replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW GLOBAL VARIABLES LIKE "%_format%"; SHOW GLOBAL VARIABLES LIKE "%_format%";
--replace_result ROW <format> STATEMENT <format> --replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%_format%"; SHOW SESSION VARIABLES LIKE "%_format%";
# #
@ -36,7 +36,7 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d'; set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d'; set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
--replace_result ROW <format> STATEMENT <format> --replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%format"; SHOW SESSION VARIABLES LIKE "%format";
--error 1231 --error 1231

View File

@ -1,6 +1,6 @@
# We are using .opt file since we need small binlog size # We are using .opt file since we need small binlog size
# TODO: Need to look at making a row based version once the new row based client is completed. [jbm] # TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# Embedded server doesn't support binlogging # Embedded server doesn't support binlogging
-- source include/not_embedded.inc -- source include/not_embedded.inc

View File

@ -2,7 +2,7 @@
# and a few others. # and a few others.
# TODO: Need to look at making row based version once new binlog client is complete. # TODO: Need to look at making row based version once new binlog client is complete.
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# Embedded server doesn't support binlogging # Embedded server doesn't support binlogging
-- source include/not_embedded.inc -- source include/not_embedded.inc

View File

@ -16,9 +16,9 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1 --exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2005 --echo # Bug #2005
# --echo #
CREATE TABLE t1 (a decimal(64, 20)); CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
@ -26,9 +26,9 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
--exec $MYSQL_DUMP --compact test t1 --exec $MYSQL_DUMP --compact test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2055 --echo # Bug #2055
# --echo #
CREATE TABLE t1 (a double); CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999'); INSERT INTO t1 VALUES ('-9e999999');
@ -38,9 +38,9 @@ INSERT INTO t1 VALUES ('-9e999999');
--exec $MYSQL_DUMP --compact test t1 --exec $MYSQL_DUMP --compact test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #3361 mysqldump quotes DECIMAL values inconsistently --echo # Bug #3361 mysqldump quotes DECIMAL values inconsistently
# --echo #
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT); CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
@ -69,28 +69,28 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
--exec $MYSQL_DUMP --skip-create --compact -X test t1 --exec $MYSQL_DUMP --skip-create --compact -X test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #1707 --echo # Bug #1707
# --echo #
CREATE TABLE t1 (`a"b"` char(2)); CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2"); INSERT INTO t1 VALUES ("1\""), ("\"2");
--exec $MYSQL_DUMP --compact --skip-create -X test t1 --exec $MYSQL_DUMP --compact --skip-create -X test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #1994 --echo # Bug #1994
# Bug #4261 --echo # Bug #4261
# --echo #
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 --exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2634 --echo # Bug #2634
# --echo #
CREATE TABLE t1 (a int) ENGINE=MYISAM; CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
@ -98,17 +98,17 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1 --exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly' --echo # Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
# --echo #
create table ```a` (i int); create table ```a` (i int);
--exec $MYSQL_DUMP --compact test --exec $MYSQL_DUMP --compact test
drop table ```a`; drop table ```a`;
# --echo #
# Bug #2591 "mysqldump quotes names inconsistently" --echo # Bug #2591 "mysqldump quotes names inconsistently"
# --echo #
create table t1(a int); create table t1(a int);
--exec $MYSQL_DUMP --comments=0 test --exec $MYSQL_DUMP --comments=0 test
@ -119,9 +119,9 @@ set global sql_mode='ANSI_QUOTES';
set global sql_mode=''; set global sql_mode='';
drop table t1; drop table t1;
# --echo #
# Bug #2705 'mysqldump --tab extra output' --echo # Bug #2705 'mysqldump --tab extra output'
# --echo #
create table t1(a int); create table t1(a int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
@ -135,9 +135,9 @@ insert into t1 values (1),(2),(3);
--exec rm $MYSQLTEST_VARDIR/tmp/t1.txt --exec rm $MYSQLTEST_VARDIR/tmp/t1.txt
drop table t1; drop table t1;
# --echo #
# Bug #6101: create database problem --echo # Bug #6101: create database problem
# --echo #
--exec $MYSQL_DUMP --skip-comments --databases test --exec $MYSQL_DUMP --skip-comments --databases test
@ -145,32 +145,34 @@ create database mysqldump_test_db character set latin2 collate latin2_bin;
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db --exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db
drop database mysqldump_test_db; drop database mysqldump_test_db;
# --echo #
# Bug #7020 --echo # Bug #7020
# Check that we don't dump in UTF8 in compatible mode by default, --echo # Check that we don't dump in UTF8 in compatible mode by default,
# but use the default compiled values, or the values given in --echo # but use the default compiled values, or the values given in
# --default-character-set=xxx. However, we should dump in UTF8 --echo # --default-character-set=xxx. However, we should dump in UTF8
# if it is explicitely set. --echo # if it is explicitely set.
CREATE TABLE t1 (a CHAR(10)); CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 '<27><><EFBFBD><EFBFBD>'); INSERT INTO t1 VALUES (_latin1 '<27><><EFBFBD><EFBFBD>');
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
#
# Bug#8063: make test mysqldump [ fail ] --echo #
# We cannot tes this command because its output depends --echo # Bug#8063: make test mysqldump [ fail ]
# on --default-character-set incompiled into "mysqldump" program. --echo # We cannot tes this command because its output depends
# If the future we can move this command into a separate test with --echo # on --default-character-set incompiled into "mysqldump" program.
# checking that "mysqldump" is compiled with "latin1" --echo # If the future we can move this command into a separate test with
# --echo # checking that "mysqldump" is compiled with "latin1"
--echo #
#--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1 #--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1 --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# WL #2319: Exclude Tables from dump --echo # WL #2319: Exclude Tables from dump
# --echo #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
@ -180,18 +182,18 @@ INSERT INTO t2 VALUES (4),(5),(6);
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
# --echo #
# Bug #8830 --echo # Bug #8830
# --echo #
CREATE TABLE t1 (`b` blob); CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A); INSERT INTO `t1` VALUES (0x602010000280100005E71A);
--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 --exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Test for --insert-ignore --echo # Test for --insert-ignore
# --echo #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
@ -200,10 +202,10 @@ INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1 --exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #10286: mysqldump -c crashes on table that has many fields with long --echo # Bug #10286: mysqldump -c crashes on table that has many fields with long
# names --echo # names
# --echo #
create table t1 ( create table t1 (
F_c4ca4238a0b923820dcc509a6f75849b int, F_c4ca4238a0b923820dcc509a6f75849b int,
F_c81e728d9d4c2f636f067f89cc14862c int, F_c81e728d9d4c2f636f067f89cc14862c int,
@ -539,18 +541,18 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
--exec $MYSQL_DUMP --skip-comments -c test --exec $MYSQL_DUMP --skip-comments -c test
drop table t1; drop table t1;
# --echo #
# Test for --add-drop-database --echo # Test for --add-drop-database
# --echo #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test --exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data --echo # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
# --echo #
CREATE DATABASE mysqldump_test_db; CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db; USE mysqldump_test_db;
@ -565,11 +567,11 @@ INSERT INTO t2 VALUES (1), (2);
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP DATABASE mysqldump_test_db; DROP DATABASE mysqldump_test_db;
# --echo #
# Testing with tables and databases that don't exists --echo # Testing with tables and databases that don't exists
# or contains illegal characters --echo # or contains illegal characters
# (Bug #9358 mysqldump crashes if tablename starts with \) --echo # (Bug #9358 mysqldump crashes if tablename starts with \)
# --echo #
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
create table t1(a varchar(30) primary key, b int not null); create table t1(a varchar(30) primary key, b int not null);
@ -629,9 +631,9 @@ drop database mysqldump_test_db;
use test; use test;
# --echo #
# Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly --echo # Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
# --echo #
create table t1 (a int(10)); create table t1 (a int(10));
create table t2 (pk int primary key auto_increment, create table t2 (pk int primary key auto_increment,
@ -641,9 +643,10 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
--exec $MYSQL_DUMP --skip-comments --xml --no-create-info test --exec $MYSQL_DUMP --skip-comments --xml --no-create-info test
drop table t1, t2; drop table t1, t2;
# --echo #
# BUG #12123 --echo # BUG #12123
# --echo #
create table t1 (a text character set utf8, b text character set latin1); create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1; select * from t1;
@ -654,15 +657,16 @@ select * from t1;
drop table t1; drop table t1;
# --echo #
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence --echo # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
# --echo #
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump --exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
# --echo #
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]" --echo # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
# --echo #
create table `t1` ( create table `t1` (
t1_name varchar(255) default null, t1_name varchar(255) default null,
t1_id int(10) unsigned not null auto_increment, t1_id int(10) unsigned not null auto_increment,
@ -689,9 +693,9 @@ show create table `t1`;
drop table `t1`; drop table `t1`;
# --echo #
# Bug #18536: wrong table order --echo # Bug #18536: wrong table order
# --echo #
create table t1(a int); create table t1(a int);
create table t2(a int); create table t2(a int);
@ -700,9 +704,10 @@ create table t3(a int);
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 --exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3; drop table t1, t2, t3;
# --echo #
# Bug #21288: mysqldump segmentation fault when using --where --echo # Bug #21288: mysqldump segmentation fault when using --where
# --echo #
create table t1 (a int); create table t1 (a int);
--error 2 --error 2
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
@ -710,9 +715,9 @@ drop table t1;
--echo End of 4.1 tests --echo End of 4.1 tests
# --echo #
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) --echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
# --echo #
create database db1; create database db1;
use db1; use db1;
@ -734,9 +739,9 @@ drop view v2;
drop database db1; drop database db1;
use test; use test;
# --echo #
# Bug 10713 mysqldump includes database in create view and referenced tables --echo # Bug 10713 mysqldump includes database in create view and referenced tables
# --echo #
# create table and views in db2 # create table and views in db2
create database db2; create database db2;
@ -770,18 +775,19 @@ drop table t1, t2;
drop database db1; drop database db1;
use test; use test;
# --echo #
# dump of view --echo # dump of view
# --echo #
create table t1(a int); create table t1(a int);
create view v1 as select * from t1; create view v1 as select * from t1;
--exec $MYSQL_DUMP --skip-comments test --exec $MYSQL_DUMP --skip-comments test
drop view v1; drop view v1;
drop table t1; drop table t1;
# --echo #
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) --echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
# --echo #
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
@ -803,18 +809,18 @@ drop view v2;
drop database mysqldump_test_db; drop database mysqldump_test_db;
use test; use test;
# --echo #
# Bug #9756 --echo # Bug #9756
# --echo #
CREATE TABLE t1 (a char(10)); CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\''); INSERT INTO t1 VALUES ('\'');
--exec $MYSQL_DUMP --skip-comments test t1 --exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #10927 mysqldump: Can't reload dump with view that consist of other view --echo # Bug #10927 mysqldump: Can't reload dump with view that consist of other view
# --echo #
create table t1(a int, b int, c varchar(30)); create table t1(a int, b int, c varchar(30));
@ -834,9 +840,9 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
drop view v1, v2, v3; drop view v1, v2, v3;
drop table t1; drop table t1;
# --echo #
# Test for dumping triggers --echo # Test for dumping triggers
# --echo #
CREATE TABLE t1 (a int, b bigint default NULL); CREATE TABLE t1 (a int, b bigint default NULL);
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
@ -884,9 +890,9 @@ show tables;
show triggers; show triggers;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# --echo #
# Bugs #9136, #12917: problems with --defaults-extra-file option --echo # Bugs #9136, #12917: problems with --defaults-extra-file option
# --echo #
--system echo '[mysqltest1]' > $MYSQLTEST_VARDIR/tmp/tmp.cnf --system echo '[mysqltest1]' > $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system echo 'port=1234' >> $MYSQLTEST_VARDIR/tmp/tmp.cnf --system echo 'port=1234' >> $MYSQLTEST_VARDIR/tmp/tmp.cnf
@ -894,9 +900,9 @@ DROP TABLE t1, t2;
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1 --exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf --system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
# --echo #
# Test of fix to BUG 12597 --echo # Test of fix to BUG 12597
# --echo #
DROP TABLE IF EXISTS `test1`; DROP TABLE IF EXISTS `test1`;
CREATE TABLE `test1` ( CREATE TABLE `test1` (
@ -932,9 +938,9 @@ DROP TRIGGER testref;
DROP TABLE test1; DROP TABLE test1;
DROP TABLE test2; DROP TABLE test2;
# --echo #
# BUG#9056 - mysqldump does not dump routines --echo # BUG#9056 - mysqldump does not dump routines
# --echo #
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
@ -981,9 +987,10 @@ DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`; DROP PROCEDURE `a'b`;
drop table t1; drop table t1;
# --echo #
# BUG# 13052 - mysqldump timestamp reloads broken --echo # BUG# 13052 - mysqldump timestamp reloads broken
# --echo #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
@ -1003,9 +1010,10 @@ drop table t1;
set global time_zone=default; set global time_zone=default;
set time_zone=default; set time_zone=default;
# --echo #
# Test of fix to BUG 13146 - ansi quotes break loading of triggers --echo # Test of fix to BUG 13146 - ansi quotes break loading of triggers
# --echo #
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS `t1 test`; DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`; DROP TABLE IF EXISTS `t2 test`;
@ -1036,9 +1044,9 @@ DROP TRIGGER `test trig`;
DROP TABLE `t1 test`; DROP TABLE `t1 test`;
DROP TABLE `t2 test`; DROP TABLE `t2 test`;
# --echo #
# BUG# 12838 mysqldump -x with views exits with error --echo # BUG# 12838 mysqldump -x with views exits with error
# --echo #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
@ -1059,10 +1067,10 @@ drop view v0;
drop view v1; drop view v1;
drop table t1; drop table t1;
# --echo #
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN" --echo # BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode. --echo # for tables with trigger created in the IGNORE_SPACE sql mode.
# --echo #
SET @old_sql_mode = @@SQL_MODE; SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE; SET SQL_MODE = IGNORE_SPACE;
@ -1083,18 +1091,19 @@ SET SQL_MODE = @old_sql_mode;
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; DROP TABLE t1;
# --echo #
# Bug #13318: Bad result with empty field and --hex-blob --echo # Bug #13318: Bad result with empty field and --hex-blob
# --echo #
create table t1 (a binary(1), b blob); create table t1 (a binary(1), b blob);
insert into t1 values ('',''); insert into t1 values ('','');
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1 --exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1 --exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1; drop table t1;
# --echo #
# Bug 14871 Invalid view dump output --echo # Bug 14871 Invalid view dump output
# --echo #
create table t1 (a int); create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789); insert into t1 values (289), (298), (234), (456), (789);
@ -1121,9 +1130,9 @@ select * from v3 order by a;
drop table t1; drop table t1;
drop view v1, v2, v3, v4, v5; drop view v1, v2, v3, v4, v5;
# --echo #
# Bug #16878 dump of trigger --echo # Bug #16878 dump of trigger
# --echo #
create table t1 (a int, created datetime); create table t1 (a int, created datetime);
create table t2 (b int, created datetime); create table t2 (b int, created datetime);
@ -1151,11 +1160,10 @@ drop trigger tr1;
drop trigger tr2; drop trigger tr2;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # Bug#18462 mysqldump does not dump view structures correctly
--echo #
#
# Bug#18462 mysqldump does not dump view structures correctly
#
#
create table t (qty int, price int); create table t (qty int, price int);
insert into t values(3, 50); insert into t values(3, 50);
insert into t values(5, 51); insert into t values(5, 51);
@ -1172,11 +1180,11 @@ drop view v2;
drop table t; drop table t;
# --echo #
# Bug#14857 Reading dump files with single statement stored routines fails. --echo # Bug#14857 Reading dump files with single statement stored routines fails.
# fixed by patch for bug#16878 --echo # fixed by patch for bug#16878
# --echo #
#
DELIMITER |; DELIMITER |;
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20) /*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */| return 42 */|
@ -1188,10 +1196,10 @@ show create procedure p;
drop function f; drop function f;
drop procedure p; drop procedure p;
# --echo #
# Bug #17371 Unable to dump a schema with invalid views --echo # Bug #17371 Unable to dump a schema with invalid views
# --echo #
#
create table t1 ( id serial ); create table t1 ( id serial );
create view v1 as select * from t1; create view v1 as select * from t1;
drop table t1; drop table t1;
@ -1202,9 +1210,9 @@ drop table t1;
--echo } mysqldump --echo } mysqldump
drop view v1; drop view v1;
# BUG#17201 Spurious 'DROP DATABASE' in output, --echo # BUG#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views. --echo # also confusion between tables and views.
# Example code from Markus Popp --echo # Example code from Markus Popp
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
@ -1219,9 +1227,10 @@ drop view v1;
drop table t1; drop table t1;
drop database mysqldump_test_db; drop database mysqldump_test_db;
# --echo #
# Bug21014 Segmentation fault of mysqldump on view --echo # Bug21014 Segmentation fault of mysqldump on view
# --echo #
create database mysqldump_tables; create database mysqldump_tables;
use mysqldump_tables; use mysqldump_tables;
create table basetable ( id serial, tag varchar(64) ); create table basetable ( id serial, tag varchar(64) );
@ -1237,9 +1246,10 @@ drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
# --echo #
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps --echo # Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
# --echo #
create database mysqldump_dba; create database mysqldump_dba;
use mysqldump_dba; use mysqldump_dba;
create table t1 (f1 int, f2 int); create table t1 (f1 int, f2 int);
@ -1277,9 +1287,9 @@ drop table t1;
drop database mysqldump_dbb; drop database mysqldump_dbb;
use test; use test;
# --echo #
# Bug#21215 mysqldump creating incomplete backups without warning --echo # Bug#21215 mysqldump creating incomplete backups without warning
# --echo #
# Create user without sufficient privs to perform the requested operation # Create user without sufficient privs to perform the requested operation
create user mysqltest_1@localhost; create user mysqltest_1@localhost;
@ -1321,12 +1331,12 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
# --echo #
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the --echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database. --echo # information_schema database.
# --echo #
# Bug #21424 mysqldump failing to export/import views --echo # Bug #21424 mysqldump failing to export/import views
# --echo #
# Do as root # Do as root
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
@ -1360,8 +1370,10 @@ drop user myDB_User;
drop database mysqldump_myDB; drop database mysqldump_myDB;
flush privileges; flush privileges;
# Bug #21424 continues from here. --echo # Bug #21424 continues from here.
# Restore. Flush Privileges test ends. --echo # Restore. Flush Privileges test ends.
--echo #
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql;
# Do as a user # Do as a user
@ -1383,7 +1395,28 @@ drop user myDB_User;
drop database mysqldump_myDB; drop database mysqldump_myDB;
use test; use test;
--echo End of 5.0 tests --echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings
--echo #
--echo # End of 5.0 tests
--echo #
# Check new --replace option # Check new --replace option
@ -1438,9 +1471,10 @@ drop table t2;
drop table words2; drop table words2;
# --echo #
# BUG# 16853: mysqldump doesn't show events --echo # BUG# 16853: mysqldump doesn't show events
# --echo #
create database first; create database first;
use first; use first;
set time_zone = 'UTC'; set time_zone = 'UTC';
@ -1476,11 +1510,11 @@ drop database third;
set time_zone = 'SYSTEM'; set time_zone = 'SYSTEM';
use test; use test;
##### --echo #
# --echo # BUG#17201 Spurious 'DROP DATABASE' in output,
# BUG#17201 Spurious 'DROP DATABASE' in output, --echo # also confusion between tables and views.
# also confusion between tables and views. --echo # Example code from Markus Popp
# Example code from Markus Popp --echo #
create database mysqldump_test_db; create database mysqldump_test_db;
use mysqldump_test_db; use mysqldump_test_db;
@ -1495,4 +1529,6 @@ drop view v1;
drop table t1; drop table t1;
drop database mysqldump_test_db; drop database mysqldump_test_db;
--echo End of 5.1 tests --echo #
--echo # End of 5.1 tests
--echo #

View File

@ -1,7 +1,7 @@
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_multi_ndb.inc -- source include/have_multi_ndb.inc
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
--disable_warnings --disable_warnings
connection server2; connection server2;

View File

@ -7,7 +7,7 @@
# in row-based, it hangs waiting for an offset which is never # in row-based, it hangs waiting for an offset which is never
# reached (the "sync_with_master 1"), logically. # reached (the "sync_with_master 1"), logically.
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
save_master_pos; save_master_pos;
connection slave; connection slave;

View File

@ -1,7 +1,6 @@
--echo #
# --echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
# Bug#20821: INSERT DELAYED fails to write some rows to binlog --echo #
#
--source include/master-slave.inc --source include/master-slave.inc
--source include/not_embedded.inc --source include/not_embedded.inc
@ -35,7 +34,11 @@ SELECT COUNT(*) FROM mysqlslap.t1;
sync_slave_with_master; sync_slave_with_master;
SELECT COUNT(*) FROM mysqlslap.t1; SELECT COUNT(*) FROM mysqlslap.t1;
connection master; --echo #
DROP SCHEMA IF EXISTS mysqlslap; --echo # Cleanup
sync_slave_with_master; --echo #
connection master;
USE test;
DROP SCHEMA mysqlslap;
sync_slave_with_master;

View File

@ -2,7 +2,7 @@
# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules. # replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged). # This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
connection slave; connection slave;

View File

@ -1,7 +1,7 @@
# Mixed DDL-DML (CREATE ... SELECT ...) statements can only be # Mixed DDL-DML (CREATE ... SELECT ...) statements can only be
# replicated properly in statement-based replication. # replicated properly in statement-based replication.
# Currently statement based due to bug 12345 # Currently statement based due to bug 12345
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;

View File

@ -1,12 +1,12 @@
-- source include/have_row_based.inc -- source include/have_row_based.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/not_ndb_default.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# Test that the slave temporarily switches to ROW when seeing binrow # Test that the slave temporarily switches to ROW when seeing binrow
# events when it is in STATEMENT or MIXED mode # events when it is in STATEMENT or MIXED mode
SET BINLOG_FORMAT=MIXED; 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;

View File

@ -1,5 +1,5 @@
# TBF - difference in row level logging # TBF - difference in row level logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
--disable_warnings --disable_warnings

View File

@ -13,7 +13,7 @@
# - Test creating a duplicate key error and recover from it # - Test creating a duplicate key error and recover from it
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
--disable_warnings --disable_warnings

View File

@ -54,3 +54,43 @@ UPDATE t1 SET a=99 WHERE a = 0;
--replace_result $SERVER_VERSION SERVER_VERSION --replace_result $SERVER_VERSION SERVER_VERSION
--replace_regex /table_id: [0-9]+/table_id: #/ --replace_regex /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS; SHOW BINLOG EVENTS;
DROP TABLE t1;
# BUG#17620: Replicate (Row Based) Fails when Query Cache enabled on
# slave
--echo ================ Test for BUG#17620 ================
--disable_query_log
--source include/master-slave-reset.inc
--enable_query_log
--echo **** On Slave ****
connection slave;
SET GLOBAL QUERY_CACHE_SIZE=0;
--echo **** On Master ****
connection master;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
--echo **** On Slave ****
sync_slave_with_master;
SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024;
--echo **** On Master ****
connection master;
INSERT INTO t1 VALUES (4),(5),(6);
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1;
--echo **** On Master ****
connection master;
INSERT INTO t1 VALUES (7),(8),(9);
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -8,12 +8,17 @@
############################################################ ############################################################
--source include/have_row_based.inc --source include/have_row_based.inc
--source include/have_binlog_format_row.inc
--source include/have_partition.inc --source include/have_partition.inc
--source include/not_ndb_default.inc
--source include/master-slave.inc --source include/master-slave.inc
connection master; connection master;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
SET BINLOG_FORMAT=ROW;
let $maybe_ro_var = @@BINLOG_FORMAT;
let $val4var = ROW;
--source include/safe_set_to_maybe_ro_var.inc
--echo **** Partition RANGE testing **** --echo **** Partition RANGE testing ****

View File

@ -5,6 +5,8 @@
# Requires statement logging # Requires statement logging
-- source include/not_ndb_default.inc -- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc -- source include/have_row_based.inc
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
-- source extra/rpl_tests/rpl_max_relay_size.test -- source extra/rpl_tests/rpl_max_relay_size.test

View File

@ -0,0 +1,8 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
let $engine_type = 'MyISAM';
-- source extra/rpl_tests/rpl_row_tabledefs.test

View File

@ -0,0 +1,9 @@
-- source include/have_binlog_format_row.inc
-- source include/have_innodb.inc
-- source include/master-slave.inc
let $engine_type = 'InnoDB';
-- source extra/rpl_tests/rpl_row_tabledefs.test

View File

@ -3,6 +3,6 @@
# Date: 2006-01-11 # Date: 2006-01-11
# Purpose: Engine Wrapper for rpl_stm_EE_err2.test # Purpose: Engine Wrapper for rpl_stm_EE_err2.test
############################## ##############################
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
let $engine_type=myisam; let $engine_type=myisam;
-- source extra/rpl_tests/rpl_stm_EE_err2.test -- source extra/rpl_tests/rpl_stm_EE_err2.test

View File

@ -1,5 +1,5 @@
# depends on the binlog output # depends on the binlog output
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
let $rename_event_pos= 652; let $rename_event_pos= 652;
-- source extra/rpl_tests/rpl_flsh_tbls.test -- source extra/rpl_tests/rpl_flsh_tbls.test

View File

@ -1,5 +1,5 @@
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
let $engine_type=MyISAM; let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test -- source extra/rpl_tests/rpl_log.test

View File

@ -4,7 +4,7 @@
# Test of manual relay log rotation with FLUSH LOGS. # Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/rpl_tests/rpl_max_relay_size.test -- source extra/rpl_tests/rpl_max_relay_size.test
# End of 4.1 tests # End of 4.1 tests

View File

@ -4,7 +4,7 @@
# one binlog event containing all queries) # one binlog event containing all queries)
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/rpl_tests/rpl_multi_query.test -- source extra/rpl_tests/rpl_multi_query.test

View File

@ -15,7 +15,7 @@
#should proceed in a correct way. #should proceed in a correct way.
################################# #################################
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# first, cause a duplicate key problem on the slave # first, cause a duplicate key problem on the slave

View File

@ -4,7 +4,7 @@
# case. So this test is meaningul only in statement-based (and if it was # case. So this test is meaningul only in statement-based (and if it was
# enabled in row-based, it would fail as expected). # enabled in row-based, it would fail as expected).
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;

View File

@ -1,5 +1,5 @@
# TBF - difference in row level logging # TBF - difference in row level logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/rpl_tests/rpl_reset_slave.test -- source extra/rpl_tests/rpl_reset_slave.test
# End of 4.1 tests # End of 4.1 tests

View File

@ -1,4 +1,4 @@
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# Test is dependent on binlog positions # Test is dependent on binlog positions

View File

@ -1,4 +1,5 @@
-- source include/have_binlog_format_row.inc -- source include/have_row_based.inc
-- source include/not_ndb_default.inc
-- source include/master-slave.inc -- source include/master-slave.inc
connection master; connection master;
@ -8,6 +9,9 @@ create database mysqltest1;
--enable_warnings --enable_warnings
use mysqltest1; use mysqltest1;
set session binlog_format=row;
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;
@ -462,6 +466,41 @@ if ($you_want_to_test_UDF)
} }
sync_slave_with_master; sync_slave_with_master;
#
# Bug#20863 If binlog format is changed between update and unlock of
# tables, wrong binlog
#
connection master;
DROP TABLE IF EXISTS t11;
SET SESSION BINLOG_FORMAT=STATEMENT;
CREATE TABLE t11 (song VARCHAR(255));
LOCK TABLES t11 WRITE;
SET SESSION BINLOG_FORMAT=ROW;
INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
UNLOCK TABLES;
--query_vertical SELECT * FROM t11
sync_slave_with_master;
USE mysqltest1;
--query_vertical SELECT * FROM t11
connection master;
DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events from 102;
sync_slave_with_master;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql

View File

@ -1,7 +1,7 @@
# drop table t1 t2 t3 are included int master-slave.inc # drop table t1 t2 t3 are included int master-slave.inc
# meaningful only in statement-based: # meaningful only in statement-based:
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc

View File

@ -2,7 +2,7 @@
# Test of triggers with replication # Test of triggers with replication
# Adding statement include due to Bug 12574 # Adding statement include due to Bug 12574
# TODO: Remove statement include once 12574 is patched # TODO: Remove statement include once 12574 is patched
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
--source include/master-slave.inc --source include/master-slave.inc
--disable_warnings --disable_warnings

View File

@ -1,5 +1,5 @@
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;

View File

@ -1,4 +1,4 @@
--source include/not_ndb_default.inc
let $engine=MyISAM; let $engine=MyISAM;
--source extra/rpl_tests/rpl_truncate.test --source extra/rpl_tests/rpl_truncate.test

View File

@ -1,5 +1,6 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/not_ndb_default.inc
let $engine=InnoDB; let $engine=InnoDB;
--source extra/rpl_tests/rpl_truncate.test --source extra/rpl_tests/rpl_truncate.test

View File

@ -132,4 +132,24 @@ DROP TABLE t1;
--sync_with_master --sync_with_master
--connection master --connection master
#
# BUG#19419: "VIEW: View that the column name is different
# by master and slave is made".
#
connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
sync_slave_with_master;
explain v1;
show create table v1;
select * from v1;
connection master;
drop table t1;
drop view v1;
sync_slave_with_master;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -13,6 +13,7 @@ connect (con2,localhost,root,,);
flush status; flush status;
show status like 'Table_lock%'; show status like 'Table_lock%';
select * from information_schema.session_status where variable_name like 'Table_lock%';
connection con1; connection con1;
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
--disable_warnings --disable_warnings
@ -34,6 +35,7 @@ unlock tables;
connection con1; connection con1;
reap; reap;
show status like 'Table_lock%'; show status like 'Table_lock%';
select * from information_schema.session_status where variable_name like 'Table_lock%';
drop table t1; drop table t1;
disconnect con2; disconnect con2;
@ -102,6 +104,7 @@ while ($wait_more)
# Prerequisite. # Prerequisite.
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Save original setting. # Save original setting.
SET @save_thread_cache_size=@@thread_cache_size; SET @save_thread_cache_size=@@thread_cache_size;
@ -115,6 +118,7 @@ disconnect con2;
# Check that max_used_connections still reflects maximum value. # Check that max_used_connections still reflects maximum value.
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Check that after flush max_used_connections equals to current number # Check that after flush max_used_connections equals to current number
# of connections. First wait for previous disconnect to finish. # of connections. First wait for previous disconnect to finish.
@ -138,15 +142,18 @@ while ($wait_more)
--enable_result_log --enable_result_log
# Check that we don't count disconnected thread any longer. # Check that we don't count disconnected thread any longer.
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Check that max_used_connections is updated when cached thread is # Check that max_used_connections is updated when cached thread is
# reused... # reused...
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# ...and when new thread is created. # ...and when new thread is created.
connect (con3,localhost,root,,); connect (con3,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Restore original setting. # Restore original setting.
connection default; connection default;

View File

@ -1,5 +1,5 @@
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# TODO: Create row based version once $MYSQL_BINLOG has new RB version # TODO: Create row based version once $MYSQL_BINLOG has new RB version
# Embedded server does not support binlogging # Embedded server does not support binlogging
--source include/not_embedded.inc --source include/not_embedded.inc

View File

@ -83,16 +83,24 @@ drop table t1;
set GLOBAL max_join_size=10; set GLOBAL max_join_size=10;
set max_join_size=100; set max_join_size=100;
show variables like 'max_join_size'; show variables like 'max_join_size';
select * from information_schema.session_variables where variable_name like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size'; show global variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
select * from information_schema.global_variables where variable_name like 'max_join_size';
set GLOBAL max_join_size=2000; set GLOBAL max_join_size=2000;
show global variables like 'max_join_size'; show global variables like 'max_join_size';
select * from information_schema.global_variables where variable_name like 'max_join_size';
set max_join_size=DEFAULT; set max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show variables like 'max_join_size'; show variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
select * from information_schema.session_variables where variable_name like 'max_join_size';
set GLOBAL max_join_size=DEFAULT; set GLOBAL max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size'; show global variables like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
select * from information_schema.global_variables where variable_name like 'max_join_size';
set @@max_join_size=1000, @@global.max_join_size=2000; set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size; select @@local.max_join_size, @@global.max_join_size;
select @@identity, length(@@version)>0; select @@identity, length(@@version)>0;
@ -106,50 +114,68 @@ set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF",
set global concurrent_insert=2; set global concurrent_insert=2;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=1; set global concurrent_insert=1;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=0; set global concurrent_insert=0;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=DEFAULT; set global concurrent_insert=DEFAULT;
select @@concurrent_insert; select @@concurrent_insert;
set global timed_mutexes=ON; set global timed_mutexes=ON;
show variables like 'timed_mutexes'; show variables like 'timed_mutexes';
select * from information_schema.session_variables where variable_name like 'timed_mutexes';
set global timed_mutexes=0; set global timed_mutexes=0;
show variables like 'timed_mutexes'; show variables like 'timed_mutexes';
select * from information_schema.session_variables where variable_name like 'timed_mutexes';
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE"; set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine'; show local variables like 'storage_engine';
select * from information_schema.session_variables where variable_name like 'storage_engine';
show global variables like 'storage_engine'; show global variables like 'storage_engine';
select * from information_schema.global_variables where variable_name like 'storage_engine';
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=default; set GLOBAL myisam_max_sort_file_size=default;
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE --replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
show variables like 'myisam_max_sort_file_size'; show variables like 'myisam_max_sort_file_size';
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10; set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%'; show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%';
show session variables like 'net_%'; show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%';
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%'; show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%';
show session variables like 'net_%'; show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%';
set net_buffer_length=1; set net_buffer_length=1;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set net_buffer_length=2000000000; set net_buffer_length=2000000000;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set character set cp1251_koi8; set character set cp1251_koi8;
show variables like "character_set_client"; show variables like "character_set_client";
select * from information_schema.session_variables where variable_name like 'character_set_client';
select @@timestamp>0; select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000; set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5); select ROUND(RAND(),5);
show variables like '%alloc%'; show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%';
set @@range_alloc_block_size=1024*16; set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2; set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18; set @@query_prealloc_size=1024*18;
@ -157,10 +183,12 @@ set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1; set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size; select @@query_alloc_block_size;
show variables like '%alloc%'; show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%';
set @@range_alloc_block_size=default; set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default; set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default; set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%'; show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%';
# #
# Bug #10904 Illegal mix of collations between # Bug #10904 Illegal mix of collations between
@ -363,6 +391,8 @@ set global ft_boolean_syntax = @@init_connect;
set global myisam_max_sort_file_size=4294967296; set global myisam_max_sort_file_size=4294967296;
--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE --replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set global myisam_max_sort_file_size=default; set global myisam_max_sort_file_size=default;
# #
@ -398,12 +428,16 @@ SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0) # BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
set @tstlw = @@log_warnings; set @tstlw = @@log_warnings;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = 0; set global log_warnings = 0;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = 42; set global log_warnings = 42;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = @tstlw; set global log_warnings = @tstlw;
show global variables like 'log_warnings'; show global variables like 'log_warnings';
select * from information_schema.global_variables where variable_name like 'log_warnings';
# #
# BUG#4788 show create table provides incorrect statement # BUG#4788 show create table provides incorrect statement
@ -435,6 +469,7 @@ drop table t1;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7; SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYISAM_DATA_POINTER_SIZE';
# #
# Bug #6958: negative arguments to integer options wrap around # Bug #6958: negative arguments to integer options wrap around
@ -442,6 +477,7 @@ SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
SET GLOBAL table_open_cache=-1; SET GLOBAL table_open_cache=-1;
SHOW VARIABLES LIKE 'table_open_cache'; SHOW VARIABLES LIKE 'table_open_cache';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
SET GLOBAL table_open_cache=DEFAULT; SET GLOBAL table_open_cache=DEFAULT;
# #
@ -527,6 +563,7 @@ select @@global.character_set_filesystem;
set @old_sql_big_selects = @@sql_big_selects; set @old_sql_big_selects = @@sql_big_selects;
set @@sql_big_selects = 1; set @@sql_big_selects = 1;
show variables like 'sql_big_selects'; show variables like 'sql_big_selects';
select * from information_schema.session_variables where variable_name like 'sql_big_selects';
set @@sql_big_selects = @old_sql_big_selects; set @@sql_big_selects = @old_sql_big_selects;
# #
@ -535,10 +572,14 @@ set @@sql_big_selects = @old_sql_big_selects;
# #
set @@sql_notes = 0, @@sql_warnings = 0; set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes'; show variables like 'sql_notes';
select * from information_schema.session_variables where variable_name like 'sql_notes';
show variables like 'sql_warnings'; show variables like 'sql_warnings';
select * from information_schema.session_variables where variable_name like 'sql_warnings';
set @@sql_notes = 1, @@sql_warnings = 1; set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes'; show variables like 'sql_notes';
select * from information_schema.session_variables where variable_name like 'sql_notes';
show variables like 'sql_warnings'; show variables like 'sql_warnings';
select * from information_schema.session_variables where variable_name like 'sql_warnings';
# #
# Bug #12792: @@system_time_zone is not SELECTable. # Bug #12792: @@system_time_zone is not SELECTable.
@ -565,9 +606,15 @@ select @@basedir, @@datadir, @@tmpdir;
--replace_column 2 # --replace_column 2 #
show variables like 'basedir'; show variables like 'basedir';
--replace_column 2 # --replace_column 2 #
select * from information_schema.session_variables where variable_name like 'basedir';
--replace_column 2 #
show variables like 'datadir'; show variables like 'datadir';
--replace_column 2 # --replace_column 2 #
select * from information_schema.session_variables where variable_name like 'datadir';
--replace_column 2 #
show variables like 'tmpdir'; show variables like 'tmpdir';
--replace_column 2 #
select * from information_schema.session_variables where variable_name like 'tmpdir';
# #
# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables # Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
@ -577,6 +624,8 @@ show variables like 'tmpdir';
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key; select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
--replace_column 2 # --replace_column 2 #
show variables like 'ssl%'; show variables like 'ssl%';
--replace_column 2 #
select * from information_schema.session_variables where variable_name like 'ssl%';
# #
# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES # Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
@ -584,6 +633,7 @@ show variables like 'ssl%';
# #
select @@log_queries_not_using_indexes; select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes'; show variables like 'log_queries_not_using_indexes';
select * from information_schema.session_variables where variable_name like 'log_queries_not_using_indexes';
# #
# Bug#20908: Crash if select @@"" # Bug#20908: Crash if select @@""

View File

@ -53,7 +53,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_data_objects.cc rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_data_objects.cc
event_queue.cc event_db_repository.cc event_queue.cc event_db_repository.cc
sql_tablespace.cc events.cc ../sql-common/my_user.c sql_tablespace.cc events.cc ../sql-common/my_user.c
partition_info.cc rpl_injector.cc sql_locale.cc partition_info.cc rpl_utility.cc rpl_injector.cc sql_locale.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h ${PROJECT_SOURCE_DIR}/include/mysqld_error.h

View File

@ -52,7 +52,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
ha_partition.h \ ha_partition.h \
ha_ndbcluster.h ha_ndbcluster_binlog.h \ ha_ndbcluster.h ha_ndbcluster_binlog.h \
ha_ndbcluster_tables.h \ ha_ndbcluster_tables.h \
opt_range.h protocol.h rpl_tblmap.h \ opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
log.h sql_show.h rpl_rli.h \ log.h sql_show.h rpl_rli.h \
sql_select.h structs.h table.h sql_udf.h hash_filo.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h \
lex.h lex_symbol.h sql_acl.h sql_crypt.h \ lex.h lex_symbol.h sql_acl.h sql_crypt.h \
@ -93,7 +93,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \ slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \
rpl_injector.cc \ rpl_utility.cc rpl_injector.cc \
sql_union.cc sql_derived.cc \ sql_union.cc sql_derived.cc \
client.c sql_client.cc mini_client_errors.c pack.c\ client.c sql_client.cc mini_client_errors.c pack.c\
stacktrace.c repl_failsafe.h repl_failsafe.cc \ stacktrace.c repl_failsafe.h repl_failsafe.cc \

View File

@ -1257,6 +1257,16 @@ void Field::hash(ulong *nr, ulong *nr2)
} }
} }
my_size_t
Field::do_last_null_byte() const
{
DBUG_ASSERT(null_ptr == NULL || (byte*) null_ptr >= table->record[0]);
if (null_ptr)
return (byte*) null_ptr - table->record[0] + 1;
else
return LAST_NULL_BYTE_UNDEF;
}
void Field::copy_from_tmp(int row_offset) void Field::copy_from_tmp(int row_offset)
{ {
@ -8094,6 +8104,33 @@ Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
} }
my_size_t
Field_bit::do_last_null_byte() const
{
/*
Code elsewhere is assuming that bytes are 8 bits, so I'm using
that value instead of the correct one: CHAR_BIT.
REFACTOR SUGGESTION (Matz): Change to use the correct number of
bits. On systems with CHAR_BIT > 8 (not very common), the storage
will lose the extra bits.
*/
DBUG_PRINT("debug", ("bit_ofs=%d, bit_len=%d, bit_ptr=%p",
bit_ofs, bit_len, bit_ptr));
uchar *result;
if (bit_len == 0)
result= null_ptr;
else if (bit_ofs + bit_len > 8)
result= bit_ptr + 1;
else
result= bit_ptr;
if (result)
return (byte*) result - table->record[0] + 1;
else
return LAST_NULL_BYTE_UNDEF;
}
Field *Field_bit::new_key_field(MEM_ROOT *root, Field *Field_bit::new_key_field(MEM_ROOT *root,
struct st_table *new_table, struct st_table *new_table,
char *new_ptr, uchar *new_null_ptr, char *new_ptr, uchar *new_null_ptr,
@ -8345,6 +8382,14 @@ const char *Field_bit::unpack(char *to, const char *from)
} }
void Field_bit::set_default()
{
my_ptrdiff_t const offset= table->s->default_values - table->record[0];
uchar bits= get_rec_bits(bit_ptr + offset, bit_ofs, bit_len);
set_rec_bits(bits, bit_ptr, bit_ofs, bit_len);
Field::set_default();
}
/* /*
Bit field support for non-MyISAM tables. Bit field support for non-MyISAM tables.
*/ */

View File

@ -217,6 +217,33 @@ public:
{ if (null_ptr) null_ptr[row_offset]&= (uchar) ~null_bit; } { if (null_ptr) null_ptr[row_offset]&= (uchar) ~null_bit; }
inline bool maybe_null(void) { return null_ptr != 0 || table->maybe_null; } inline bool maybe_null(void) { return null_ptr != 0 || table->maybe_null; }
inline bool real_maybe_null(void) { return null_ptr != 0; } inline bool real_maybe_null(void) { return null_ptr != 0; }
enum {
LAST_NULL_BYTE_UNDEF= 0
};
/*
Find the position of the last null byte for the field.
SYNOPSIS
last_null_byte()
DESCRIPTION
Return a pointer to the last byte of the null bytes where the
field conceptually is placed.
RETURN VALUE
The position of the last null byte relative to the beginning of
the record. If the field does not use any bits of the null
bytes, the value 0 (LAST_NULL_BYTE_UNDEF) is returned.
*/
my_size_t last_null_byte() const {
my_size_t bytes= do_last_null_byte();
DBUG_PRINT("debug", ("last_null_byte() ==> %d", bytes));
DBUG_ASSERT(bytes <= table->s->null_bytes);
return bytes;
}
virtual void make_field(Send_field *); virtual void make_field(Send_field *);
virtual void sort_string(char *buff,uint length)=0; virtual void sort_string(char *buff,uint length)=0;
virtual bool optimize_range(uint idx, uint part); virtual bool optimize_range(uint idx, uint part);
@ -377,6 +404,20 @@ public:
friend class Item_sum_min; friend class Item_sum_min;
friend class Item_sum_max; friend class Item_sum_max;
friend class Item_func_group_concat; friend class Item_func_group_concat;
private:
/*
Primitive for implementing last_null_byte().
SYNOPSIS
do_last_null_byte()
DESCRIPTION
Primitive for the implementation of the last_null_byte()
function. This represents the inheritance interface and can be
overridden by subclasses.
*/
virtual my_size_t do_last_null_byte() const;
}; };
@ -1412,6 +1453,8 @@ public:
void sql_type(String &str) const; void sql_type(String &str) const;
char *pack(char *to, const char *from, uint max_length=~(uint) 0); char *pack(char *to, const char *from, uint max_length=~(uint) 0);
const char *unpack(char* to, const char *from); const char *unpack(char* to, const char *from);
virtual void set_default();
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
char *new_ptr, uchar *new_null_ptr, char *new_ptr, uchar *new_null_ptr,
uint new_null_bit); uint new_null_bit);
@ -1432,6 +1475,9 @@ public:
Field::move_field_offset(ptr_diff); Field::move_field_offset(ptr_diff);
bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*); bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*);
} }
private:
virtual my_size_t do_last_null_byte() const;
}; };

View File

@ -3171,7 +3171,7 @@ int MYSQL_BIN_LOG::
flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event) flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event)
{ {
DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)"); DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)");
DBUG_ASSERT(thd->current_stmt_binlog_row_based && mysql_bin_log.is_open()); DBUG_ASSERT(mysql_bin_log.is_open());
DBUG_PRINT("enter", ("event=%p", event)); DBUG_PRINT("enter", ("event=%p", event));
int error= 0; int error= 0;
@ -3416,9 +3416,6 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
} }
} }
} }
/* Forget those values, for next binlogger: */
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
thd->auto_inc_intervals_in_cur_stmt_for_binlog.empty();
} }
/* /*

View File

@ -24,6 +24,7 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "slave.h" #include "slave.h"
#include "rpl_filter.h" #include "rpl_filter.h"
#include "rpl_utility.h"
#include <my_dir.h> #include <my_dir.h>
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
#include <base64.h> #include <base64.h>
@ -5290,38 +5291,143 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
/* /*
Unpack a row into a record. The row is assumed to only consist of the fields Unpack a row into a record.
for which the bitset represented by 'arr' and 'bits'; the other parts of the
record are left alone. SYNOPSIS
unpack_row()
rli Relay log info
table Table to unpack into
colcnt Number of columns to read from record
record Record where the data should be unpacked
row Packed row data
cols Pointer to columns data to fill in
row_end Pointer to variable that will hold the value of the
one-after-end position for the row
master_reclength
Pointer to variable that will be set to the length of the
record on the master side
rw_set Pointer to bitmap that holds either the read_set or the
write_set of the table
DESCRIPTION
The row is assumed to only consist of the fields for which the
bitset represented by 'arr' and 'bits'; the other parts of the
record are left alone.
At most 'colcnt' columns are read: if the table is larger than
that, the remaining fields are not filled in.
RETURN VALUE
Error code, or zero if no error. The following error codes can
be returned:
ER_NO_DEFAULT_FOR_FIELD
Returned if one of the fields existing on the slave but not on
the master does not have a default value (and isn't nullable)
*/ */
static char const *unpack_row(TABLE *table, static int
byte *record, char const *row, unpack_row(RELAY_LOG_INFO *rli,
MY_BITMAP const *cols) TABLE *table, uint const colcnt, byte *record,
char const *row, MY_BITMAP const *cols,
char const **row_end, ulong *master_reclength,
MY_BITMAP* const rw_set, Log_event_type const event_type)
{ {
DBUG_ASSERT(record && row); DBUG_ASSERT(record && row);
MY_BITMAP *write_set= table->write_set;
my_size_t const n_null_bytes= table->s->null_bytes;
my_ptrdiff_t const offset= record - (byte*) table->record[0]; my_ptrdiff_t const offset= record - (byte*) table->record[0];
my_size_t master_null_bytes= table->s->null_bytes;
memcpy(record, row, n_null_bytes); if (colcnt != table->s->fields)
char const *ptr= row + n_null_bytes; {
Field **fptr= &table->field[colcnt-1];
do
master_null_bytes= (*fptr)->last_null_byte();
while (master_null_bytes == Field::LAST_NULL_BYTE_UNDEF &&
fptr-- > table->field);
/*
If master_null_bytes is LAST_NULL_BYTE_UNDEF (0) at this time,
there were no nullable fields nor BIT fields at all in the
columns that are common to the master and the slave. In that
case, there is only one null byte holding the X bit.
OBSERVE! There might still be nullable columns following the
common columns, so table->s->null_bytes might be greater than 1.
*/
if (master_null_bytes == Field::LAST_NULL_BYTE_UNDEF)
master_null_bytes= 1;
}
DBUG_ASSERT(master_null_bytes <= table->s->null_bytes);
memcpy(record, row, master_null_bytes); // [1]
int error= 0;
bitmap_set_all(rw_set);
bitmap_set_all(write_set);
Field **const begin_ptr = table->field; Field **const begin_ptr = table->field;
for (Field **field_ptr= begin_ptr ; *field_ptr ; ++field_ptr) Field **field_ptr;
char const *ptr= row + master_null_bytes;
Field **const end_ptr= begin_ptr + colcnt;
for (field_ptr= begin_ptr ; field_ptr < end_ptr ; ++field_ptr)
{ {
Field *const f= *field_ptr; Field *const f= *field_ptr;
if (bitmap_is_set(cols, (uint) (field_ptr - begin_ptr))) if (bitmap_is_set(cols, field_ptr - begin_ptr))
{ {
f->move_field_offset(offset);
ptr= f->unpack(f->ptr, ptr);
f->move_field_offset(-offset);
/* Field...::unpack() cannot return 0 */ /* Field...::unpack() cannot return 0 */
ptr= f->unpack(f->ptr + offset, ptr); DBUG_ASSERT(ptr != NULL);
} }
else else
bitmap_clear_bit(write_set, (uint) (field_ptr - begin_ptr)); bitmap_clear_bit(rw_set, field_ptr - begin_ptr);
} }
return ptr;
*row_end = ptr;
if (master_reclength)
{
if (*field_ptr)
*master_reclength = (*field_ptr)->ptr - (char*) table->record[0];
else
*master_reclength = table->s->reclength;
}
/*
Set properties for remaining columns, if there are any. We let the
corresponding bit in the write_set be set, to write the value if
it was not there already. We iterate over all remaining columns,
even if there were an error, to get as many error messages as
possible. We are still able to return a pointer to the next row,
so redo that.
This generation of error messages is only relevant when inserting
new rows.
*/
for ( ; *field_ptr ; ++field_ptr)
{
uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG;
DBUG_PRINT("debug", ("flags = 0x%x, mask = 0x%x, flags & mask = 0x%x",
(*field_ptr)->flags, mask,
(*field_ptr)->flags & mask));
if (event_type == WRITE_ROWS_EVENT &&
((*field_ptr)->flags & mask) == mask)
{
slave_print_msg(ERROR_LEVEL, rli, ER_NO_DEFAULT_FOR_FIELD,
"Field `%s` of table `%s`.`%s` "
"has no default value and cannot be NULL",
(*field_ptr)->field_name, table->s->db.str,
table->s->table_name.str);
error = ER_NO_DEFAULT_FOR_FIELD;
}
else
(*field_ptr)->set_default();
}
return error;
} }
int Rows_log_event::exec_event(st_relay_log_info *rli) int Rows_log_event::exec_event(st_relay_log_info *rli)
@ -5425,6 +5531,9 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
/* /*
When the open and locking succeeded, we add all the tables to When the open and locking succeeded, we add all the tables to
the table map and remove them from tables to lock. the table map and remove them from tables to lock.
We also invalidate the query cache for all the tables, since
they will now be changed.
*/ */
TABLE_LIST *ptr; TABLE_LIST *ptr;
@ -5433,6 +5542,9 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
rli->m_table_map.set_table(ptr->table_id, ptr->table); rli->m_table_map.set_table(ptr->table_id, ptr->table);
rli->touching_table(ptr->db, ptr->table_name, ptr->table_id); rli->touching_table(ptr->db, ptr->table_name, ptr->table_id);
} }
#ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(rli->tables_to_lock);
#endif
rli->clear_tables_to_lock(); rli->clear_tables_to_lock();
} }
@ -5477,7 +5589,11 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
error= do_before_row_operations(table); error= do_before_row_operations(table);
while (error == 0 && row_start < (const char*) m_rows_end) while (error == 0 && row_start < (const char*) m_rows_end)
{ {
char const *row_end= do_prepare_row(thd, table, row_start); char const *row_end= NULL;
if ((error= do_prepare_row(thd, rli, table, row_start, &row_end)))
break; // We should perform the after-row operation even in
// the case of error
DBUG_ASSERT(row_end != NULL); // cannot happen DBUG_ASSERT(row_end != NULL); // cannot happen
DBUG_ASSERT(row_end <= (const char*)m_rows_end); DBUG_ASSERT(row_end <= (const char*)m_rows_end);
@ -5682,7 +5798,7 @@ void Rows_log_event::pack_info(Protocol *protocol)
#endif #endif
/************************************************************************** /**************************************************************************
Table_map_log_event member functions Table_map_log_event member functions and support functions
**************************************************************************/ **************************************************************************/
/* /*
@ -5924,72 +6040,9 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli)
*/ */
DBUG_ASSERT(m_table->in_use); DBUG_ASSERT(m_table->in_use);
/* table_def const def(m_coltype, m_colcnt);
Check that the number of columns and the field types in the if (def.compatible_with(rli, m_table))
event match the number of columns and field types in the opened
table.
*/
uint col= m_table->s->fields;
if (col == m_colcnt)
{ {
while (col-- > 0)
if (m_table->field[col]->type() != m_coltype[col])
break;
}
TABLE_SHARE const *const tsh= m_table->s;
/*
Check the following termination conditions:
(col == m_table->s->fields)
==> (m_table->s->fields != m_colcnt)
(0 <= col < m_table->s->fields)
==> (m_table->field[col]->type() != m_coltype[col])
Logically, A ==> B is equivalent to !A || B
Since col is unsigned, is suffices to check that col <=
tsh->fields. If col wrapped (by decreasing col when it is 0),
the number will be UINT_MAX, which is greater than tsh->fields.
*/
DBUG_ASSERT(!(col == tsh->fields) || tsh->fields != m_colcnt);
DBUG_ASSERT(!(col < tsh->fields) ||
(m_table->field[col]->type() != m_coltype[col]));
if (col <= tsh->fields)
{
/* purecov: begin inspected */
/*
If we get here, the number of columns in the event didn't
match the number of columns in the table on the slave, *or*
there were a column in the table on the slave that did not
have the same type as given in the event.
If 'col' has the value that was assigned to it, it was a
mismatch between the number of columns on the master and the
slave.
*/
if (col == tsh->fields)
{
DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
"Table width mismatch - "
"received %u columns, %s.%s has %u columns",
m_colcnt, tsh->db.str, tsh->table_name.str, tsh->fields);
}
else
{
DBUG_ASSERT(col < m_colcnt && col < tsh->fields);
DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
"Column %d type mismatch - "
"received type %d, %s.%s has type %d",
col, m_coltype[col], tsh->db.str, tsh->table_name.str,
m_table->field[col]->type());
}
thd->query_error= 1; thd->query_error= 1;
error= ERR_BAD_TABLE_DEF; error= ERR_BAD_TABLE_DEF;
goto err; goto err;
@ -6188,19 +6241,21 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error; return error;
} }
char const *Write_rows_log_event::do_prepare_row(THD *thd, TABLE *table, int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli,
char const *row_start) TABLE *table,
char const *row_start,
char const **row_end)
{ {
char const *ptr= row_start;
DBUG_ASSERT(table != NULL); DBUG_ASSERT(table != NULL);
/* DBUG_ASSERT(row_start && row_end);
This assertion actually checks that there is at least as many
columns on the slave as on the master. int error;
*/ error= unpack_row(rli,
DBUG_ASSERT(table->s->fields >= m_width); table, m_width, table->record[0],
DBUG_ASSERT(ptr); row_start, &m_cols, row_end, &m_master_reclength,
ptr= unpack_row(table, (byte*)table->record[0], ptr, &m_cols); table->write_set, WRITE_ROWS_EVENT);
return ptr; bitmap_copy(table->read_set, table->write_set);
return error;
} }
/* /*
@ -6247,21 +6302,111 @@ namespace {
/* /*
Replace the provided record in the database. Copy "extra" columns from record[1] to record[0].
Similar to how it is done in <code>mysql_insert()</code>, we first Copy the extra fields that are not present on the master but are
try to do a <code>ha_write_row()</code> and of that fails due to present on the slave from record[1] to record[0]. This is used
duplicated keys (or indices), we do an <code>ha_update_row()</code> after fetching a record that are to be updated, either inside
or a <code>ha_delete_row()</code> instead. replace_record() or as part of executing an update_row().
@param thd Thread context for writing the record.
@param table Table to which record should be written.
@return Error code on failure, 0 on success.
*/ */
static int static int
replace_record(THD *thd, TABLE *table) copy_extra_record_fields(TABLE *table,
my_size_t master_reclength,
my_ptrdiff_t master_fields)
{ {
DBUG_PRINT("info", ("Copying to %p "
"from field %d at offset %u "
"to field %d at offset %u",
table->record[0],
master_fields, master_reclength,
table->s->fields, table->s->reclength));
/*
Copying the extra fields of the slave that does not exist on
master into record[0] (which are basically the default values).
*/
DBUG_ASSERT(master_reclength <= table->s->reclength);
if (master_reclength < table->s->reclength)
bmove_align(table->record[0] + master_reclength,
table->record[1] + master_reclength,
table->s->reclength - master_reclength);
/*
Bit columns are special. We iterate over all the remaining
columns and copy the "extra" bits to the new record. This is
not a very good solution: it should be refactored on
opportunity.
REFACTORING SUGGESTION (Matz). Introduce a member function
similar to move_field_offset() called copy_field_offset() to
copy field values and implement it for all Field subclasses. Use
this function to copy data from the found record to the record
that are going to be inserted.
The copy_field_offset() function need to be a virtual function,
which in this case will prevent copying an entire range of
fields efficiently.
*/
{
Field **field_ptr= table->field + master_fields;
for ( ; *field_ptr ; ++field_ptr)
{
/*
Set the null bit according to the values in record[1]
*/
if ((*field_ptr)->maybe_null() &&
(*field_ptr)->is_null_in_record(reinterpret_cast<uchar*>(table->record[1])))
(*field_ptr)->set_null();
else
(*field_ptr)->set_notnull();
/*
Do the extra work for special columns.
*/
switch ((*field_ptr)->real_type())
{
default:
/* Nothing to do */
break;
case FIELD_TYPE_BIT:
Field_bit *f= static_cast<Field_bit*>(*field_ptr);
my_ptrdiff_t const offset= table->record[1] - table->record[0];
uchar const bits=
get_rec_bits(f->bit_ptr + offset, f->bit_ofs, f->bit_len);
set_rec_bits(bits, f->bit_ptr, f->bit_ofs, f->bit_len);
break;
}
}
}
return 0; // All OK
}
/*
Replace the provided record in the database.
SYNOPSIS
replace_record()
thd Thread context for writing the record.
table Table to which record should be written.
master_reclength
Offset to first column that is not present on the master,
alternatively the length of the record on the master
side.
RETURN VALUE
Error code on failure, 0 on success.
DESCRIPTION
Similar to how it is done in mysql_insert(), we first try to do
a ha_write_row() and of that fails due to duplicated keys (or
indices), we do an ha_update_row() or a ha_delete_row() instead.
*/
static int
replace_record(THD *thd, TABLE *table,
ulong const master_reclength,
uint const master_fields)
{
DBUG_ENTER("replace_record");
DBUG_ASSERT(table != NULL && thd != NULL); DBUG_ASSERT(table != NULL && thd != NULL);
int error; int error;
@ -6273,7 +6418,7 @@ replace_record(THD *thd, TABLE *table)
if ((keynum= table->file->get_dup_key(error)) < 0) if ((keynum= table->file->get_dup_key(error)) < 0)
{ {
/* We failed to retrieve the duplicate key */ /* We failed to retrieve the duplicate key */
return HA_ERR_FOUND_DUPP_KEY; DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
} }
/* /*
@ -6290,20 +6435,20 @@ replace_record(THD *thd, TABLE *table)
{ {
error= table->file->rnd_pos(table->record[1], table->file->dup_ref); error= table->file->rnd_pos(table->record[1], table->file->dup_ref);
if (error) if (error)
return error; DBUG_RETURN(error);
} }
else else
{ {
if (table->file->extra(HA_EXTRA_FLUSH_CACHE)) if (table->file->extra(HA_EXTRA_FLUSH_CACHE))
{ {
return my_errno; DBUG_RETURN(my_errno);
} }
if (key.get() == NULL) if (key.get() == NULL)
{ {
key.assign(static_cast<char*>(my_alloca(table->s->max_unique_length))); key.assign(static_cast<char*>(my_alloca(table->s->max_unique_length)));
if (key.get() == NULL) if (key.get() == NULL)
return ENOMEM; DBUG_RETURN(ENOMEM);
} }
key_copy((byte*)key.get(), table->record[0], table->key_info + keynum, 0); key_copy((byte*)key.get(), table->record[0], table->key_info + keynum, 0);
@ -6312,7 +6457,7 @@ replace_record(THD *thd, TABLE *table)
table->key_info[keynum].key_length, table->key_info[keynum].key_length,
HA_READ_KEY_EXACT); HA_READ_KEY_EXACT);
if (error) if (error)
return error; DBUG_RETURN(error);
} }
/* /*
@ -6320,6 +6465,12 @@ replace_record(THD *thd, TABLE *table)
will enable us to update it or, alternatively, delete it (so will enable us to update it or, alternatively, delete it (so
that we can insert the new row afterwards). that we can insert the new row afterwards).
First we copy the columns into table->record[0] that are not
present on the master from table->record[1], if there are any.
*/
copy_extra_record_fields(table, master_reclength, master_fields);
/*
REPLACE is defined as either INSERT or DELETE + INSERT. If REPLACE is defined as either INSERT or DELETE + INSERT. If
possible, we can replace it with an UPDATE, but that will not possible, we can replace it with an UPDATE, but that will not
work on InnoDB if FOREIGN KEY checks are necessary. work on InnoDB if FOREIGN KEY checks are necessary.
@ -6339,22 +6490,22 @@ replace_record(THD *thd, TABLE *table)
{ {
error=table->file->ha_update_row(table->record[1], error=table->file->ha_update_row(table->record[1],
table->record[0]); table->record[0]);
return error; DBUG_RETURN(error);
} }
else else
{ {
if ((error= table->file->ha_delete_row(table->record[1]))) if ((error= table->file->ha_delete_row(table->record[1])))
return error; DBUG_RETURN(error);
/* Will retry ha_write_row() with the offending row removed. */ /* Will retry ha_write_row() with the offending row removed. */
} }
} }
return error; DBUG_RETURN(error);
} }
int Write_rows_log_event::do_exec_row(TABLE *table) int Write_rows_log_event::do_exec_row(TABLE *table)
{ {
DBUG_ASSERT(table != NULL); DBUG_ASSERT(table != NULL);
int error= replace_record(thd, table); int error= replace_record(thd, table, m_master_reclength, m_width);
return error; return error;
} }
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
@ -6440,7 +6591,7 @@ static int find_and_fetch_row(TABLE *table, byte *key)
/* We have a key: search the table using the index */ /* We have a key: search the table using the index */
if (!table->file->inited && (error= table->file->ha_index_init(0, FALSE))) if (!table->file->inited && (error= table->file->ha_index_init(0, FALSE)))
return error; return error;
/* /*
We need to set the null bytes to ensure that the filler bit are We need to set the null bytes to ensure that the filler bit are
all set when returning. There are storage engines that just set all set when returning. There are storage engines that just set
@ -6526,6 +6677,7 @@ static int find_and_fetch_row(TABLE *table, byte *key)
table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
table->record[1][pos]= 0xFF; table->record[1][pos]= 0xFF;
error= table->file->rnd_next(table->record[1]); error= table->file->rnd_next(table->record[1]);
switch (error) switch (error)
{ {
case 0: case 0:
@ -6640,20 +6792,23 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error; return error;
} }
char const *Delete_rows_log_event::do_prepare_row(THD *thd, TABLE *table, int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli,
char const *row_start) TABLE *table,
char const *row_start,
char const **row_end)
{ {
char const *ptr= row_start; int error;
DBUG_ASSERT(ptr); DBUG_ASSERT(row_start && row_end);
/* /*
This assertion actually checks that there is at least as many This assertion actually checks that there is at least as many
columns on the slave as on the master. columns on the slave as on the master.
*/ */
DBUG_ASSERT(table->s->fields >= m_width); DBUG_ASSERT(table->s->fields >= m_width);
DBUG_ASSERT(ptr != NULL); error= unpack_row(rli,
ptr= unpack_row(table, table->record[0], ptr, &m_cols); table, m_width, table->record[0],
row_start, &m_cols, row_end, &m_master_reclength,
table->read_set, DELETE_ROWS_EVENT);
/* /*
If we will access rows using the random access method, m_key will If we will access rows using the random access method, m_key will
be set to NULL, so we do not need to make a key copy in that case. be set to NULL, so we do not need to make a key copy in that case.
@ -6665,7 +6820,7 @@ char const *Delete_rows_log_event::do_prepare_row(THD *thd, TABLE *table,
key_copy(m_key, table->record[0], key_info, 0); key_copy(m_key, table->record[0], key_info, 0);
} }
return ptr; return error;
} }
int Delete_rows_log_event::do_exec_row(TABLE *table) int Delete_rows_log_event::do_exec_row(TABLE *table)
@ -6779,11 +6934,13 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error; return error;
} }
char const *Update_rows_log_event::do_prepare_row(THD *thd, TABLE *table, int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli,
char const *row_start) TABLE *table,
char const *row_start,
char const **row_end)
{ {
char const *ptr= row_start; int error;
DBUG_ASSERT(ptr); DBUG_ASSERT(row_start && row_end);
/* /*
This assertion actually checks that there is at least as many This assertion actually checks that there is at least as many
columns on the slave as on the master. columns on the slave as on the master.
@ -6791,10 +6948,20 @@ char const *Update_rows_log_event::do_prepare_row(THD *thd, TABLE *table,
DBUG_ASSERT(table->s->fields >= m_width); DBUG_ASSERT(table->s->fields >= m_width);
/* record[0] is the before image for the update */ /* record[0] is the before image for the update */
ptr= unpack_row(table, table->record[0], ptr, &m_cols); error= unpack_row(rli,
DBUG_ASSERT(ptr != NULL); table, m_width, table->record[0],
row_start, &m_cols, row_end, &m_master_reclength,
table->read_set, UPDATE_ROWS_EVENT);
row_start = *row_end;
/* m_after_image is the after image for the update */ /* m_after_image is the after image for the update */
ptr= unpack_row(table, m_after_image, ptr, &m_cols); error= unpack_row(rli,
table, m_width, m_after_image,
row_start, &m_cols, row_end, &m_master_reclength,
table->write_set, UPDATE_ROWS_EVENT);
DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
DBUG_DUMP("m_after_image", m_after_image, table->s->reclength);
/* /*
If we will access rows using the random access method, m_key will If we will access rows using the random access method, m_key will
@ -6807,7 +6974,7 @@ char const *Update_rows_log_event::do_prepare_row(THD *thd, TABLE *table,
key_copy(m_key, table->record[0], key_info, 0); key_copy(m_key, table->record[0], key_info, 0);
} }
return ptr; return error;
} }
int Update_rows_log_event::do_exec_row(TABLE *table) int Update_rows_log_event::do_exec_row(TABLE *table)
@ -6825,17 +6992,20 @@ int Update_rows_log_event::do_exec_row(TABLE *table)
example, the partition engine). example, the partition engine).
Since find_and_fetch_row() puts the fetched record (i.e., the old Since find_and_fetch_row() puts the fetched record (i.e., the old
record) in record[0], we have to move it out of the way and into record) in record[1], we can keep it there. We put the new record
record[1]. After that, we can put the new record (i.e., the after (i.e., the after image) into record[0], and copy the fields that
image) into record[0]. are on the slave (i.e., in record[1]) into record[0], effectively
overwriting the default values that where put there by the
unpack_row() function.
*/ */
bmove_align(table->record[1], table->record[0], table->s->reclength);
bmove_align(table->record[0], m_after_image, table->s->reclength); bmove_align(table->record[0], m_after_image, table->s->reclength);
copy_extra_record_fields(table, m_master_reclength, m_width);
/* /*
Now we should have the right row to update. The old row (the one Now we have the right row to update. The old row (the one we're
we're looking for) has to be in record[1] and the new row has to looking for) is in record[1] and the new row has is in record[0].
be in record[0] for all storage engines to work correctly. We also have copied the original values already in the slave's
database into the after image delivered from the master.
*/ */
error= table->file->ha_update_row(table->record[1], table->record[0]); error= table->file->ha_update_row(table->record[1], table->record[0]);

View File

@ -1874,6 +1874,7 @@ protected:
ulong m_table_id; /* Table ID */ ulong m_table_id; /* Table ID */
MY_BITMAP m_cols; /* Bitmap denoting columns available */ MY_BITMAP m_cols; /* Bitmap denoting columns available */
ulong m_width; /* The width of the columns bitmap */ ulong m_width; /* The width of the columns bitmap */
ulong m_master_reclength; /* Length of record on master side */
/* Bit buffer in the same memory as the class */ /* Bit buffer in the same memory as the class */
uint32 m_bitbuf[128/(sizeof(uint32)*8)]; uint32 m_bitbuf[128/(sizeof(uint32)*8)];
@ -1927,12 +1928,15 @@ private:
since SQL thread specific data is not available: that data is made since SQL thread specific data is not available: that data is made
available for the do_exec function. available for the do_exec function.
RETURN VALUE
A pointer to the start of the next row, or NULL if the preparation A pointer to the start of the next row, or NULL if the preparation
failed. Currently, preparation cannot fail, but don't rely on this failed. Currently, preparation cannot fail, but don't rely on this
behavior. behavior.
RETURN VALUE
Error code, if something went wrong, 0 otherwise.
*/ */
virtual char const *do_prepare_row(THD*, TABLE*, char const *row_start) = 0; virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
char const *row_start, char const **row_end) = 0;
/* /*
Primitive to do the actual execution necessary for a row. Primitive to do the actual execution necessary for a row.
@ -2000,10 +2004,11 @@ private:
gptr m_memory; gptr m_memory;
byte *m_after_image; byte *m_after_image;
virtual int do_before_row_operations(TABLE *table); virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error); virtual int do_after_row_operations(TABLE *table, int error);
virtual char const *do_prepare_row(THD*, TABLE*, char const *row_start); virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
virtual int do_exec_row(TABLE *table); char const *row_start, char const **row_end);
virtual int do_exec_row(TABLE *table);
#endif #endif
}; };
@ -2064,10 +2069,11 @@ private:
byte *m_key; byte *m_key;
byte *m_after_image; byte *m_after_image;
virtual int do_before_row_operations(TABLE *table); virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error); virtual int do_after_row_operations(TABLE *table, int error);
virtual char const *do_prepare_row(THD*, TABLE*, char const *row_start); virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
virtual int do_exec_row(TABLE *table); char const *row_start, char const **row_end);
virtual int do_exec_row(TABLE *table);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
}; };
@ -2134,10 +2140,11 @@ private:
byte *m_key; byte *m_key;
byte *m_after_image; byte *m_after_image;
virtual int do_before_row_operations(TABLE *table); virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error); virtual int do_after_row_operations(TABLE *table, int error);
virtual char const *do_prepare_row(THD*, TABLE*, char const *row_start); virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
virtual int do_exec_row(TABLE *table); char const *row_start, char const **row_end);
virtual int do_exec_row(TABLE *table);
#endif #endif
}; };

View File

@ -21,6 +21,9 @@
except the part which must be in the server and in the client. except the part which must be in the server and in the client.
*/ */
#ifndef MYSQL_PRIV_H
#define MYSQL_PRIV_H
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
#include <my_global.h> #include <my_global.h>
@ -2040,3 +2043,5 @@ bool schema_table_store_record(THD *thd, TABLE *table);
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
#endif /* MYSQL_PRIV_H */

View File

@ -3120,7 +3120,11 @@ with --log-bin instead.");
global_system_variables.binlog_format= BINLOG_FORMAT_ROW; global_system_variables.binlog_format= BINLOG_FORMAT_ROW;
else else
#endif #endif
#if defined(HAVE_ROW_BASED_REPLICATION)
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
#else
global_system_variables.binlog_format= BINLOG_FORMAT_STMT; global_system_variables.binlog_format= BINLOG_FORMAT_STMT;
#endif
} }
/* 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 */
@ -4886,7 +4890,13 @@ struct my_option my_long_options[] =
"supports only statement-based binary logging, so only 'statement' is " "supports only statement-based binary logging, so only 'statement' is "
"a legal value." "a legal value."
#endif #endif
, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, , 0, 0, 0, GET_STR, REQUIRED_ARG,
#ifdef HAVE_ROW_BASED_REPLICATION
BINLOG_FORMAT_MIXED
#else
BINLOG_FORMAT_STMT
#endif
, 0, 0, 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},

153
sql/rpl_utility.cc Normal file
View File

@ -0,0 +1,153 @@
/* Copyright 2006 MySQL AB. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "rpl_utility.h"
uint32
field_length_from_packed(enum_field_types const field_type,
byte const *const data)
{
uint32 length;
switch (field_type) {
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
length= ~0UL;
break;
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_TINY:
length= 1;
break;
case MYSQL_TYPE_SHORT:
length= 2;
break;
case MYSQL_TYPE_INT24:
length= 3;
break;
case MYSQL_TYPE_LONG:
length= 4;
break;
#ifdef HAVE_LONG_LONG
case MYSQL_TYPE_LONGLONG:
length= 8;
break;
#endif
case MYSQL_TYPE_FLOAT:
length= sizeof(float);
break;
case MYSQL_TYPE_DOUBLE:
length= sizeof(double);
break;
case MYSQL_TYPE_NULL:
length= 0;
break;
case MYSQL_TYPE_NEWDATE:
length= 3;
break;
case MYSQL_TYPE_DATE:
length= 4;
break;
case MYSQL_TYPE_TIME:
length= 3;
break;
case MYSQL_TYPE_TIMESTAMP:
length= 4;
break;
case MYSQL_TYPE_DATETIME:
length= 8;
break;
break;
case MYSQL_TYPE_BIT:
length= ~0UL;
break;
default:
/* This case should never be chosen */
DBUG_ASSERT(0);
/* If something goes awfully wrong, it's better to get a string than die */
case MYSQL_TYPE_STRING:
length= uint2korr(data);
break;
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_VARCHAR:
length= ~0UL; // NYI
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_GEOMETRY:
length= ~0UL; // NYI
break;
}
return length;
}
/*********************************************************************
* table_def member definitions *
*********************************************************************/
/*
Is the definition compatible with a table?
*/
int
table_def::compatible_with(RELAY_LOG_INFO *rli, TABLE *table)
const
{
/*
We only check the initial columns for the tables.
*/
uint const cols_to_check= min(table->s->fields, size());
int error= 0;
TABLE_SHARE const *const tsh= table->s;
/*
To get proper error reporting for all columns of the table, we
both check the width and iterate over all columns.
*/
if (tsh->fields < size())
{
DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
error= 1;
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
"Table width mismatch - "
"received %u columns, %s.%s has %u columns",
size(), tsh->db.str, tsh->table_name.str, tsh->fields);
}
for (uint col= 0 ; col < cols_to_check ; ++col)
{
if (table->field[col]->type() != type(col))
{
DBUG_ASSERT(col < size() && col < tsh->fields);
DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
error= 1;
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
"Column %d type mismatch - "
"received type %d, %s.%s has type %d",
col, type(col), tsh->db.str, tsh->table_name.str,
table->field[col]->type());
}
}
return error;
}

126
sql/rpl_utility.h Normal file
View File

@ -0,0 +1,126 @@
/* Copyright 2006 MySQL AB. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef RPL_UTILITY_H
#define RPL_UTILITY_H
#ifndef __cplusplus
#error "Don't include this C++ header file from a non-C++ file!"
#endif
#include "mysql_priv.h"
uint32
field_length_from_packed(enum_field_types const field_type,
byte const *const data);
/*
A table definition from the master.
RESPONSIBILITIES
- Extract and decode table definition data from the table map event
- Check if table definition in table map is compatible with table
definition on slave
DESCRIPTION
Currently, the only field type data available is an array of the
type operators that are present in the table map event.
TODO
Add type operands to this structure to allow detection of
difference between, e.g., BIT(5) and BIT(10).
*/
class table_def
{
public:
/*
Convenience declaration of the type of the field type data in a
table map event.
*/
typedef unsigned char field_type;
/*
Constructor.
SYNOPSIS
table_def()
types Array of types
size Number of elements in array 'types'
*/
table_def(field_type *types, my_size_t size)
: m_type(types), m_size(size)
{
}
/*
Return the number of fields there is type data for.
SYNOPSIS
size()
RETURN VALUE
The number of fields that there is type data for.
*/
my_size_t size() const { return m_size; }
/*
Return a representation of the type data for one field.
SYNOPSIS
type()
i Field index to return data for
RETURN VALUE
Will return a representation of the type data for field
'i'. Currently, only the type identifier is returned.
*/
field_type type(my_ptrdiff_t i) const { return m_type[i]; }
/*
Decide if the table definition is compatible with a table.
SYNOPSIS
compatible_with()
rli Pointer to relay log info
table Pointer to table to compare with.
DESCRIPTION
Compare the definition with a table to see if it is compatible
with it. A table definition is compatible with a table if:
- the columns types of the table definition is a (not
necessarily proper) prefix of the column type of the table, or
- the other way around
RETURN VALUE
1 if the table definition is not compatible with 'table'
0 if the table definition is compatible with 'table'
*/
int compatible_with(RELAY_LOG_INFO *rli, TABLE *table) const;
private:
my_size_t m_size; // Number of elements in the types array
field_type *m_type; // Array of type descriptors
};
#endif /* RPL_UTILITY_H */

View File

@ -795,7 +795,7 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
This set is produced by tracking user variable reads during statement This set is produced by tracking user variable reads during statement
execution. execution.
Fo SPs, this has the following implications: For SPs, this has the following implications:
1) thd->user_var_events may contain events from several SP statements and 1) thd->user_var_events may contain events from several SP statements and
needs to be valid after exection of these statements was finished. In needs to be valid after exection of these statements was finished. In
order to achieve that, we order to achieve that, we
@ -808,6 +808,14 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
reset_dynamic(&thd->user_var_events); reset_dynamic(&thd->user_var_events);
calls in several different places. (TODO cosider moving this into calls in several different places. (TODO cosider moving this into
mysql_bin_log.write() function) mysql_bin_log.write() function)
4.2 Auto_increment storage in binlog
As we may write two statements to binlog from one single logical statement
(case of "SELECT func1(),func2()": it is binlogged as "SELECT func1()" and
then "SELECT func2()"), we need to reset auto_increment binlog variables
after each binlogged SELECT. Otherwise, the auto_increment value of the
first SELECT would be used for the second too.
*/ */
@ -1527,6 +1535,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
"failed to reflect this change in the binary log"); "failed to reflect this change in the binary log");
} }
reset_dynamic(&thd->user_var_events); reset_dynamic(&thd->user_var_events);
/* Forget those values, in case more function calls are binlogged: */
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
thd->auto_inc_intervals_in_cur_stmt_for_binlog.empty();
} }
} }

Some files were not shown because too many files have changed in this diff Show More