Commit 09346e6e authored by unknown's avatar unknown

WL#1012: All changes as one single changeset.

This includes both code and test cases.


BitKeeper/deleted/.del-ctype_ucs_binlog.result~280d136b1a0bcf17:
  Delete: mysql-test/r/ctype_ucs_binlog.result
BitKeeper/deleted/.del-rpl_delete_all.result~7c050d592614b3f:
  Delete: mysql-test/r/rpl_delete_all.result
BitKeeper/deleted/.del-rpl000013-slave.opt~18266ad8a2403e8d:
  Delete: mysql-test/t/rpl000013-slave.opt
BitKeeper/deleted/.del-rpl_delete_all.test~700a1490277780e0:
  Delete: mysql-test/t/rpl_delete_all.test
mysql-test/extra/binlog_tests/binlog.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/blackhole.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/ctype_cp932.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/ctype_cp932_binlog.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/ctype_ucs_binlog.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/drop_temp_table.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/insert_select-binlog.test:
  Import patch wl1012.patch
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_ddl.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_deadlock.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_err_ignoredtable.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_loaddata_m.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_log.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_multi_query.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_reset_slave.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_stm_000001.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_stm_EE_err.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_stm_charset.test:
  Import patch wl1012.patch
mysql-test/extra/rpl_tests/rpl_user_variables.test:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_binlog.result:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_blackhole.result:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_ctype_cp932.result:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_ctype_ucs.result:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_drop_tmp_tbl.result:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_insert_select.result:
  Import patch wl1012.patch
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
  Import patch wl1012.patch
mysql-test/r/rpl_000012.result:
  Import patch wl1012.patch
mysql-test/r/rpl_000015.result:
  Import patch wl1012.patch
mysql-test/r/rpl_deadlock_innodb.result:
  Import patch wl1012.patch
mysql-test/r/rpl_flushlog_loop.result:
  Import patch wl1012.patch
mysql-test/r/rpl_loaddata_s.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_000001.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_EE_err.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_charset.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_ddl.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_err_ignoredtable.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_flsh_tbls.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_loaddata_m.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_log.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_max_relay_size.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_multi_query.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_mystery22.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_reset_slave.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_rewrt_db.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_sp.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_timezone.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_until.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_user_variables.result:
  Import patch wl1012.patch
mysql-test/r/rpl_stm_view.result:
  Import patch wl1012.patch
mysql-test/t/binlog_row_binlog-master.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_000012.test:
  Import patch wl1012.patch
mysql-test/t/rpl_000015-slave.sh:
  Import patch wl1012.patch
mysql-test/t/rpl_000015.slave-mi:
  Import patch wl1012.patch
mysql-test/t/rpl_000015.test:
  Import patch wl1012.patch
mysql-test/t/rpl_deadlock_innodb-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_flushlog_loop-master.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_flushlog_loop-master.sh:
  Import patch wl1012.patch
mysql-test/t/rpl_flushlog_loop-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_flushlog_loop-slave.sh:
  Import patch wl1012.patch
mysql-test/t/rpl_flushlog_loop.test:
  Import patch wl1012.patch
mysql-test/t/rpl_loaddata_s-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_loaddata_s.test:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_000001-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_err_ignoredtable-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_loaddata_m-master.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_log-master.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_log-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_mystery22.test:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_rewrt_db-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_rewrt_db.test:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_sp-master.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_sp-slave.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_sp.test:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_timezone-master.opt:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_timezone-slave.opt:
  Import patch wl1012.patch
BUILD/SETUP.sh:
  Import patch wl1012.patch
Makefile.am:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_timezone.test:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_until.test:
  Import patch wl1012.patch
mysql-test/t/rpl_stm_view.test:
  Import patch wl1012.patch
client/Makefile.am:
  Import patch wl1012.patch
client/client_priv.h:
  Import patch wl1012.patch
client/mysqlbinlog.cc:
  Import patch wl1012.patch
configure.in:
  Import patch wl1012.patch
include/Makefile.am:
  Import patch wl1012.patch
include/base64.h:
  Import patch wl1012.patch
include/config-win.h:
  Import patch wl1012.patch
include/my_base.h:
  Import patch wl1012.patch
include/my_global.h:
  Import patch wl1012.patch
mysql-test/Makefile.am:
  Import patch wl1012.patch
mysql-test/mysql-test-run.pl:
  Import patch wl1012.patch
mysql-test/mysql-test-run.sh:
  Import patch wl1012.patch
mysql-test/r/date_formats.result:
  Import patch wl1012.patch
mysql-test/r/flush_block_commit.result:
  Import patch wl1012.patch
mysql-test/r/innodb.result:
  Import patch wl1012.patch
mysql-test/r/rpl000017.result:
  Import patch wl1012.patch
mysql-test/r/rpl_change_master.result:
  Import patch wl1012.patch
mysql-test/r/rpl_commit_after_flush.result:
  Import patch wl1012.patch
mysql-test/r/rpl_create_database.result:
  Import patch wl1012.patch
mysql-test/r/rpl_do_grant.result:
  Import patch wl1012.patch
mysql-test/r/rpl_loaddata.result:
  Import patch wl1012.patch
mysql-test/r/rpl_log_pos.result:
  Import patch wl1012.patch
mysql-test/r/rpl_multi_delete.result:
  Import patch wl1012.patch
mysql-test/r/rpl_multi_update.result:
  Import patch wl1012.patch
mysql-test/r/rpl_openssl.result:
  Import patch wl1012.patch
mysql-test/r/rpl_replicate_do.result:
  Import patch wl1012.patch
mysql-test/r/rpl_rotate_logs.result:
  Import patch wl1012.patch
mysql-test/r/rpl_server_id1.result:
  Import patch wl1012.patch
mysql-test/r/rpl_server_id2.result:
  Import patch wl1012.patch
mysql-test/r/rpl_temporary.result:
  Import patch wl1012.patch
mysql-test/r/user_var-binlog.result:
  Import patch wl1012.patch
mysql-test/t/create_select_tmp.test:
  Import patch wl1012.patch
mysql-test/t/date_formats.test:
  Import patch wl1012.patch
mysql-test/t/disabled.def:
  Import patch wl1012.patch
mysql-test/t/innodb.test:
  Import patch wl1012.patch
mysql-test/t/mysqlbinlog.test:
  Import patch wl1012.patch
mysql-test/t/mysqlbinlog2.test:
  Import patch wl1012.patch
mysql-test/t/rpl000002.test:
  Import patch wl1012.patch
mysql-test/t/rpl000006.test:
  Import patch wl1012.patch
mysql-test/t/rpl000013.test:
  Import patch wl1012.patch
mysql-test/t/rpl000017.test:
  Import patch wl1012.patch
mysql-test/t/rpl_auto_increment.test:
  Import patch wl1012.patch
mysql-test/t/rpl_change_master.test:
  Import patch wl1012.patch
mysql-test/t/rpl_commit_after_flush.test:
  Import patch wl1012.patch
mysql-test/t/rpl_create_database.test:
  Import patch wl1012.patch
mysql-test/t/rpl_do_grant.test:
  Import patch wl1012.patch
mysql-test/t/rpl_drop.test:
  Import patch wl1012.patch
mysql-test/t/rpl_empty_master_crash.test:
  Import patch wl1012.patch
mysql-test/t/rpl_failed_optimize.test:
  Import patch wl1012.patch
mysql-test/t/rpl_heap.test:
  Import patch wl1012.patch
mysql-test/t/rpl_insert_id.test:
  Import patch wl1012.patch
mysql-test/t/rpl_insert_ignore.test:
  Import patch wl1012.patch
mysql-test/t/rpl_loaddata.test:
  Import patch wl1012.patch
mysql-test/t/rpl_log_pos.test:
  Import patch wl1012.patch
mysql-test/t/rpl_multi_delete.test:
  Import patch wl1012.patch
mysql-test/t/rpl_multi_update.test:
  Import patch wl1012.patch
mysql-test/t/rpl_multi_update2.test:
  Import patch wl1012.patch
mysql-test/t/rpl_multi_update3.test:
  Import patch wl1012.patch
mysql-test/t/rpl_openssl.test:
  Import patch wl1012.patch
mysql-test/t/rpl_redirect.test:
  Import patch wl1012.patch
mysql-test/t/rpl_relayrotate.test:
  Import patch wl1012.patch
mysql-test/t/rpl_replicate_do.test:
  Import patch wl1012.patch
mysql-test/t/rpl_rotate_logs.test:
  Import patch wl1012.patch
mysql-test/t/rpl_server_id1.test:
  Import patch wl1012.patch
mysql-test/t/rpl_sp_effects.test:
  Import patch wl1012.patch
mysql-test/t/rpl_temporary.test:
  Import patch wl1012.patch
mysql-test/t/rpl_trigger.test:
  Import patch wl1012.patch
mysql-test/t/sp.test:
  Import patch wl1012.patch
mysql-test/t/user_var-binlog.test:
  Import patch wl1012.patch
mysys/Makefile.am:
  Import patch wl1012.patch
mysys/base64.c:
  Import patch wl1012.patch
sql/Makefile.am:
  Import patch wl1012.patch
sql/ha_innodb.cc:
  Import patch wl1012.patch
sql/ha_innodb.h:
  Import patch wl1012.patch
sql/ha_partition.cc:
  Import patch wl1012.patch
sql/handler.cc:
  Import patch wl1012.patch
sql/handler.h:
  Import patch wl1012.patch
sql/item_sum.cc:
  Import patch wl1012.patch
sql/log.cc:
  Import patch wl1012.patch
sql/log_event.cc:
  Import patch wl1012.patch
sql/log_event.h:
  Import patch wl1012.patch
sql/mysql_priv.h:
  Import patch wl1012.patch
sql/mysqld.cc:
  Import patch wl1012.patch
sql/rpl_filter.h:
  Import patch wl1012.patch
sql/set_var.cc:
  Import patch wl1012.patch
sql/share/errmsg.txt:
  Import patch wl1012.patch
sql/slave.cc:
  Import patch wl1012.patch
sql/slave.h:
  Import patch wl1012.patch
sql/sp.cc:
  Import patch wl1012.patch
sql/sp_head.cc:
  Import patch wl1012.patch
sql/sql_acl.cc:
  Import patch wl1012.patch
sql/sql_base.cc:
  Import patch wl1012.patch
sql/sql_class.cc:
  Import patch wl1012.patch
sql/sql_class.h:
  Import patch wl1012.patch
sql/sql_delete.cc:
  Import patch wl1012.patch
sql/sql_insert.cc:
  Import patch wl1012.patch
sql/sql_lex.h:
  Import patch wl1012.patch
sql/sql_list.h:
  Import patch wl1012.patch
sql/sql_load.cc:
  Import patch wl1012.patch
sql/sql_parse.cc:
  Import patch wl1012.patch
sql/sql_plugin.cc:
  Import patch wl1012.patch
sql/sql_rename.cc:
  Import patch wl1012.patch
sql/sql_repl.h:
  Import patch wl1012.patch
sql/sql_select.cc:
  Import patch wl1012.patch
sql/sql_show.cc:
  Import patch wl1012.patch
sql/sql_table.cc:
  Import patch wl1012.patch
sql/sql_udf.cc:
  Import patch wl1012.patch
sql/sql_union.cc:
  Import patch wl1012.patch
sql/sql_update.cc:
  Import patch wl1012.patch
sql/sql_yacc.yy:
  Import patch wl1012.patch
sql/table.cc:
  Import patch wl1012.patch
sql/table.h:
  Import patch wl1012.patch
storage/innobase/include/lock0lock.h:
  Import patch wl1012.patch
storage/innobase/include/row0mysql.h:
  Import patch wl1012.patch
storage/innobase/include/row0vers.h:
  Import patch wl1012.patch
storage/innobase/lock/lock0lock.c:
  Import patch wl1012.patch
storage/innobase/row/row0mysql.c:
  Import patch wl1012.patch
storage/innobase/row/row0sel.c:
  Import patch wl1012.patch
storage/innobase/row/row0vers.c:
  Import patch wl1012.patch
parent 65c560e9
......@@ -55,7 +55,7 @@ SSL_LIBRARY=--with-openssl
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
#debug_extra_warnings="-Wuninitialized"
c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-partition $SSL_LIBRARY"
base_max_no_ndb_configs="--with-innodb --with-berkeley-db --without-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-partition $SSL_LIBRARY"
max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-federated-storage-engine --with-blackhole-storage-engine --with-csv-storage-engine --with-embedded-server --with-big-tables --with-partition $SSL_LIBRARY"
......
2005-09-25 Mats Kindahl <mats@mysql.com>
* sql/log_event.cc (find_and_fetch_row): Added the optimization
that if a record is found using a key with HA_NOSAME flag set, we
do not need to compare records to see if it is the correct one.
2005-09-23 Mats Kindahl <mats@mysql.com>
* sql/log_event.cc (replace_record): Added function to overwrite
existing row if there were a duplicate key.
2005-09-17 Mats Kindahl <mats@mysql.com>
* mysql-test/t/rpl_row_multi_query.test: This test is explicitly
for testing that multi-queries are logged as one Query_log_event
per sub-query instead of one Query_log_event for the entire
multi-query.
The test was removed
* mysql-test/t/rpl_stm_flsh_tbls.test: Added rename_event_pos
parameter.
* mysql-test/t/rpl_row_flsh_tbls.test: Added rename_event_pos
parameter.
* mysql-test/extra/rpl_tests/rpl_flsh_tbls.test: Takes one
additional parameter with the position of the RENAME TABLE
event. The SHOW BINLOG EVENTS is only used to check the presence
of the RENAME TABLE event and the FLUSH TABLES event.
2005-09-16 Mats Kindahl <mats@mysql.com>
* mysql-test/t/rpl_row_err_ignoredtable.test: This test is
statement-oriented since it tests that errorneous statements are
sent through the binlog. This does not happen with RBR, since
statements are not replicated through the binlog.
Test was removed.
* mysql-test/t/rpl_row_loaddata_m.test: This test is purely
statement-based, so it was removed as a test for row-based
logging. The LOAD DATA is not replicated as two statements, but
is rather replicated using row-based events, and this is a test
that the correct events are put into the binary log on execution
of LOAD DATA INFILE.
Test was removed.
......@@ -110,24 +110,52 @@ tags:
test:
cd mysql-test ; \
./mysql-test-run && \
./mysql-test-run --ps-protocol
./mysql-test-run --mysqld=--binlog-format=statement && \
./mysql-test-run --ps-protocol --mysqld=--binlog-format=row
test-full:
cd mysql-test ; \
./mysql-test-run --mysqld=--binlog-format=statement && \
./mysql-test-run --ps-protocol --mysqld=--binlog-format=statement && \
./mysql-test-run --mysqld=--binlog-format=row && \
./mysql-test-run --ps-protocol --mysqld=--binlog-format=row
test-force:
cd mysql-test; \
./mysql-test-run --force && \
./mysql-test-run --ps-protocol --force
cd mysql-test ; \
./mysql-test-run --force --mysqld=--binlog-format=statement && \
./mysql-test-run --ps-protocol --force --mysqld=--binlog-format=row
test-force-full:
cd mysql-test ; \
./mysql-test-run --force --mysqld=--binlog-format=statement && \
./mysql-test-run --force --ps-protocol --mysqld=--binlog-format=statement && \
./mysql-test-run --force --mysqld=--binlog-format=row && \
./mysql-test-run --force --ps-protocol --mysqld=--binlog-format=row
# We are testing a new Perl version of the test script
test-pl:
cd mysql-test; \
./mysql-test-run.pl && \
./mysql-test-run.pl --ps-protocol
cd mysql-test ; \
./mysql-test-run.pl --mysqld=--binlog-format=statement && \
./mysql-test-run.pl --ps-protocol --mysqld=--binlog-format=row
test-full-pl:
cd mysql-test ; \
./mysql-test-run.pl --mysqld=--binlog-format=statement && \
./mysql-test-run.pl --ps-protocol --mysqld=--binlog-format=statement && \
./mysql-test-run.pl --mysqld=--binlog-format=row && \
./mysql-test-run.pl --ps-protocol --mysqld=--binlog-format=row
test-force-pl:
cd mysql-test; \
./mysql-test-run.pl --force && \
./mysql-test-run.pl --ps-protocol --force
cd mysql-test ; \
./mysql-test-run.pl --force --mysqld=--binlog-format=statement && \
./mysql-test-run.pl --ps-protocol --force --mysqld=--binlog-format=row
test-force-full-pl:
cd mysql-test ; \
./mysql-test-run.pl --force --mysqld=--binlog-format=statement && \
./mysql-test-run.pl --force --ps-protocol --mysqld=--binlog-format=statement && \
./mysql-test-run.pl --force --mysqld=--binlog-format=row && \
./mysql-test-run.pl --force --ps-protocol --mysqld=--binlog-format=row
# Don't update the files from bitkeeper
%::SCCS/s.%
......
......@@ -41,7 +41,12 @@ mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \
$(yassl_dummy_link_fix)
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c $(top_srcdir)/mysys/my_new.cc
mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \
$(top_srcdir)/mysys/my_new.cc \
$(top_srcdir)/mysys/my_bit.c \
$(top_srcdir)/mysys/my_bitmap.c \
$(top_srcdir)/mysys/my_vle.c \
$(top_srcdir)/mysys/base64.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
......
......@@ -52,5 +52,5 @@ enum options_client
OPT_TRIGGERS,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQL_REPLACE_INTO, OPT_SERVER_ID
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID
};
......@@ -63,6 +63,7 @@ void sql_print_error(const char *format, ...);
static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0;
static bool opt_base64_output= 0;
static const char* database= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static ulonglong offset = 0;
......@@ -533,11 +534,19 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
else
print_event_info->hexdump_from= pos;
print_event_info->base64_output= opt_base64_output;
switch (ev_type) {
case QUERY_EVENT:
if (check_database(((Query_log_event*)ev)->db))
goto end;
ev->print(result_file, print_event_info);
if (opt_base64_output)
{
ev->print_header(result_file, print_event_info);
ev->print_base64(result_file, print_event_info);
}
else
ev->print(result_file, print_event_info);
break;
case CREATE_FILE_EVENT:
{
......@@ -557,7 +566,13 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
filename and use LOCAL), prepared in the 'case EXEC_LOAD_EVENT'
below.
*/
ce->print(result_file, print_event_info, TRUE);
if (opt_base64_output)
{
ce->print_header(result_file, print_event_info);
ce->print_base64(result_file, print_event_info);
}
else
ce->print(result_file, print_event_info, TRUE);
// If this binlog is not 3.23 ; why this test??
if (description_event->binlog_version >= 3)
......@@ -653,6 +668,12 @@ static struct my_option my_long_options[] =
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"base64-output", OPT_BASE64_OUTPUT,
"Print all binlog entries using base64 encoding. "
"This is for debugging only. Logs produced using this option "
"should not be applied on production systems.",
(gptr*) &opt_base64_output, (gptr*) &opt_base64_output, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
number found in binlog to a charset name (to be able to print things
......
dnl This file contains configuration parameters for replication.
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_REPLICATION
dnl Sets HAVE_ROW_BASED_REPLICATION if --with-row-based-replication is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_REPLICATION], [
AC_ARG_WITH([row-based-replication],
AC_HELP_STRING([--with-row-based-replication],
[Include row-based replication]),
[row_based="$withval"],
[row_based=yes])
AC_MSG_CHECKING([for row-based replication])
case "$row_based" in
yes )
AC_DEFINE([HAVE_ROW_BASED_REPLICATION], [1], [Define to have row-based replication])
AC_MSG_RESULT([-- including row-based replication])
[have_row_based=yes]
;;
* )
AC_MSG_RESULT([-- not including row-based replication])
[have_row_based=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_REPLICATION
dnl ---------------------------------------------------------------------------
......@@ -42,6 +42,7 @@ sinclude(config/ac-macros/large_file.m4)
sinclude(config/ac-macros/misc.m4)
sinclude(config/ac-macros/openssl.m4)
sinclude(config/ac-macros/readline.m4)
sinclude(config/ac-macros/replication.m4)
sinclude(config/ac-macros/yassl.m4)
sinclude(config/ac-macros/zlib.m4)
......@@ -1834,7 +1835,8 @@ MYSQL_TYPE_QSORT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
chsize cuserid fchmod fcntl \
fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
......@@ -2386,6 +2388,7 @@ AC_SUBST(readline_h_ln_cmd)
MYSQL_CHECK_BIG_TABLES
MYSQL_CHECK_MAX_INDEXES
MYSQL_CHECK_REPLICATION
MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,[ dnl
\$(top_builddir)/storage/innobase/usr/libusr.a dnl
......
......@@ -30,7 +30,8 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h md5.h base64.h \
mysql_version.h.in my_handler.h my_time.h decimal.h
mysql_version.h.in my_handler.h my_time.h decimal.h \
my_vle.h
# mysql_version.h are generated
CLEANFILES = mysql_version.h my_config.h readline
......
......@@ -21,8 +21,7 @@
extern "C" {
#endif
#include <mysys_priv.h>
#include <my_global.h>
/*
Calculate how much memory needed for dst of base64_encode()
......
......@@ -269,6 +269,12 @@ inline double ulonglong2double(ulonglong value)
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
(((uint32) ((uchar) (A)[1])) << 8) + \
(((uint32) ((uchar) (A)[2])) << 16) + \
(((uint32) ((uchar) (A)[3])) << 24)) + \
(((ulonglong) ((uchar) (A)[4])) << 32) + \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) (*((ulonglong *) (A)))
#define sint8korr(A) (*((longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
......@@ -281,6 +287,12 @@ inline double ulonglong2double(ulonglong value)
*((T)+2)=(uchar) (((A) >> 16));\
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); }
#define int6store(T,A) { *(T) =(uchar)((A)); \
*((T)+1)=(uchar) (((A) >> 8)); \
*((T)+2)=(uchar) (((A) >> 16)); \
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); \
*((T)+5)=(uchar) (((A) >> 40)); }
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
#define doubleget(V,M) do { *((long *) &V) = *((long*) M); \
......
......@@ -343,9 +343,12 @@ enum ha_base_keytype {
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for given value */
#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for
given value */
#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */
#define HA_ERR_LAST 161 /* Copy last error no */
#define HA_ERR_LAST 160 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
......
......@@ -844,6 +844,14 @@ typedef long my_ptrdiff_t;
typedef long long my_ptrdiff_t;
#endif
#if HAVE_SIZE_T
typedef size_t my_size_t;
#elif SIZEOF_CHARP <= SIZEOF_LONG
typedef unsigned long my_size_t;
#else
typedef unsigned long long my_size_t;
#endif
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
/* Size to make adressable obj. */
......@@ -1122,6 +1130,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
(((uint32) ((uchar) (A)[1])) << 8) + \
(((uint32) ((uchar) (A)[2])) << 16) + \
(((uint32) ((uchar) (A)[3])) << 24)) + \
(((ulonglong) ((uchar) (A)[4])) << 32) + \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) (*((ulonglong *) (A)))
#define sint8korr(A) (*((longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
......@@ -1134,6 +1148,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */
*((T)+2)=(uchar) (((A) >> 16));\
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); } while(0)
#define int6store(T,A) do { *(T)= (uchar)((A)); \
*((T)+1)=(uchar) (((A) >> 8)); \
*((T)+2)=(uchar) (((A) >> 16)); \
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); \
*((T)+5)=(uchar) (((A) >> 40)); } while(0)
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
typedef union {
......@@ -1190,6 +1210,12 @@ do { doubleget_union _tmp; \
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
(((uint32) ((uchar) (A)[1])) << 8) + \
(((uint32) ((uchar) (A)[2])) << 16) + \
(((uint32) ((uchar) (A)[3])) << 24)) + \
(((ulonglong) ((uchar) (A)[4])) << 32) + \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
......@@ -1217,6 +1243,12 @@ do { doubleget_union _tmp; \
*(((char *)(T))+2)=(((A) >> 16));\
*(((char *)(T))+3)=(((A) >> 24)); \
*(((char *)(T))+4)=(((A) >> 32)); } while(0)
#define int6store(T,A) do { *((char *)(T))=((A));\
*(((char *)(T))+1)=(((A) >> 8)); \
*(((char *)(T))+2)=(((A) >> 16)); \
*(((char *)(T))+3)=(((A) >> 24)); \
*(((char *)(T))+4)=(((A) >> 32)); \
*(((char *)(T))+5)=(((A) >> 40)); } while(0)
#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
int4store((T),def_temp); \
int4store((T+4),def_temp2); } while(0)
......
/*
Copyright (C) 2005 MySQL AB
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 VLE_H
#define VLE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "my_global.h"
/*
The size (in bytes) required to store the object ITEM, which can be
either an expression or a type (since sizeof() is used on the item).
*/
#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7)
byte *my_vle_encode(byte *vle, my_size_t max, ulong value);
byte const *my_vle_decode(ulong *value_ptr, byte const *vle);
#ifdef __cplusplus
}
#endif
#endif
......@@ -36,15 +36,24 @@ mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c my_create_tables.c
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data $(distdir)/lib
mkdir -p \
$(distdir)/t \
$(distdir)/extra/binlog_tests \
$(distdir)/extra/rpl_tests \
$(distdir)/r \
$(distdir)/include \
$(distdir)/std_data \
$(distdir)/lib
-$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests
$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests
-$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests
-$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(distdir)/extra/rpl_tests
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
......@@ -59,6 +68,8 @@ dist-hook:
install-data-local:
$(mkinstalldirs) \
$(DESTDIR)$(testdir)/t \
$(DESTDIR)$(testdir)/extra/binlog_tests \
$(DESTDIR)$(testdir)/extra/rpl_tests \
$(DESTDIR)$(testdir)/r \
$(DESTDIR)$(testdir)/include \
$(DESTDIR)$(testdir)/std_data \
......@@ -74,6 +85,10 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/t/*.slave-mi $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r
$(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r
$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(DESTDIR)$(testdir)/extra/binlog_tests
$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(DESTDIR)$(testdir)/extra/rpl_tests
-$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(DESTDIR)$(testdir)/extra/binlog_tests
-$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(DESTDIR)$(testdir)/extra/rpl_tests
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
......
#
# misc binlogging tests that do not require a slave running
#
-- source include/have_bdb.inc
-- source include/have_innodb.inc
-- source include/have_debug.inc
--disable_warnings
drop table if exists t1, t2;
......@@ -18,9 +20,8 @@ begin;
insert t2 values (5);
commit;
# first COMMIT must be Query_log_event, second - Xid_log_event
--replace_result "xid=18" "xid=11"
--replace_column 2 # 5 #
show binlog events from 98;
show binlog events from 102;
drop table t1,t2;
#
......@@ -40,9 +41,7 @@ while ($1)
--enable_query_log
commit;
drop table t1;
--replace_result "xid=29" "xid=18"
--replace_column 2 # 5 #
show binlog events in 'master-bin.000001' from 98;
show binlog events in 'master-bin.000001' from 102;
--replace_column 2 # 5 #
show binlog events in 'master-bin.000002' from 98;
show binlog events in 'master-bin.000002' from 102;
......@@ -415,7 +415,7 @@ SET @var1= x'8300';
# code (and I have used it to test the fix) until there is some way to
# exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 98;
SHOW BINLOG EVENTS FROM 102;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338
......
......@@ -26,7 +26,8 @@ SET @var1= x'8300';
# code (and I have used it to test the fix) until there is some way to
# exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 98;
--replace_column 2 # 5 #
SHOW BINLOG EVENTS FROM 102;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338
......
......@@ -9,7 +9,7 @@ create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
show binlog events from 98;
show binlog events from 102;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
......
-- source include/have_innodb.inc
#
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
# Actually this test has nothing to do with innodb per se, it just requires
# transactional table.
#
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int) engine=innodb;
# Now we are going to create transaction which is long enough so its
# transaction binlog will be flushed to disk...
let $1=2000;
disable_query_log;
begin;
while ($1)
{
eval insert into t1 values( $1 );
dec $1;
}
commit;
enable_query_log;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
# Transaction which should not be flushed to disk and so should not
# increase binlog_cache_disk_use.
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
show status like "Innodb_buffer_pool_pages_total";
show status like "Innodb_page_size";
show status like "Innodb_rows_deleted";
show status like "Innodb_rows_inserted";
show status like "Innodb_rows_updated";
......@@ -9,6 +9,7 @@
-- source include/not_embedded.inc
-- source include/have_innodb.inc
-- source include/have_debug.inc
--disable_warnings
drop table if exists t1, t2;
......@@ -29,8 +30,7 @@ insert into t2 select * from t1;
commit;
--replace_column 5 #
--replace_result "xid=15" "xid=8"
show binlog events from 98;
show binlog events from 102;
delete from t1;
delete from t2;
......@@ -43,7 +43,7 @@ insert into t2 select * from t1;
rollback;
--replace_column 5 #
show binlog events from 98;
show binlog events from 102;
delete from t1;
delete from t2;
......@@ -58,8 +58,7 @@ rollback to savepoint my_savepoint;
commit;
--replace_column 5 #
--replace_result "xid=48" "xid=25"
show binlog events from 98;
show binlog events from 102;
delete from t1;
delete from t2;
......@@ -76,8 +75,7 @@ commit;
select a from t1 order by a; # check that savepoints work :)
--replace_column 5 #
--replace_result "xid=70" "xid=37"
show binlog events from 98;
show binlog events from 102;
# and when ROLLBACK is not explicit?
delete from t1;
......@@ -98,7 +96,7 @@ connection con2;
# logging has been done, we use a user lock.
select get_lock("a",10);
--replace_column 5 #
show binlog events from 98;
show binlog events from 102;
# and when not in a transact1on?
delete from t1;
......@@ -109,8 +107,7 @@ insert into t1 values(9);
insert into t2 select * from t1;
--replace_column 5 #
--replace_result "xid=119" "xid=60"
show binlog events from 98;
show binlog events from 102;
# Check that when the query updat1ng the MyISAM table is the first in the
# transaction, we log it immediately.
......@@ -122,14 +119,12 @@ insert into t1 values(10); # first make t1 non-empty
begin;
insert into t2 select * from t1;
--replace_column 5 #
--replace_result "xid=133" "xid=66"
show binlog events from 98;
show binlog events from 102;
insert into t1 values(11);
commit;
--replace_column 5 #
--replace_result "xid=133" "xid=66" "xid=136" "xid=68"
show binlog events from 98;
show binlog events from 102;
# Check that things work like before this BEGIN/ROLLBACK code was added,
......@@ -147,8 +142,7 @@ insert into t2 select * from t1;
commit;
--replace_column 5 #
--replace_result "xid=155" "xid=78"
show binlog events from 98;
show binlog events from 102;
delete from t1;
delete from t2;
......@@ -160,7 +154,7 @@ insert into t2 select * from t1;
rollback;
--replace_column 5 #
show binlog events from 98;
show binlog events from 102;
delete from t1;
delete from t2;
......@@ -175,8 +169,7 @@ rollback to savepoint my_savepoint;
commit;
--replace_column 5 #
--replace_result "xid=187" "xid=94"
show binlog events from 98;
show binlog events from 102;
delete from t1;
delete from t2;
......@@ -193,8 +186,7 @@ commit;
select a from t1 order by a; # check that savepoints work :)
--replace_column 5 #
--replace_result "xid=208" "xid=105"
show binlog events from 98;
show binlog events from 102;
# Test for BUG#5714, where a MyISAM update in the transaction used to
# release row-level locks in InnoDB
......@@ -254,8 +246,7 @@ disconnect con2;
connection con3;
select get_lock("lock1",60);
--replace_column 5 #
--replace_result "xid=208" "xid=105" "xid=227" "xid=114" "xid=230" "xid=115" "xid=234" "xid=117" "xid=261" "xid=132"
show binlog events from 98;
show binlog events from 102;
do release_lock("lock1");
drop table t0,t2;
......
#
# Test forced timestamp
#
-- source include/master-slave.inc
# Don't log table creating to the slave as we want to test LOAD TABLE
set SQL_LOG_BIN=0,timestamp=200006;
create table t1(t timestamp not null,a char(1));
insert into t1 ( a) values ('F');
select unix_timestamp(t) from t1;
connection slave;
load table t1 from master;
select unix_timestamp(t) from t1;
# Delete the created table on master and slave
connection master;
set SQL_LOG_BIN=1,timestamp=default;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
connection master;
#
# Test copying table with checksum
#
# Don't log table creating to the slave as we want to test LOAD TABLE
set SQL_LOG_BIN=0;
eval CREATE TABLE t1 (
a int not null
) ENGINE=$engine_type MAX_ROWS=4000 CHECKSUM=1;
INSERT INTO t1 VALUES (1);
save_master_pos;
connection slave;
sync_with_master;
load table t1 from master;
check table t1;
drop table t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
#
# Test of auto_increment with offset
#
-- source include/master-slave.inc
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3;
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where b=4;
insert into t1 values (NULL,5),(NULL,6);
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
show variables like "%auto_inc%";
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
select * from t1;
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
#
# Same test with innodb (as the innodb code is a bit different)
#
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
select * from t1;
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL),(NULL);
insert into t1 values (500),(NULL),(502),(NULL),(NULL);
select * from t1;
set @@insert_id=600;
--error 1062
insert into t1 values(600),(NULL),(NULL);
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
#
# Test that auto-increment works when slave has rows in the table
#
set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
sync_slave_with_master;
insert into t1 values(2),(12),(22),(32),(42);
connection master;
insert into t1 values (NULL),(NULL);
insert into t1 values (3),(NULL),(NULL);
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
# End cleanup
sync_slave_with_master;
#################################
# Test updated to use a wrapper #
#################################
-- source include/master-slave.inc
eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
begin;
insert into t1 values(1);
flush tables with read lock;
commit;
save_master_pos;
connection slave;
sync_with_master;
# cleanup
connection master;
unlock tables;
drop table t1;
sync_slave_with_master;
# End of 4.1 tests
......@@ -28,9 +28,6 @@
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/have_innodb.inc
--source include/master-slave.inc
###############################################################
# Some preparations
###############################################################
......@@ -54,28 +51,28 @@ DROP DATABASE IF EXISTS mysqltest3;
#
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;
CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE= "InnoDB";
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
INSERT INTO mysqltest1.t1 SET f1= 0;
CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE= "InnoDB";
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type;
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE= "InnoDB";
eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type;
INSERT INTO mysqltest1.t7 SET f1= 0;
CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE= "InnoDB";
CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE= "InnoDB";
eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type;
eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type;
CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
#
......@@ -207,10 +204,10 @@ connection master;
SELECT '-------- switch to master -------' as "";
--enable_query_log
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB";
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE=;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--source include/rpl_stmt_seq2.inc
# Note: Since this test is executed with a skip-innodb slave, the
# slave incorrectly commits the insert. One can *not* have InnoDB on
......@@ -218,6 +215,9 @@ let $my_slave_commit= true;
# after a CREATE TEMPORARY TABLE should work correctly on the slave.
# For this to work properly the handler on the slave must be able to
# handle transactions (e.g. InnoDB or NDB).
let $engine='';
let $eng_type='';
let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
let $my_master_commit= false;
let $my_slave_commit= true;
......
......@@ -10,14 +10,13 @@
# We don't 'show status like 'slave_retried_transactions'' because this
# is not repeatable (depends on sleeps).
source include/have_innodb.inc;
source include/master-slave.inc;
-- source include/master-slave.inc
connection master;
create table t1 (a int not null, key(a)) engine=innodb;
create table t2 (a int not null, key(a)) engine=innodb;
create table t3 (a int) engine=innodb;
create table t4 (a int) engine=innodb;
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t3 (a INT) ENGINE=$engine_type;
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
show variables like 'slave_transaction_retries';
sync_slave_with_master;
......@@ -65,14 +64,14 @@ sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t2;
# check that no error is reported
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
# 2) Test lock wait timeout
stop slave;
change master to master_log_pos=532; # the BEGIN log event
change master to master_log_pos=536; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
......@@ -82,7 +81,7 @@ sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t2;
# check that no error is reported
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
......@@ -93,7 +92,7 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
stop slave;
change master to master_log_pos=532;
change master to master_log_pos=536;
begin;
select * from t2 for update;
start slave;
......@@ -102,7 +101,7 @@ commit;
sync_with_master;
select * from t1;
select * from t2;
--replace_column 1 # 8 # 9 # 11 # 23 # 33 #
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
......
# Test to see if a DELETE which triggers a fast deletion of all rows
# (not internally row-per-row but more like a TRUNCATE, MyISAM
# supports that), is replicated (BUG#13576).
-- source include/master-slave.inc
eval create table t1 (a int, b int) engine=$engine_type;
insert into t1 values(1,1);
sync_slave_with_master;
select * from t1;
connection master;
delete from t1;
sync_slave_with_master;
select * from t1;
# cleanup
connection master;
drop table t1;
sync_slave_with_master;
......@@ -2,7 +2,9 @@
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
# still checks that it has the same error as on the master.
source include/master-slave.inc;
# Requires statement logging
-- source include/master-slave.inc
connection master;
create table t1 (a int primary key);
# generate an error that goes to the binlog
......@@ -49,7 +51,7 @@ connection master;
reap;
connection master1;
--replace_column 2 # 5 #
show binlog events from 98;
show binlog events from 102;
save_master_pos;
connection slave;
# SQL slave thread should not have stopped (because table of the killed
......
-- source include/master-slave.inc
#
# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
# Replication should work when OPTIMIZE TABLE timeouts, and
# when OPTIMIZE TABLE is executed on a non-existing table
#
eval CREATE TABLE t1 ( a int ) ENGINE=$engine_type;
BEGIN;
INSERT INTO t1 VALUES (1);
connection master1;
OPTIMIZE TABLE t1;
OPTIMIZE TABLE non_existing;
sync_slave_with_master;
# End of 4.1 tests
#
# depends on the binlog output
# Test of replicating FLUSH TABLES to make
# RENAME TABLE work with MERGE tables on the slave.
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
#
--source include/master-slave.inc
# Skipped on Windows because it can't handle a table underlying an open
# merge table getting renamed.
--source include/not_windows.inc
-- source include/master-slave.inc
create table t1 (a int);
insert into t1 values (10);
......@@ -22,7 +19,7 @@ flush no_write_to_binlog tables;
# Check that it's not in the binlog.
--replace_result $SERVER_VERSION SERVER_VERSION
--replace_column 2 # 5 #
show binlog events;
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
# Check that the master is not confused.
select * from t3;
# This FLUSH should go into the binlog to not confuse the slave.
......@@ -30,7 +27,7 @@ flush tables;
# Check that it's in the binlog.
--replace_result $SERVER_VERSION SERVER_VERSION
--replace_column 2 # 5 #
show binlog events;
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
save_master_pos;
connection slave;
sync_with_master;
......@@ -50,4 +47,4 @@ sleep 1;
stop slave;
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed.
# Check the replication of the FOREIGN_KEY_CHECKS variable.
-- source include/master-slave.inc
eval CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=$engine_type;
eval CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=$engine_type;
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
INSERT INTO t2 VALUES (5,0);
INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
SET FOREIGN_KEY_CHECKS=1;
SELECT * FROM t1;
SELECT * FROM t2;
sync_slave_with_master;
SELECT * FROM t1;
SELECT * FROM t2;
connection master;
SET TIMESTAMP=1000000000;
CREATE TABLE t3 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
--error 1062
INSERT INTO t3 VALUES (1),(1);
sync_slave_with_master;
connection master;
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS t1,t2,t3;
SET FOREIGN_KEY_CHECKS=1;
# 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
-- source include/master-slave.inc
#should work for both SBR and RBR
connection master;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
#check if multi-line inserts,
#which set last_insert_id to the first id inserted,
#are replicated the same way
drop table t1;
drop table t2;
--disable_warnings
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
--enable_warnings
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
drop table t2;
drop table t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1;
select * from t2;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
drop table t1;
drop table t2;
save_master_pos;
connection slave;
sync_with_master;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS
#
connection master;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
--error 1062
INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master;
# End of 4.1 tests
# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
# The bug was that if on master, INSERT IGNORE ignored some
# rows, and the table was InnoDB with auto_inc column, then on slave
# some rows received an auto_inc bigger than on master.
# Slave needs to be started with --innodb to store table in InnoDB.
# Same test for MyISAM (which had no bug).
-- source include/master-slave.inc
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
unique (b)
) ENGINE=$engine_type;
eval CREATE TABLE t2 (
a int unsigned, # to force INSERT SELECT to have a certain order
b int unsigned
) ENGINE=$engine_type;
INSERT INTO t1 VALUES (NULL, 1);
INSERT INTO t1 VALUES (NULL, 2);
INSERT INTO t1 VALUES (NULL, 3);
INSERT INTO t1 VALUES (NULL, 4);
# An alternation of values which will conflict in t1 and will not.
INSERT INTO t2 VALUES (1, 1);
INSERT INTO t2 VALUES (2, 2);
INSERT INTO t2 VALUES (3, 5);
INSERT INTO t2 VALUES (4, 3);
INSERT INTO t2 VALUES (5, 4);
INSERT INTO t2 VALUES (6, 6);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
# Compare results
SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
# Now do the same for MyISAM
connection master;
drop table t1;
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
unique (b)
) ENGINE=$engine_type2;
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 VALUES (2, 2);
INSERT INTO t1 VALUES (3, 3);
INSERT INTO t1 VALUES (4, 4);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1, t2;
sync_slave_with_master;
# End of 4.1 tests
# Requires statement logging
-- source include/have_binlog_format_statement.inc
# See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values
# i.e. if the master and slave have the same sequence
#
# check replication of load data for temporary tables with additional
# parameters
#
# check if duplicate entries trigger an error (they should unless IGNORE or
# REPLACE was used on the master) (bug 571).
#
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
-- source include/master-slave.inc
connection slave;
reset master;
connection master;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t3;
# We want to be sure that LOAD DATA is in the slave's binlog.
# But we can't simply read this binlog, because as the slave has not been
# restarted for this test, the file_id is uncertain (would cause test
# failures). So instead, we test if the binlog looks long enough to
# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok.
# If LOAD DATA was not logged, the binlog would be shorter.
show master status;
connection master;
drop table t1;
drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
save_master_pos;
connection slave;
sync_with_master;
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
insert into t1 values(1,10);
connection master;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
# takes us directly to the end of the relay log).
set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Trigger error again to test CHANGE MASTER
connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
# Exec_Master_Log_Pos should point to the start of Execute event
# for last load data.
wait_for_slave_to_stop;
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
change master to master_user='test';
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Trigger error again to test RESET SLAVE
set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
connection master;
reset master;
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=$engine_type; # no transactions
--error 1062
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
select * from t2;
save_master_pos;
connection slave;
start slave;
sync_with_master;
select * from t2;
# verify that if no error on slave, this is an error
alter table t2 drop key day;
connection master;
delete from t2;
--error 1062
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
connection slave;
wait_for_slave_to_stop;
drop table t2;
connection master;
drop table t2;
# End of 4.1 tests
......@@ -2,7 +2,8 @@
# exist.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
source include/master-slave.inc;
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
......@@ -16,15 +17,12 @@ stop slave; # don't need slave for this test
connection master;
# 'test' is the current database
create database mysqltest;
create table t1(a int, b int, unique(b));
use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
# Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
# query so "show binlog ..." should show two events (before 5.0.3 no events
# were returned).
--replace_column 2 # 5 #
show binlog events from 98;
show binlog events from 102;
drop database mysqltest;
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012: Delete me
source include/master-slave.inc;
# Requires statement logging
-- source include/master-slave.inc
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
......@@ -37,10 +38,14 @@ load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
drop table t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
show binlog events;
show binlog events from 98 limit 1;
show binlog events from 98 limit 2;
show binlog events from 98 limit 2,1;
--replace_column 2 # 5 #
show binlog events from 102 limit 1;
--replace_column 2 # 5 #
show binlog events from 102 limit 2;
--replace_column 2 # 5 #
show binlog events from 102 limit 2,1;
flush logs;
# We need an extra update before doing save_master_pos.
......@@ -81,8 +86,10 @@ create table t1 (n int);
insert into t1 values (1);
drop table t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
show binlog events;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
show binlog events in 'master-bin.000002';
show binary logs;
save_master_pos;
......@@ -91,11 +98,13 @@ start slave;
sync_with_master;
show binary logs;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
--replace_column 2 # 5 #
show binlog events in 'slave-bin.000001' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
--replace_column 2 # 5 #
show binlog events in 'slave-bin.000002' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Need to recode the following
......@@ -108,6 +117,3 @@ show slave status;
--error 1220
show binlog events in 'slave-bin.000005' from 4;
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012: Delete me
......@@ -3,11 +3,14 @@
# for relay logs too).
# Test of manual relay log rotation with FLUSH LOGS.
source include/master-slave.inc;
# Requires statement logging
-- source include/master-slave.inc
connection slave;
stop slave;
connection master;
# Generate a big enough master's binlog to cause relay log rotations
create table t1 (a int);
let $1=800;
disable_query_log;
......@@ -29,7 +32,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
stop slave;
reset slave;
......@@ -38,7 +41,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
stop slave;
reset slave;
......@@ -47,7 +50,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions
......@@ -58,7 +61,7 @@ reset slave;
# (to make sure it does not crash).
flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
reset slave;
......@@ -74,7 +77,7 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# one more rotation, to be sure Relay_Log_Space is correctly updated
flush logs;
......@@ -84,13 +87,11 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
connection master;
# test that the absence of relay logs does not make a master crash
flush logs;
-- replace_column 3 <Binlog_Ignore_DB>
show master status;
# End of 4.1 tests
#
......@@ -3,10 +3,10 @@
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
# one binlog event containing all queries)
# PS doesn't support multi-statements
--disable_ps_protocol
source include/master-slave.inc;
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
......@@ -24,9 +24,6 @@ sync_slave_with_master;
select * from mysqltest.t1;
connection master;
--replace_column 2 # 5 #
show binlog events from 98;
show binlog events from 102;
drop database mysqltest;
sync_slave_with_master;
# End of 4.1 tests
#
source include/master-slave.inc;
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
eval CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
connection master;
drop table t1, t2;
sync_slave_with_master;
# Let's verify that multi-update is not always skipped by slave if
# some replicate-* rules exist.
# (BUG#7011)
source include/master-slave.inc;
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
eval CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
connection master;
drop table t1,t2;
sync_slave_with_master;
#
# BUG#13236 multi-update with subquery & --replicate-ignore-table
#
reset master;
connection master;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (0);
UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
select * from t1;
sync_slave_with_master;
connection slave;
select * from t1;
connection master;
drop table t1;
sync_slave_with_master;
# End of 4.1 tests
-- source include/master-slave.inc
##############################################################################
#
# Let's verify that multi-update with a subselect does not cause the slave to crash
# (BUG#10442)
#
--disable_query_log
SELECT '-------- Test for BUG#9361 --------' as "";
--enable_query_log
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
eval CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
sync_slave_with_master;
connection slave;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
connection master;
drop table t1,t2;
##############################################################################
#
# Test for BUG#9361:
# Subselects should work inside multi-updates
#
--disable_query_log
SELECT '-------- Test 1 for BUG#9361 --------' as "";
--enable_query_log
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t1 (
a1 char(30),
a2 int,
a3 int,
a4 char(30),
a5 char(30)
);
CREATE TABLE t2 (
b1 int,
b2 char(30)
);
# Insert one row per table
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
INSERT INTO t2 VALUES (1, 'baz');
# This should update the row in t1
UPDATE t1 a, t2
SET a.a1 = 'No'
WHERE a.a2 =
(SELECT b1
FROM t2
WHERE b2 = 'baz')
AND a.a3 IS NULL
AND a.a4 = 'foo'
AND a.a5 = 'bar';
sync_slave_with_master;
connection slave;
SELECT * FROM t1;
SELECT * FROM t2;
connection master;
DROP TABLE t1, t2;
##############################################################################
#
# Second test for BUG#9361
#
--disable_query_log
SELECT '-------- Test 2 for BUG#9361 --------' as "";
--enable_query_log
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t1 (
i INT,
j INT,
x INT,
y INT,
z INT
);
CREATE TABLE t2 (
i INT,
k INT,
x INT,
y INT,
z INT
);
CREATE TABLE t3 (
j INT,
k INT,
x INT,
y INT,
z INT
);
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE t1 AS a
INNER JOIN t2 AS b
ON a.i = b.i
INNER JOIN t3 AS c
ON a.j = c.j AND b.k = c.k
SET a.x = b.x,
a.y = b.y,
a.z = (
SELECT sum(z)
FROM t3
WHERE y = 34
)
WHERE b.x = 23;
sync_slave_with_master;
connection slave;
SELECT * FROM t1;
connection master;
DROP TABLE t1, t2, t3;
##############################################################################
#
# BUG#12618
#
# TEST: Replication of a statement containing a join in a multi-update.
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (
idp int(11) NOT NULL default '0',
idpro int(11) default NULL,
price decimal(19,4) default NULL,
PRIMARY KEY (idp)
);
CREATE TABLE t2 (
idpro int(11) NOT NULL default '0',
price decimal(19,4) default NULL,
nbprice int(11) default NULL,
PRIMARY KEY (idpro)
);
INSERT INTO t1 VALUES
(1,1,'3.0000'),
(2,2,'1.0000'),
(3,1,'1.0000'),
(4,1,'4.0000'),
(5,3,'2.0000'),
(6,2,'4.0000');
INSERT INTO t2 VALUES
(1,'0.0000',0),
(2,'0.0000',0),
(3,'0.0000',0);
# This update sets t2 to the minimal prices for each product
update
t2
join
( select idpro, min(price) as min_price, count(*) as nbr_price
from t1
where idpro>0 and price>0
group by idpro
) as table_price
on t2.idpro = table_price.idpro
set t2.price = table_price.min_price,
t2.nbprice = table_price.nbr_price;
select "-- MASTER AFTER JOIN --" as "";
select * from t1;
select * from t2;
sync_slave_with_master;
select "-- SLAVE AFTER JOIN --" as "";
select * from t1;
select * from t2;
# End of 4.1 tests
# When the relay log gets rotated while the I/O thread
# is reading a transaction, the transaction spans on two or more
# relay logs. If STOP SLAVE occurs while the SQL thread is
# executing a part of the transaction in the non-first relay logs,
# we test if START SLAVE will resume in the beginning of the
# transaction (i.e., step back to the first relay log)
# The slave is started with max_binlog_size=16384 bytes,
# to force many rotations (approximately 30 rotations)
-- source include/master-slave.inc
connection slave;
stop slave;
connection master;
--disable_warnings
eval create table t1 (a int) engine=$engine_type;
--enable_warnings
let $1=8000;
disable_query_log;
begin;
while ($1)
{
# eval means expand $ expressions
eval insert into t1 values( $1 );
dec $1;
}
commit;
# This will generate a 500kB master's binlog,
# which corresponds to 30 slave's relay logs.
enable_query_log;
save_master_pos;
connection slave;
reset slave;
start slave;
# We wait 1 sec for the SQL thread to be somewhere in
# the middle of the transaction, hopefully not in
# the first relay log, and hopefully before the COMMIT.
# Usually it stops when the SQL thread is around the 15th relay log.
# We cannot use MASTER_POS_WAIT() as master's position
# increases only when the slave executes the COMMIT.
# Note that except when using Valgrind, 1 second is enough for the I/O slave
# thread to fetch the whole master's binlog.
sleep 1;
stop slave;
# We suppose the SQL thread stopped before COMMIT.
# If so the transaction was rolled back
# and the table is now empty.
# Now restart
start slave;
# And see if the table contains '8000'
# which proves that the transaction restarted at
# the right place.
# We must wait for the transaction to commit before
# reading, with a sync_with_master.
sync_with_master;
select max(a) from t1;
connection master;
# The following DROP is a very important cleaning task:
# imagine the next test is run with --skip-innodb: it will do
# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
# some data in the InnoDB datafile (because at that time mysqld
# does not know about InnoDB : --skip-innodb). So if later in the
# test suite a test wants to create an InnoDB table called t1, it
# will fail with
# InnoDB: Error: table t1 already exists in InnoDB internal
# InnoDB: data dictionary. Have you deleted the .frm file etc
drop table t1;
# wait until this drop is executed on slave
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
# TBF - difference in row level logging
# Temp tables are not replicated in rbr, but it is still good to hit rbr with everthing
# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the
# --master-* options from mysqld, as this is what is going to be used next time
# slave threads will be started). In bug 985, it displayed old values (of before
......@@ -5,30 +8,30 @@
# See if slave crashes when doing a CREATE TEMPORARY TABLE twice, separated by
# RESET SLAVE.
source include/master-slave.inc;
-- source include/master-slave.inc
connection master;
save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
stop slave;
change master to master_user='test';
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# test of crash with temp tables & RESET SLAVE
......@@ -46,6 +49,3 @@ reset slave;
start slave;
sync_with_master;
show status like 'slave_open_temp_tables';
# End of 4.1 tests
#
-- source include/master-slave.inc
-- source include/have_binlog_format_row.inc
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 LIMIT 10;
#
# Test slave with wrong password
#
save_master_pos;
connection slave;
sync_with_master;
STOP SLAVE;
connection master;
SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
connection slave;
START SLAVE;
connection master;
#
# Give slave time to do at last one failed connect retry
# This one must be short so that the slave will not stop retrying
real_sleep 2;
SET PASSWORD FOR root@"localhost" = PASSWORD('');
# Give slave time to connect (will retry every second)
sleep 2;
CREATE TABLE t3(n INT);
INSERT INTO t3 VALUES(1),(2);
sync_slave_with_master;
SELECT * FROM t3;
SELECT SUM(LENGTH(word)) FROM t1;
connection master;
DROP TABLE t1,t3;
save_master_pos;
connection slave;
sync_with_master;
# Test if the slave SQL thread can be more than 16K behind the slave
# I/O thread (> IO_SIZE)
connection master;
# we'll use table-level locking to delay slave SQL thread
eval CREATE TABLE t1 (n INT) ENGINE=$engine_type;
sync_slave_with_master;
connection master;
RESET MASTER;
connection slave;
STOP SLAVE;
RESET SLAVE;
connection master;
let $1=5000;
# Generate 16K of relay log
disable_query_log;
while ($1)
{
eval INSERT INTO t1 VALUES($1);
dec $1;
}
enable_query_log;
SELECT COUNT(*) FROM t1;
save_master_pos;
# Try to cause a large relay log lag on the slave by locking t1
connection slave;
LOCK TABLES t1 READ;
START SLAVE;
UNLOCK TABLES;
sync_with_master;
SELECT COUNT(*) FROM t1;
connection master;
DROP TABLE t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES(3456);
sync_slave_with_master;
SELECT n FROM t1;
connection master;
DROP TABLE t1;
sync_slave_with_master;
# The test is not relevant when testing replication of error codes for
# statements that are not replicated. The test below could be changed
# to rely on the replication of error codes for statements that are not
# replicated row-based.
# This test does not work the same for row based as the insert in the second part is not replicated as a call but rather as a table map and row right. Have added a slave stop so the test will complete, other wise it just continues to loop waiting for a slave stop that never comes. 8/22/2005 JBM
-- source include/have_binlog_format_row.inc
# See if an EE_ error in one event of the master's binlog stops replication
# (it should not: in this configuration the EE_ error is probably not
# critical). Example: you do a DROP TABLE on a table which has no MYI file
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
-- source include/master-slave.inc
eval create table t1 (a int) engine=$engine_type;
flush tables;
system rm ./var/master-data/test/t1.MYI ;
drop table if exists t1;
save_master_pos;
connection slave;
sync_with_master;
# Now a real error.
connection master;
eval create table t1 (a int, unique(a)) engine=$engine_type;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
save_master_pos;
--error 1062
insert into t1 values(1),(2);
drop table t1;
save_master_pos;
connection slave;
stop slave;
wait_for_slave_to_stop;
#############################################################################
# Original Author: JBM #
# Original Date: Aug/18/2005 #
#############################################################################
# TEST: To test the UUID() in rbr #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
--enable_warnings
# Section 1 test
eval CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=$engine_type;
INSERT INTO test.t1 VALUES(1,UUID(),UUID());
delimiter |;
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,UUID(),UUID());
INSERT INTO test.t1 VALUES(3,UUID(),UUID());
end|
delimiter ;|
CALL test.p1();
# Now the same thing with a function
delimiter |;
create function test.fn1(x int)
returns int
begin
insert into t1 values (4+x,UUID(),UUID());
insert into t1 values (5+x,UUID(),UUID());
return 0;
end|
delimiter ;|
# test both in SELECT and in INSERT
select fn1(0);
create table t2 (a int);
insert into t2 values(fn1(2));
sync_slave_with_master;
SHOW CREATE TABLE test.t1;
# Dump the databases and so we can see if they match
# Another method would be to use SELECT INTO OUTFILE on master,
# then LOAD DATA INFILE in slave, and use a query to compare.
# This would have the advantage that it would not assume
# the system has a 'diff'
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_slave.sql
connection master;
# Let's cleanup
DROP PROCEDURE test.p1;
DROP TABLE test.t1;
# Let's compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching :-)
--exec diff ./var/tmp/rpl_row_UUID_master.sql ./var/tmp/rpl_row_UUID_slave.sql;
# Cleanup dump files.
# Long-term "system rm" is not portable; we could live without
# this cleanup as no other test will use these files and they'll
# be removed at next testsuite run.
# End of 5.0 test case
# Replication of character sets.
# This test will fail if the server/client does not support enough charsets.
# Requires statement logging
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
--disable_warnings
set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
--enable_warnings
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database mysqltest2;
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database mysqltest2;
show create database mysqltest3;
connection master;
set @@collation_server=armscii8_bin;
drop database mysqltest3;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database mysqltest3;
connection master;
use mysqltest2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
# character_set_database and collation_database are not tested as they
# needn't be replicated (Bar said in Jan 2005).
insert into t1 (b) values(@@character_set_client);
# collation_client does not exist
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--disable_query_log
select "--- --master--" as "";
--enable_query_log
select * from t1 order by a;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from mysqltest2.t1 order by a;
select "--- --muller--" as "";
connection master;
set character_set_client=latin1, collation_connection=latin1_german1_ci;
truncate table t1;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Mller","Muffler"));
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Mller","Muffler"));
--disable_query_log
select "--- --master--" as "";
--enable_query_log
select * from t1 order by a;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from mysqltest2.t1 order by a;
# Presently charset info is not logged with LOAD DATA but it will
# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
# here.
# See if user var is prefixed with collation in binlog and replicated well.
# Note: replication of user variables is broken as far as derivation is
# concerned. That's because when we store a user variable in the binlog,
# we lose its derivation. So later on the slave, it's impossible to
# know if the collation was explicit or not, so we use DERIVATION_NONE,
# which provokes error messages (like 'Illegal mix of collation') when
# we replay the master's INSERT/etc statements.
select "--- --INSERT--" as "";
connection master;
set @a= _cp850 'Mller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--disable_query_log
select "--- --master--" as "";
--enable_query_log
select * from t1 order by a;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from mysqltest2.t1 order by a;
connection master;
drop database mysqltest2;
drop database mysqltest3;
--replace_column 2 # 5 #
show binlog events from 102;
sync_slave_with_master;
# Check that we can change global.collation_server (since 5.0.3)
select "--- --global--" as "";
set global character_set_server=latin2;
set global character_set_server=latin1; # back
connection master;
set global character_set_server=latin2;
set global character_set_server=latin1; # back
# Check that SET ONE_SHOT is really one shot
select "--- --oneshot--" as "";
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
select @@character_set_server;
set @@character_set_server=latin5;
select @@character_set_server;
select @@character_set_server;
# ONE_SHOT on not charset/collation stuff is not allowed
-- error 1382
set one_shot max_join_size=10;
# Test of wrong character set numbers;
error 1115;
set character_set_client=9999999;
error 1273;
set collation_server=9999998;
# This one was contributed by Sergey Petrunia (BUG#3943)
select "--- --3943--" as "";
use test;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET CHARACTER_SET_CLIENT=koi8r,
CHARACTER_SET_CONNECTION=cp1251,
CHARACTER_SET_RESULTS=koi8r;
INSERT INTO t1 (c1, c2) VALUES (', ',', ');
select hex(c1), hex(c2) from t1;
sync_slave_with_master;
select hex(c1), hex(c2) from t1;
connection master;
# Let's have a look at generated SETs.
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t1;
sync_slave_with_master;
#
# BUG#6676: Derivation of variables must be correct on slave
#
select "--- --6676--" as "";
connection master;
eval create table `t1` (
`pk` varchar(10) not null default '',
primary key (`pk`)
) engine=$engine_type default charset=latin1;
set @p=_latin1 'test';
update t1 set pk='test' where pk=@p;
drop table t1;
sync_slave_with_master;
# See if INSERT DELAYED gets replicated
# Only in row-based, as we do SHOW BINLOG EVENTS
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
connection master;
let $VERSION=`select version()`;
eval create table t1(a int not null primary key) engine=$engine_type;
insert delayed into t1 values (1),(2),(3);
flush tables;
select * from t1;
sync_slave_with_master;
connection master;
--replace_result $VERSION VERSION
show binlog events;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
sync_slave_with_master;
#############################################################################
# Original Author: JBM #
# Original Date: Aug/15/2005 #
# Update: 08/29/2005 Comment out sleep. Only needed for debugging #
#############################################################################
# Note: Many lines are commented out in this test case. These were used for #
# creating the test case and debugging and are being left for #
# debugging, but they can not be used for the regular testing as the #
# Time changes and is not deteministic, so instead we dump both the #
# master and slave and diff the dumps. If the dumps differ then the #
# test case will fail. To run during diff failuers, comment out the #
# diff. #
# Test: Tests MySQL stored function using RAND() and a flow control. The #
# test inserts rows into a givin table with the function used in #
# the insert statement. Depending on the RAND() value returned #
# inside the function one set of text is returned. In addition, #
# it uses a transaction to see the effect a rollback has on master #
# Vs slave. #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP FUNCTION IF EXISTS test.f1;
DROP TABLE IF EXISTS test.t1;
--enable_warnings
eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type;
delimiter |;
create function test.f1() RETURNS CHAR(16)
BEGIN
DECLARE tmp CHAR(16);
DECLARE var_name FLOAT;
SET var_name = RAND();
IF var_name > .6
THEN SET tmp = 'Texas';
ELSE SET tmp = 'MySQL';
END IF;
RETURN tmp;
END|
delimiter ;|
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
sleep 6;
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
sleep 6;
#Select in this test are used for debugging
#select * from test.t1;
#connection slave;
#select * from test.t1;
connection master;
SET AUTOCOMMIT=0;
START TRANSACTION;
INSERT INTO test.t1 VALUES (null,test.f1());
ROLLBACK;
SET AUTOCOMMIT=1;
#select * from test.t1;
#sleep 6;
#connection slave;
#select * from test.t1;
#connection master;
#used for debugging
#show binlog events;
# time to dump the databases and so we can see if they match
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_slave.sql
# First lets cleanupi
DROP FUNCTION test.f1;
DROP TABLE test.t1;
# the test will show that the diff statement failed and no reject file
# will be created. You will need to go to the mysql-test dir and diff
# the files yourself to see what is not matching :-) File are located
# in mysql-test/var/tmp
exec diff ./var/tmp/func003_master.sql ./var/tmp/func003_slave.sql;
# End of 5.0 test case
-- source include/master-slave.inc
##############################################################################
#
# Let's verify that multi-update with a subselect does not cause the slave to crash
# (BUG#10442)
#
--disable_query_log
SELECT '-------- Test for BUG#9361 --------' as "";
--enable_query_log
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
eval CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=$engine_type;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
sync_slave_with_master;
connection slave;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
connection master;
drop table t1,t2;
##############################################################################
#
# Test for BUG#9361:
# Subselects should work inside multi-updates
#
--disable_query_log
SELECT '-------- Test 1 for BUG#9361 --------' as "";
--enable_query_log
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t1 (
a1 char(30),
a2 int,
a3 int,
a4 char(30),
a5 char(30)
);
CREATE TABLE t2 (
b1 int,
b2 char(30)
);
# Insert one row per table
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
INSERT INTO t2 VALUES (1, 'baz');
# This should update the row in t1
UPDATE t1 a, t2
SET a.a1 = 'No'
WHERE a.a2 =
(SELECT b1
FROM t2
WHERE b2 = 'baz')
AND a.a3 IS NULL
AND a.a4 = 'foo'
AND a.a5 = 'bar';
sync_slave_with_master;
connection slave;
SELECT * FROM t1;
SELECT * FROM t2;
connection master;
DROP TABLE t1, t2;
##############################################################################
#
# Second test for BUG#9361
#
--disable_query_log
SELECT '-------- Test 2 for BUG#9361 --------' as "";
--enable_query_log
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t1 (
i INT,
j INT,
x INT,
y INT,
z INT
);
CREATE TABLE t2 (
i INT,
k INT,
x INT,
y INT,
z INT
);
CREATE TABLE t3 (
j INT,
k INT,
x INT,
y INT,
z INT
);
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE t1 AS a
INNER JOIN t2 AS b
ON a.i = b.i
INNER JOIN t3 AS c
ON a.j = c.j AND b.k = c.k
SET a.x = b.x,
a.y = b.y,
a.z = (
SELECT sum(z)
FROM t3
WHERE y = 34
)
WHERE b.x = 23;
sync_slave_with_master;
connection slave;
SELECT * FROM t1;
connection master;
DROP TABLE t1, t2, t3;
#############################################################################
# This test is being created to test out the non deterministic items with #
# row based replication. #
# Original Author: JBM #
# Original Date: Aug/09/2005 #
# Updated: Aug/29/2005 #
#############################################################################
# Test: Contains two stored procedures test one that insert data into tables#
# and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) #
# REFERENCES ON DELETE CASCADE. This test also has a delete sp that #
# should cause a delete cascade. #
# The second test has a sp that will either insert rows or delete from#
# the table depending on the CASE outcome. The test uses this SP in a#
# transaction first rolling back and then commiting, #
#############################################################################
# Mod Date: 08/22/2005 #
# TEST: Added test to include UPDATE CASCADE on table with FK per Trudy #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
DROP TABLE IF EXISTS test.t3;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
--enable_warnings
# End of cleanup
# Begin test section 1
eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type;
eval CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=$engine_type;
delimiter |;
create procedure test.p1(IN i CHAR(6))
begin
INSERT INTO test.t1 (t) VALUES (i);
INSERT INTO test.t2 VALUES (NULL,LAST_INSERT_ID());
end|
create procedure test.p2(IN i INT)
begin
DELETE FROM test.t1 where a < i;
end|
delimiter ;|
let $message=< -- test 1 call p1 -- >;
--source include/show_msg.inc
SET FOREIGN_KEY_CHECKS=1;
call test.p1('texas');
call test.p1('Live');
call test.p1('next');
call test.p1('to');
call test.p1('OK');
call test.p1('MySQL');
let $message=< -- test 1 select master after p1 -- >;
--source include/show_msg.inc
SELECT * FROM test.t1;
SELECT * FROM test.t2;
let $message=< -- test 1 select slave after p1 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
let $message=< -- test 1 call p2 & select master -- >;
--source include/show_msg.inc
connection master;
call test.p2(4);
SELECT * FROM test.t1;
SELECT * FROM test.t2;
let $message=< -- test 1 select slave after p2 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
connection master;
#show binlog events;
let $message=< -- End test 1 Begin test 2 -- >;
--source include/show_msg.inc
# End test 1 Begin test 2
--disable_warnings
SET FOREIGN_KEY_CHECKS=0;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
--enable_warnings
# End of cleanup
eval CREATE TABLE test.t1 (a INT, t CHAR(6), PRIMARY KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE test.t2 (a INT, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON UPDATE CASCADE, PRIMARY KEY(a)) ENGINE=$engine_type;
delimiter |;
CREATE PROCEDURE test.p1(IN nm INT, IN ch CHAR(6))
BEGIN
INSERT INTO test.t1 (a,t) VALUES (nm, ch);
INSERT INTO test.t2 VALUES (nm, LAST_INSERT_ID());
END|
CREATE PROCEDURE test.p2(IN i INT)
BEGIN
UPDATE test.t1 SET a = i*10 WHERE a = i;
END|
delimiter ;|
SET FOREIGN_KEY_CHECKS=1;
CALL test.p1(1,'texas');
CALL test.p1(2,'Live');
CALL test.p1(3,'next');
CALL test.p1(4,'to');
CALL test.p1(5,'OK');
CALL test.p1(6,'MySQL');
let $message=< -- test 2 select Master after p1 -- >;
--source include/show_msg.inc
SELECT * FROM test.t1;
SELECT * FROM test.t2;
let $message=< -- test 2 select Slave after p1 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
let $message=< -- test 2 call p2 & select Master -- >;
--source include/show_msg.inc
connection master;
CALL test.p2(2);
CALL test.p2(4);
CALL test.p2(6);
SELECT * FROM test.t1;
SELECT * FROM test.t2;
let $message=< -- test 1 select Slave after p2 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
connection master;
#show binlog events;
let $message=< -- End test 2 Begin test 3 -- >;
--source include/show_msg.inc
# End test 2 begin test 3
eval CREATE TABLE test.t3 (a INT AUTO_INCREMENT KEY, t CHAR(6))ENGINE=$engine_type;
delimiter |;
CREATE PROCEDURE test.p3(IN n INT)
begin
CASE n
WHEN 2 THEN
DELETE from test.t3;
ELSE
INSERT INTO test.t3 VALUES (NULL,'NONE');
END CASE;
end|
delimiter ;|
SET AUTOCOMMIT=0;
START TRANSACTION;
-- disable_query_log
-- disable_result_log
let $n=50;
while ($n)
{
eval call test.p3($n);
dec $n;
}
-- enable_result_log
-- enable_query_log
ROLLBACK;
select * from test.t3;
save_master_pos;
connection slave;
sync_with_master;
select * from test.t3;
connection master;
START TRANSACTION;
-- disable_query_log
-- disable_result_log
let $n=50;
while ($n>3)
{
eval call test.p3($n);
dec $n;
}
-- enable_result_log
-- enable_query_log
COMMIT;
select * from test.t3;
save_master_pos;
connection slave;
sync_with_master;
select * from test.t3;
connection master;
#show binlog events from 1626;
# First lets cleanup
SET AUTOCOMMIT=1;
SET FOREIGN_KEY_CHECKS=0;
DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
sync_slave_with_master;
# End of 5.0 test case
#############################################################################
# Original Author: JBM #
# Original Date: Aug/13/2005 Created from Bug 12335 #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
--enable_warnings
# End of cleanup
# Begin test section 1
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
delimiter |;
CREATE PROCEDURE test.p1()
BEGIN
INSERT INTO test.t1 VALUES (4);
SELECT get_lock("test", 100);
UPDATE test.t1 set a=a+4 WHERE a=4;
END|
CREATE PROCEDURE test.p2()
BEGIN
UPDATE test.t1 SET a=a+1;
END|
delimiter ;|
SELECT get_lock("test", 200);
connection master1;
send CALL test.p1();
connection master;
# To make sure tha the call on master1 arrived at the get_lock
sleep 1;
CALL test.p2();
SELECT release_lock("test");
SELECT * FROM test.t1;
#show binlog events;
sync_slave_with_master;
connection slave;
SELECT * FROM test.t1;
connection master;
DROP TABLE IF EXISTS test.t1;
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
CALL test.p2();
CALL test.p1();
SELECT * FROM test.t1;
sync_slave_with_master;
connection slave;
SELECT * FROM test.t1;
connection master;
#show binlog events from 719;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
sync_slave_with_master;
# End of 5.0 test case
#############################################################################
# Original Author: JBM #
# Original Date: Aug/15/2005 #
# Updated: 08/29/2005 to remove sleeps #
#############################################################################
# Test: This test uses two SPs, one to populate a table, and another to use #
# Cursors, CURRENT_DATE(), loop control, date math and logic control #
# to populate a table with data from the first table. #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
create database if not exists mysqltest1;
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t1;
--enable_warnings
# End of cleanup
# Begin test section 1
eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
delimiter |;
CREATE PROCEDURE mysqltest1.p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
FROM mysqltest1.t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
SET AUTOCOMMIT=0;
REPEAT
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
CREATE PROCEDURE mysqltest1.p2()
BEGIN
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
delimiter ;|
CALL mysqltest1.p2();
sync_slave_with_master;
connection master;
CALL mysqltest1.p1();
sync_slave_with_master;
connection master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_slave.sql
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
# Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching :-) Failed test
# Dump files will be located in mysql-test/var/tmp.
exec diff ./var/tmp/sp006_master.sql ./var/tmp/sp006_slave.sql;
sync_slave_with_master;
# End of 5.1 test case
#############################################################################
# Original Author: JBM #
# Original Date: Aug/15/2005 #
# Updated: 08/29/2005 Remove sleeps #
#############################################################################
# TEST: SP that creates table, starts tranaction inserts. Save point, insert#
# rollback to save point and then commits. #
#############################################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
--enable_warnings
# End of cleanup
# Begin test section 1
delimiter |;
eval CREATE PROCEDURE test.p1(IN i INT)
BEGIN
DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=$engine_type;
START TRANSACTION;
INSERT INTO test.t1 VALUES(i);
savepoint t1_save;
INSERT INTO test.t1 VALUES (14);
ROLLBACK to savepoint t1_save;
COMMIT;
END|
delimiter ;|
let $message=< ---- Master selects-- >;
--source include/show_msg.inc
CALL test.p1(12);
SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t1;
let $message=< ---- Master selects-- >;
--source include/show_msg.inc
connection master;
CALL test.p1(13);
SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t1;
connection master;
#show binlog events;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
# End of 5.0 test case
# Test how replication of tables work when the definition on the
# master and slave differs.
# Consider making these part of the basic RBR tests.
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
connection master;
eval CREATE TABLE t1 (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 t4 (a 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;
# Table used to detect that slave is running
eval CREATE TABLE t9 (a INT PRIMARY KEY) ENGINE=$engine_type;
sync_slave_with_master;
# On the slave, we add one column last in table 't1',
ALTER TABLE t1 ADD x INT DEFAULT 42;
# ... add one column in the middle of table 't2', and
ALTER TABLE t2 ADD x INT DEFAULT 42 AFTER a;
# ... add one column first in table 't3'.
ALTER TABLE t3 ADD x INT DEFAULT 42 FIRST;
# ... change the type of the single column in table 't4'
ALTER TABLE t4 MODIFY a FLOAT;
# ... change the type of the middle column of table 't5'
ALTER TABLE t5 MODIFY b FLOAT;
# ... change the type of the last column of table 't6'
ALTER TABLE t6 MODIFY c FLOAT;
# Each of these should generate an error and stop the slave
connection master;
INSERT INTO t9 VALUES (1);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
INSERT INTO t1 VALUES (1,2);
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;
START SLAVE;
connection master;
INSERT INTO t9 VALUES (2);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
INSERT INTO t2 VALUES (2,4);
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;
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;
START SLAVE;
connection master;
INSERT INTO t9 VALUES (4);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
INSERT INTO t4 VALUES (4);
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;
START SLAVE;
connection master;
INSERT INTO t9 VALUES (5);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
INSERT INTO t5 VALUES (5,10,25);
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;
START SLAVE;
connection master;
INSERT INTO t9 VALUES (6);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
INSERT INTO t6 VALUES (6,12,36);
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;
START SLAVE;
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t9;
--enable_warnings
sync_slave_with_master;
source include/master-slave.inc;
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
......@@ -44,7 +45,7 @@ sync_with_master;
connection master;
# we'll use table-level locking to delay slave SQL thread
create table t1 (n int) engine=myisam;
eval create table t1 (n int) engine=$engine_type;
sync_slave_with_master;
connection master;
reset master;
......
# The test is not relevant when testing replication of error codes for
# statements that are not replicated. The test below could be changed
# to rely on the replication of error codes for statements that are not
# replicated row-based.
-- source include/have_binlog_format_statement.inc
# See if an EE_ error in one event of the master's binlog stops replication
# (it should not: in this configuration the EE_ error is probably not
# critical). Example: you do a DROP TABLE on a table which has no MYI file
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
source include/master-slave.inc;
-- source include/master-slave.inc
create table t1 (a int) engine=myisam;
eval create table t1 (a int) engine=$engine_type;
flush tables;
system rm ./var/master-data/test/t1.MYI ;
drop table if exists t1;
......@@ -17,7 +23,7 @@ sync_with_master;
# Now a real error.
connection master;
create table t1 (a int, unique(a)) engine=myisam;
eval create table t1 (a int, unique(a)) engine=$engine_type;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
......
# Replication of character sets.
# This test will fail if the server/client does not support enough charsets.
# Requires statement logging
-- source include/have_binlog_format_statement.inc
source include/master-slave.inc;
--disable_warnings
set timestamp=1000000000;
......@@ -107,7 +110,7 @@ connection master;
drop database mysqltest2;
drop database mysqltest3;
--replace_column 2 # 5 #
show binlog events from 98;
show binlog events from 102;
sync_slave_with_master;
# Check that we can change global.collation_server (since 5.0.3)
......@@ -161,10 +164,10 @@ sync_slave_with_master;
# BUG#6676: Derivation of variables must be correct on slave
#
connection master;
create table `t1` (
eval create table `t1` (
`pk` varchar(10) not null default '',
primary key (`pk`)
) engine=myisam default charset=latin1;
) engine=$engine_type default charset=latin1;
set @p=_latin1 'test';
update t1 set pk='test' where pk=@p;
drop table t1;
......
#############################################################################
# Original Author: JBM #
# Original Date: Aug/09/2005 #
#############################################################################
# TEST: Use after insert and before inset triggers and stored procdures to #
# Update and insert data #
#############################################################################
# Begin clean up test section
connection master;
--disable_warnings
--error 0,1360
DROP TRIGGER test.t1_bi_t2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
eval CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
eval CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
delimiter //;
CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
delimiter ;//
INSERT INTO test.t2 VALUES (1, 0.0);
--error 0,1062
INSERT INTO test.t2 VALUES (1, 0.0);
#show binlog events;
select * from test.t1;
select * from test.t2;
sync_slave_with_master;
connection slave;
select * from test.t1;
select * from test.t2;
connection master;
DROP TRIGGER test.t1_bi_t2;
DROP TABLE test.t1;
DROP TABLE test.t2;
sync_slave_with_master;
# End of 5.0 test case
# row-based and statement binlog difference in result files
#
# Test of replicating user variables
#
source include/master-slave.inc;
-- source include/master-slave.inc
# Disable PS as the log positions differs
--disable_ps_protocol
......@@ -39,20 +40,15 @@ set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
# To flush the pending event, we add the following statement. RBR can
# concatenate the result of several statements, which SBR cannot.
select * from t1 where n = '<nonexistant>';
connection master1; # see if variable is reset in binlog when thread changes
insert into t1 values (@a),(@a),(@a*5);
select * from t1;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1;
--replace_column 2 # 5 #
show binlog events from 98;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
stop slave;
# End of 4.1 tests
-- require r/have_binlog_format_row.require
disable_query_log;
show variables like "binlog_format";
enable_query_log;
-- require r/have_binlog_format_statement.require
disable_query_log;
show variables like "binlog_format";
enable_query_log;
-- require r/have_row_based.require
disable_query_log;
show variables like "have_row_based_replication";
enable_query_log;
-- require r/not_row_based.require
disable_query_log;
show variables like "have_row_based_replication";
enable_query_log;
connection master;
INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
sync_slave_with_master;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
connection master;
UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
sync_slave_with_master;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
connection master;
DELETE FROM mysqltest1.t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
sync_slave_with_master;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
connection master;
--source include/have_row_based.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
#
# Basic tests of row-level logging
#
#
# First we test tables with only an index.
#
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
SELECT * FROM t1;
sync_slave_with_master;
SELECT * FROM t1;
# Testing insert
connection master;
INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
SELECT * FROM t1 ORDER BY C1,C2;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY C1,C2;
# Testing delete
# Observe that are several rows having the value for the index but only one
# should be deleted.
connection master;
DELETE FROM t1 WHERE C1 = C2;
SELECT * FROM t1 ORDER BY C1,C2;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY C1,C2;
#
# Testing update.
# Note that we have a condition on a column that is not part of the index for
# the table. The right row should be updated nevertheless.
#
connection master;
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t1 ORDER BY C1,C2;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY C1,C2;
# Testing update with a condition that does not match any rows, but
# which has a match for the index.
connection master;
UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
SELECT * FROM t1 ORDER BY c1,c2;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY c1,c2;
#
# Testing table with primary key
#
connection master;
eval CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = $type ;
INSERT INTO t2
VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
SELECT * FROM t2 ORDER BY c1,c2;
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY c1,c2;
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
connection master;
UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
sync_slave_with_master;
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
# Testing update with a condition that does not match any rows, but
# which has a match for the primary key.
connection master;
UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
SELECT * FROM t2 ORDER BY c1,c2;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY c1,c2;
connection master;
DELETE FROM t2 WHERE c1 % 4 = 0;
SELECT * FROM t2 ORDER BY c1,c2;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY c1,c2;
connection master;
UPDATE t2 SET c12='X';
#
# Testing table with a multi-column primary key.
#
connection master;
eval CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = $type ;
INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
SELECT * FROM t3 ORDER BY C1,C2;
sync_slave_with_master;
SELECT * FROM t3 ORDER BY C1,C2;
connection master;
DELETE FROM t3 WHERE C1 = C2;
SELECT * FROM t3 ORDER BY C1,C2;
sync_slave_with_master;
SELECT * FROM t3 ORDER BY C1,C2;
connection master;
UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t3 ORDER BY C1,C2;
sync_slave_with_master;
SELECT * FROM t3 ORDER BY C1,C2;
#
# Testing table without index or primary key
#
connection master;
eval CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT$extra_index_t6) ENGINE = $type;
# Testing insert
INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
SELECT * FROM t6 ORDER BY C3;
sync_slave_with_master;
SELECT * FROM t6 ORDER BY C3;
# Testing delete
# Observe that are several rows having the value for the index but only one
# should be deleted.
connection master;
DELETE FROM t6 WHERE C1 = C2;
SELECT * FROM t6 ORDER BY C3;
sync_slave_with_master;
SELECT * FROM t6 ORDER BY C3;
#
# Testing update.
# Note that we have a condition on a column that is not part of the index for
# the table. The right row should be updated nevertheless.
#
connection master;
UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t6 ORDER BY C3;
sync_slave_with_master;
SELECT * FROM t6 ORDER BY C3;
# now mixing the 3 tables without begin/commit
connection master;
eval CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = $type ;
INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
sync_slave_with_master;
SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
#
# Testing special column types
#
connection master;
eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
INSERT INTO t4 SET C1 = 1;
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
sync_slave_with_master;
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
#
# Testing conflicting operations
#
connection master;
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
sync_slave_with_master;
--disable_query_log
SELECT "--- on slave: original values ---" AS "";
--enable_query_log
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
SELECT * FROM t7 ORDER BY C1;
connection master;
--disable_query_log
SELECT "--- on master: new values inserted ---" AS "";
--enable_query_log
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
SELECT * FROM t7 ORDER BY C1;
sync_slave_with_master;
--disable_query_log
SELECT "--- on slave: old values should be overwritten by replicated values ---" AS "";
--enable_query_log
SELECT * FROM t7 ORDER BY C1;
#
# A more complicated test where the table has several keys and we are
# causing a conflict for a key that is not "last".
#
connection master;
--disable_query_log
SELECT "--- on master ---" AS "";
--enable_query_log
DROP TABLE t7;
eval CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
# First we make sure that the constraints are correctly set.
INSERT INTO t7 VALUES (99,99,99);
--error 1062
INSERT INTO t7 VALUES (99,22,33);
--error 1062
INSERT INTO t7 VALUES (11,99,33);
--error 1062
INSERT INTO t7 VALUES (11,22,99);
SELECT * FROM t7 ORDER BY a;
sync_slave_with_master;
--disable_query_log
SELECT "--- on slave ---" AS "";
--enable_query_log
SELECT * FROM t7 ORDER BY a;
INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9);
SELECT * FROM t7 ORDER BY a;
connection master;
--disable_query_log
SELECT "--- on master ---" AS "";
--enable_query_log
# We insert a row that will cause conflict on the primary key but not
# on the other keys.
INSERT INTO t7 VALUES (2,4,8);
sync_slave_with_master;
--disable_query_log
SELECT "--- on slave ---" AS "";
--enable_query_log
SELECT * FROM t7 ORDER BY a;
#
# Test conflicting operations when changing in a table referenced by a
# foreign key. We'll reuse the above table and just add a table that
# references it.
#
#
# cleanup
#
connection master;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
sync_slave_with_master;
# include/rpl_stmt_seq.inc
#
# Please be very careful when editing this routine, because the handling of
# the $variables is extreme sensitive.
#
###############################################################
# Debug options : To debug this test script
###############################################################
let $show_binlog= 0;
let $manipulate= 1;
######## The typical test sequence
# 1. INSERT without commit
# check table content of master and slave
# 2. EXECUTE the statement
# check table content of master and slave
# 3. ROLLBACK
# check table content of master and slave
# 4. flush the logs
let $VERSION=`select version()`;
--disable_query_log
# SELECT '######## new test sequence ########' as "";
eval SELECT CONCAT('######## ','$my_stmt',' $engine_type',' ########') as "";
--enable_query_log
###############################################################
# Predict the number of the current log
###############################################################
# Disable the logging of the log number computation.
--disable_query_log
# $_log_num_n should contain the number of the current binlog in numeric style.
# If this routine is called for the first time, $_log_num will not initialized
# and contain the value '' instead of '1'. So we will correct it here.
#
eval set @aux= IF('$_log_num_n' = '', '1', '$_log_num_n');
let $_log_num_n= `SELECT @aux`;
eval set @aux= LPAD('$_log_num_n',6,'0');
# SELECT @aux AS "@aux is";
#
# $_log_num_s should contain the number of the current binlog in string style.
let $_log_num_s= `select @aux`;
# eval SELECT '$log_num' ;
--enable_query_log
###############################################################
# INSERT
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# Maybe it would be smarter to use a table with autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
eval INSERT INTO t1 SET f1= $MAX + 1;
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
###############################################################
# command to be tested
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
eval $my_stmt $engine_type;
# Devaluate $my_stmt, to detect script bugs
let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
###############################################################
# ROLLBACK
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
ROLLBACK;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
# Try to detect if the DDL command caused that the INSERT is committed
# $MAX holds the highest/last value just before the insert of MAX + 1
--disable_query_log
eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
IF((MAX(f1) = $MAX + 1) XOR NOT $my_master_commit,
' (Succeeded)',
' (Failed)')) AS ""
FROM mysqltest1.t1;
--enable_query_log
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
--disable_query_log
eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ',
IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
IF((MAX(f1) = $MAX + 1) XOR NOT $my_slave_commit,
' (Succeeded)',
' (Failed)')) AS ""
FROM mysqltest1.t1;
--enable_query_log
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
###############################################################
# Manipulate binlog
###############################################################
if ($manipulate)
{
#### Manipulate the binary logs,
# so that the output of SHOW BINLOG EVENTS IN <current log>
# contains only commands of the current test sequence.
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
flush logs;
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# the final content of the binary log
flush logs;
# The next sleep is urgent needed.
# Without this sleep the slaves crashes often, when the SHOW BINLOG
# is executed. :-(
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
inc $_log_num_n;
}
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
......@@ -2042,6 +2042,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
mtr_add_arg($args, "%s--core", $prefix);
mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
mtr_add_arg($args, "%s--loose-binlog-show-xid=0", $prefix);
mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
......@@ -2165,6 +2166,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
mtr_add_arg($args, "%s--loose-binlog-show-xid=0", $prefix);
if ( $opt_ssl_supported )
{
......@@ -2485,6 +2487,10 @@ sub run_mysqltest ($) {
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
"--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password=";
my $cmdline_mysqldumpslave= "$exe_mysqldump --no-defaults -uroot " .
"--socket=$slave->[0]->{'path_mysock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqldump .=
......@@ -2568,6 +2574,7 @@ sub run_mysqltest ($) {
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
$ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap unless $glob_win32;
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
$ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
......
......@@ -806,12 +806,13 @@ export MYSQL_DUMP_DIR
MYSQL_CHECK="$MYSQL_CHECK --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
export MYSQL_SLAP
export NDB_TOOLS_DIR
......@@ -1287,9 +1288,10 @@ start_master()
--innodb_data_file_path=ibdata1:128M:autoextend \
--open-files-limit=1024 \
--log-bin-trust-function-creators \
--loose-binlog-show-xid=0 \
$MASTER_40_ARGS \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE"
else
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
......@@ -1308,9 +1310,10 @@ start_master()
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:128M:autoextend \
--log-bin-trust-function-creators \
--loose-binlog-show-xid=0 \
$MASTER_40_ARGS \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS"
fi
......@@ -1441,8 +1444,9 @@ start_slave()
--master-retry-count=10 \
-O slave_net_timeout=10 \
--log-bin-trust-function-creators \
--loose-binlog-show-xid=0 \
$SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
$EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT"
CUR_MYERR=$slave_err
CUR_MYSOCK=$slave_sock
......
drop table if exists t1, t2;
reset master;
create table t1 (a int) engine=bdb;
create table t2 (a int) engine=innodb;
begin;
insert t1 values (5);
commit;
begin;
insert t2 values (5);
commit;
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) engine=bdb
master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Table_map 1 # test.t2
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* xid= */
drop table t1,t2;
reset master;
create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
show binlog events in 'master-bin.000001' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* xid= */
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
drop table if exists t1,t2;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=blackhole;
INSERT INTO t1 VALUES (9410,9412);
select period from t1;
period
select * from t1;
Period Varor_period
select t1.* from t1;
Period Varor_period
CREATE TABLE t2 (
auto int NOT NULL auto_increment,
fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
fld3 char(30) DEFAULT '' NOT NULL,
fld4 char(35) DEFAULT '' NOT NULL,
fld5 char(35) DEFAULT '' NOT NULL,
fld6 char(4) DEFAULT '' NOT NULL,
primary key (auto)
) ENGINE=blackhole;
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
fld3
select fld3 from t2 where fld3 like "%cultivation" ;
fld3
select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
fld3 companynr
select fld3,companynr from t2 where companynr = 58 order by fld3;
fld3 companynr
select fld3 from t2 order by fld3 desc limit 10;
fld3
select fld3 from t2 order by fld3 desc limit 5;
fld3
select fld3 from t2 order by fld3 desc limit 5,5;
fld3
select t2.fld3 from t2 where fld3 = 'honeysuckle';
fld3
select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
fld3
select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
fld3
select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
fld3
select t2.fld3 from t2 where fld3 LIKE 'h%le';
fld3
select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
fld3
select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Full-text indexes', 'are called collections'),
('Only MyISAM tables','support collections'),
('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model');
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Only MyISAM tables support collections
Full-text indexes are called collections
explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections'))
select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Full-text indexes are called collections
select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
a b
Full-text indexes are called collections
Only MyISAM tables support collections
select * from t1 where MATCH(a,b) AGAINST ("only");
a b
reset master;
drop table t1,t2;
create table t1 (a int) engine=blackhole;
delete from t1 where a=10;
update t1 set a=11 where a=15;
insert into t1 values(1);
insert ignore into t1 values(1);
replace into t1 values(100);
create table t2 (a varchar(200)) engine=blackhole;
load data infile '../../std_data/words.dat' into table t2;
alter table t1 add b int;
alter table t1 drop b;
create table t3 like t1;
insert into t1 select * from t3;
replace into t1 select * from t3;
select * from t1;
a
select * from t2;
a
select * from t3;
a
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; drop table t1,t2
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Table_map 1 # test.t2
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
drop table t1,t2,t3;
reset master;
create table t1 (a int) engine=blackhole;
set autocommit=0;
start transaction;
insert into t1 values(1);
commit;
start transaction;
insert into t1 values(2);
rollback;
set autocommit=1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; COMMIT
This diff is collapsed.
SET TIMESTAMP=10000;
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Table_map 1 141 test.t2
master-bin.000001 141 Write_rows 1 231
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t2;
drop database if exists `drop-temp+table-test`;
reset master;
create database `drop-temp+table-test`;
use `drop-temp+table-test`;
create temporary table shortn1 (a int);
create temporary table `table:name` (a int);
create temporary table shortn2 (a int);
select get_lock("a",10);
get_lock("a",10)
1
select get_lock("a",10);
get_lock("a",10)
1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # create database `drop-temp+table-test`
drop database `drop-temp+table-test`;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 0
drop table if exists t1;
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 1
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size";
Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 2000
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 2000
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 0
create table t1(a int, unique(a));
insert into t1 values(2);
create table t2(a int);
insert into t2 values(1),(2);
reset master;
insert into t1 select * from t2;
ERROR 23000: Duplicate entry '2' for key 1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
master-bin.000001 102 Table_map 1 141 test.t1
master-bin.000001 141 Write_rows 1 175
select * from t1;
a
1
2
drop table t1, t2;
create table t1(a int);
insert into t1 values(1),(1);
reset master;
create table t2(unique(a)) select a from t1;
ERROR 23000: Duplicate entry '1' for key 1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
drop table t1;
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
reset master;
begin;
insert into t1 values(1);
insert into t2 select * from t1;
commit;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t2
master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(2);
insert into t2 select * from t1;
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t2
master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(3);
savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 328 Table_map 1 # test.t1
master-bin.000001 367 Write_rows 1 #
master-bin.000001 401 Table_map 1 # test.t2
master-bin.000001 440 Write_rows 1 #
master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 576 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(5);
savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into t1 values(7);
commit;
select a from t1 order by a;
a
5
7
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 328 Table_map 1 # test.t1
master-bin.000001 367 Write_rows 1 #
master-bin.000001 401 Table_map 1 # test.t2
master-bin.000001 440 Write_rows 1 #
master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 576 Table_map 1 # test.t1
master-bin.000001 615 Write_rows 1 #
master-bin.000001 649 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
select get_lock("a",10);
get_lock("a",10)
1
begin;
insert into t1 values(8);
insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t2
master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
insert into t1 values(9);
insert into t2 select * from t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Table_map 1 # test.t1
master-bin.000001 141 Write_rows 1 #
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
master-bin.000001 202 Table_map 1 # test.t2
master-bin.000001 241 Write_rows 1 #
delete from t1;
delete from t2;
reset master;
insert into t1 values(10);
begin;
insert into t2 select * from t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Table_map 1 # test.t1
master-bin.000001 141 Write_rows 1 #
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
master-bin.000001 202 Table_map 1 # test.t2
master-bin.000001 241 Write_rows 1 #
insert into t1 values(11);
commit;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Table_map 1 # test.t1
master-bin.000001 141 Write_rows 1 #
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
master-bin.000001 202 Table_map 1 # test.t2
master-bin.000001 241 Write_rows 1 #
master-bin.000001 275 Query 1 # use `test`; BEGIN
master-bin.000001 343 Table_map 1 # test.t1
master-bin.000001 382 Write_rows 1 #
master-bin.000001 416 Xid 1 # COMMIT /* xid= */
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(12);
insert into t2 select * from t1;
commit;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t2
master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(13);
insert into t2 select * from t1;
rollback;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(14);
savepoint my_savepoint;
insert into t1 values(15);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(16);
savepoint my_savepoint;
insert into t1 values(17);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
insert into t1 values(18);
commit;
select a from t1 order by a;
a
16
18
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t1
master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
insert into t1 values (1);
begin;
select * from t1 for update;
a
1
select (@before:=unix_timestamp())*0;
(@before:=unix_timestamp())*0
0
begin;
select * from t1 for update;
insert into t2 values (20);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select (@after:=unix_timestamp())*0;
(@after:=unix_timestamp())*0
0
select (@after-@before) >= 2;
(@after-@before) >= 2
1
drop table t1,t2;
commit;
begin;
create temporary table ti (a int) engine=innodb;
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into ti values(1);
set autocommit=0;
create temporary table t1 (a int) engine=myisam;
commit;
insert t1 values (1);
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
insert into t0 select GET_LOCK("lock1",null);
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
select get_lock("lock1",60);
get_lock("lock1",60)
1
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 # use `test`; BEGIN
master-bin.000001 170 Table_map 1 # test.t1
master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t1
master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
master-bin.000001 343 Table_map 1 # test.t1
master-bin.000001 382 Delete_rows 1 #
master-bin.000001 421 Xid 1 # COMMIT /* xid= */
master-bin.000001 448 Query 1 # use `test`; alter table t2 type=MyISAM
master-bin.000001 537 Table_map 1 # test.t1
master-bin.000001 576 Write_rows 1 #
master-bin.000001 610 Xid 1 # COMMIT /* xid= */
master-bin.000001 637 Table_map 1 # test.t2
master-bin.000001 676 Write_rows 1 #
master-bin.000001 710 Query 1 # use `test`; drop table t1,t2
master-bin.000001 789 Query 1 # use `test`; create table t0 (n int)
master-bin.000001 875 Table_map 1 # test.t0
master-bin.000001 914 Write_rows 1 #
master-bin.000001 948 Table_map 1 # test.t0
master-bin.000001 987 Write_rows 1 #
master-bin.000001 1021 Query 1 # use `test`; create table t2 (n int) engine=innodb
do release_lock("lock1");
drop table t0,t2;
......@@ -8,7 +8,7 @@ commit;
begin;
insert t2 values (5);
commit;
show binlog events from 98;
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) engine=bdb
master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb
......@@ -17,14 +17,14 @@ master-bin.000001 # Query 1 # use `test`; insert t1 values (5)
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Query 1 # use `test`; insert t2 values (5)
master-bin.000001 # Xid 1 # COMMIT /* xid=11 */
master-bin.000001 # Xid 1 # COMMIT /* xid= */
drop table t1,t2;
reset master;
create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
show binlog events in 'master-bin.000001' from 98;
show binlog events in 'master-bin.000001' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
master-bin.000001 # Query 1 # use `test`; BEGIN
......@@ -128,8 +128,8 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(4 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(3 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4)
master-bin.000001 # Xid 1 # COMMIT /* xid=18 */
master-bin.000001 # Xid 1 # COMMIT /* xid= */
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002' from 98;
show binlog events in 'master-bin.000002' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
......@@ -11320,11 +11320,11 @@ CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 98;
SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 185 use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 185 User var 1 224 @`var1`=_binary 0x8300 COLLATE binary
master-bin.000001 224 Query 1 317 use `test`; INSERT INTO t1 VALUES(@'var1')
master-bin.000001 102 Query 1 189 use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 189 User var 1 228 @`var1`=_binary 0x8300 COLLATE binary
master-bin.000001 228 Query 1 321 use `test`; INSERT INTO t1 VALUES(@'var1')
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
......
......@@ -3,10 +3,10 @@ create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
show binlog events from 98;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 User var 1 138 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 138 Query 1 227 use `test`; insert into t2 values (@v)
master-bin.000001 102 User var 1 142 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 142 Query 1 231 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
......
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 0
drop table if exists t1;
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 1
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size";
Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 2000
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 2000
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 0
......@@ -7,8 +7,8 @@ insert into t1 select * from t2;
ERROR 23000: Duplicate entry '2' for key 1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
master-bin.000001 98 Query 1 192 use `test`; insert into t1 select * from t2
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 196 use `test`; insert into t1 select * from t2
select * from t1;
a
1
......@@ -21,5 +21,5 @@ create table t2(unique(a)) select a from t1;
ERROR 23000: Duplicate entry '1' for key 1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
drop table t1;
......@@ -6,11 +6,11 @@ CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 98;
SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 185 use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 185 User var 1 224 @`var1`=_binary 0x8300 COLLATE binary
master-bin.000001 224 Query 1 317 use `test`; INSERT INTO t1 VALUES(@'var1')
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
......
drop table if exists t1;
set names cp932;
set character_set_database = cp932;
RESET MASTER;
CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
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(f1 blob)
master-bin.000001 # User var 1 # @`var1`=_binary 0x8300 COLLATE binary
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES(@'var1')
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
DROP table t1;
drop table if exists t1;
SHOW GLOBAL VARIABLES LIKE "%_format%";
Variable_name Value
binlog_format <format>
date_format %d.%m.%Y
datetime_format %Y-%m-%d %H:%i:%s
default_week_format 0
time_format %H.%i.%s
SHOW SESSION VARIABLES LIKE "%_format%";
Variable_name Value
binlog_format <format>
date_format %d.%m.%Y
datetime_format %Y-%m-%d %H:%i:%s
default_week_format 0
......@@ -30,6 +32,7 @@ set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
SHOW SESSION VARIABLES LIKE "%format";
Variable_name Value
binlog_format <format>
date_format %m-%d-%Y
datetime_format %h:%i:%s.%f %p %Y-%m-%d
default_week_format 0
......
......@@ -44,11 +44,11 @@ insert t1 values (1);
flush tables with read lock;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
master-bin.000001 102
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
master-bin.000001 102
unlock tables;
drop table t1;
set autocommit=1;
Variable_name Value
binlog_format ROW
Variable_name Value
binlog_format STATEMENT
Variable_name Value
have_row_based_replication YES
......@@ -1640,29 +1640,6 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 155
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 0
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 156
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 157
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
create table t1 (c char(10), index (c,c)) engine=innodb;
ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
......@@ -1774,21 +1751,6 @@ select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size";
Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 31727
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 29530
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0
......
This diff is collapsed.
This diff is collapsed.
Variable_name Value
have_row_based_replication NO
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment