diff options
Diffstat (limited to 'mysql-test')
139 files changed, 5633 insertions, 742 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 8ddf7668844..5aaddf36aa3 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -43,6 +43,8 @@ dist-hook: $(distdir)/r \ $(distdir)/include \ $(distdir)/std_data \ + $(distdir)/std_data/ndb_backup50 \ + $(distdir)/std_data/ndb_backup51 \ $(distdir)/lib -$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t @@ -63,6 +65,8 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50 + $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51 $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib @@ -74,6 +78,8 @@ install-data-local: $(DESTDIR)$(testdir)/r \ $(DESTDIR)$(testdir)/include \ $(DESTDIR)$(testdir)/std_data \ + $(DESTDIR)$(testdir)/std_data/ndb_backup50 \ + $(DESTDIR)$(testdir)/std_data/ndb_backup51 \ $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir) -$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t @@ -98,6 +104,8 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50 + $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51 $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test index 2582a901b3b..64df1f272cc 100644 --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -66,7 +66,9 @@ select * from t2; # check that no error is reported --replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; +--horizontal_results # 2) Test lock wait timeout @@ -81,9 +83,11 @@ sync_with_master; select * from t1; # check that slave succeeded finally select * from t2; # check that no error is reported ---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # +--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; +--horizontal_results # Now we repeat 2), but with BEGIN in the same relay log as # COMMIT (to see if seeking into hot log is ok). @@ -103,7 +107,9 @@ select * from t1; select * from t2; --replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; +--horizontal_results connection master; drop table t1,t2,t3,t4; diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index a832076fbe2..304fade7e1d 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -86,3 +86,73 @@ INSERT INTO t1 VALUES (1),(1); sync_slave_with_master; # End of 4.1 tests + + +# +# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0 +# +# The solution is not to reset last_insert_id on enter to sub-statement. +# +connection master; +--disable_warnings +drop function if exists bug15728; +drop function if exists bug15728_insert; +drop table if exists t1, t2; +--enable_warnings + +create table t1 ( + id int not null auto_increment, + last_id int, + primary key (id) +); +create function bug15728() returns int(11) + return last_insert_id(); + +insert into t1 (last_id) values (0); +insert into t1 (last_id) values (last_insert_id()); +insert into t1 (last_id) values (bug15728()); + +# Check that nested call replicates too. +create table t2 ( + id int not null auto_increment, + last_id int, + primary key (id) +); +delimiter |; +create function bug15728_insert() returns int(11) modifies sql data +begin + insert into t2 (last_id) values (bug15728()); + return bug15728(); +end| +create trigger t1_bi before insert on t1 for each row +begin + declare res int; + select bug15728_insert() into res; + set NEW.last_id = res; +end| +delimiter ;| + +insert into t1 (last_id) values (0); + +drop trigger t1_bi; + +# Check that nested call doesn't affect outer context. +select last_insert_id(); +select bug15728_insert(); +select last_insert_id(); +insert into t1 (last_id) values (bug15728()); +# This should be exactly one greater than in the previous call. +select last_insert_id(); + +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +select * from t2; +connection master; + +drop function bug15728; +drop function bug15728_insert; +drop table t1, t2; + +# End of 5.0 tests diff --git a/mysql-test/include/have_case_sensitive_file_system.inc b/mysql-test/include/have_case_sensitive_file_system.inc new file mode 100644 index 00000000000..730af975497 --- /dev/null +++ b/mysql-test/include/have_case_sensitive_file_system.inc @@ -0,0 +1,4 @@ +--require r/case_sensitive_file_system.require +--disable_query_log +show variables like "lower_case_file_system"; +--enable_query_log diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index 28fcf18cb16..721d79392b7 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -1,6 +1,13 @@ ---exec test x$NDB_STATUS_OK = x1 +# Check that server is compiled and started with support for NDB -- require r/have_ndb.require disable_query_log; show variables like "have_ndbcluster"; enable_query_log; +# Check that NDB is installed and known to be working +-- require r/have_ndb_status_ok.require +disable_query_log; +eval select "$NDB_STATUS_OK" as ndb_status_ok; +enable_query_log; + + diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index 5ed1c587385..42b9942f74d 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -4,11 +4,13 @@ # --require r/have_udf.require disable_query_log; -show variables like "have_dlopen"; +show variables like "have_dynamic_loading"; enable_query_log; # -# Check that the "udf_example.so" file has been created +# Check if the variable UDF_EXAMPLE_LIB is set # - -# TODO +--require r/have_udf_example.require +disable_query_log; +eval select LENGTH("$UDF_EXAMPLE_LIB") > 0 as "have_udf_example_lib"; +enable_query_log; diff --git a/mysql-test/include/not_as_root.inc b/mysql-test/include/not_as_root.inc new file mode 100644 index 00000000000..e0277ea593e --- /dev/null +++ b/mysql-test/include/not_as_root.inc @@ -0,0 +1,4 @@ +-- require r/not_as_root.require +disable_query_log; +eval select "$MYSQL_TEST_ROOT" as running_as_root; +enable_query_log; diff --git a/mysql-test/include/rpl_multi_engine3.inc b/mysql-test/include/rpl_multi_engine3.inc index cc1b3f13025..5d8f7e46409 100644 --- a/mysql-test/include/rpl_multi_engine3.inc +++ b/mysql-test/include/rpl_multi_engine3.inc @@ -28,6 +28,7 @@ INSERT INTO t1 VALUES(412,1,'Testing MySQL databases is a cool ', select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; sync_slave_with_master; +--sleep 5 --echo --- Select from t1 on slave --- select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -41,9 +42,9 @@ SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; # Must give injector thread a little time to get update # into the binlog other wise we will miss the update. -sleep 10; sync_slave_with_master; +--sleep 5 --echo --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; @@ -55,6 +56,7 @@ DELETE FROM t1 WHERE id = 42; SELECT COUNT(*) FROM t1; sync_slave_with_master; +--sleep 5 --echo --- Show current count on slave for t1 --- SELECT COUNT(*) FROM t1; diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 5b2fd5c6df6..b5a2e5a4a68 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -12,6 +12,7 @@ sub mtr_init_args ($); sub mtr_add_arg ($$@); sub mtr_path_exists(@); sub mtr_script_exists(@); +sub mtr_file_exists(@); sub mtr_exe_exists(@); sub mtr_copy_dir($$); sub mtr_same_opts($$); @@ -94,6 +95,14 @@ sub mtr_script_exists (@) { } } +sub mtr_file_exists (@) { + foreach my $path ( @_ ) + { + return $path if -e $path; + } + return ""; +} + sub mtr_exe_exists (@) { my @path= @_; map {$_.= ".exe"} @path if $::glob_win32; @@ -111,18 +120,27 @@ sub mtr_exe_exists (@) { } } + sub mtr_copy_dir($$) { - my $srcdir= shift; - my $dstdir= shift; + my $from_dir= shift; + my $to_dir= shift; + + mkpath("$to_dir"); + opendir(DIR, "$from_dir") + or mtr_error("Can't find $from_dir$!"); + for(readdir(DIR)) { + next if "$_" eq "." or "$_" eq ".."; + if ( -d "$from_dir/$_" ) + { + mtr_copy_dir("$from_dir/$_", "$to_dir/$_"); + next; + } + copy("$from_dir/$_", "$to_dir/$_"); + } + closedir(DIR); - # Create destination directory - mkpath($dstdir); - find(\&mtr_copy_one_file, $dstdir); } -sub mtr_copy_one_file { - print $File::Find::name, "\n"; -} sub mtr_same_opts ($$) { my $l1= shift; diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 779be3d7081..a3fb7ec0183 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -672,12 +672,15 @@ sub mtr_mysqladmin_shutdown { # Shutdown time must be high as slave may be in reconnect mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "shutdown"); + my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log"; # Start mysqladmin in paralell and wait for termination later my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", $::path_manager_log, $::path_manager_log, "", + "", $path_mysqladmin_log, $path_mysqladmin_log, "", { append_log_file => 1 }); # Save the pid of the mysqladmin process $mysql_admin_pids{$pid}= 1; + + # We don't wait for termination of mysqladmin } # Wait for all the started mysqladmin to exit @@ -720,8 +723,6 @@ sub mtr_mysqladmin_shutdown { $timeout or mtr_debug("At least one server is still listening to its port"); - sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep - return $res; } @@ -821,8 +822,10 @@ sub sleep_until_file_created ($$$) { my $pidfile= shift; my $timeout= shift; my $pid= shift; + my $sleeptime= 100; # Milliseconds + my $loops= ($timeout * 1000) / $sleeptime; - for ( my $loop= 1; $loop <= $timeout; $loop++ ) + for ( my $loop= 1; $loop <= $loops; $loop++ ) { if ( -r $pidfile ) { @@ -835,16 +838,20 @@ sub sleep_until_file_created ($$$) { return 0; } - mtr_debug("Sleep 1 second waiting for creation of $pidfile"); + mtr_debug("Sleep $sleeptime milliseconds waiting for ". + "creation of $pidfile"); - if ( $loop % 60 == 0 ) + # Print extra message every 60 seconds + my $seconds= ($loop * $sleeptime) / 1000; + if ( $seconds > 1 and $seconds % 60 == 0 ) { - my $left= $timeout - $loop; - mtr_warning("Waited $loop seconds for $pidfile to be created, " . + my $left= $timeout - $seconds; + mtr_warning("Waited $seconds seconds for $pidfile to be created, " . "still waiting for $left seconds..."); } - sleep(1); + # Millisceond sleep emulated with select + select(undef, undef, undef, ($sleeptime/1000)); } return 0; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a9a1d46079c..30ac61c80e8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -158,9 +158,9 @@ our $path_client_bindir; our $path_language; our $path_timefile; our $path_snapshot; -our $path_manager_log; # Used by mysqldadmin our $path_slave_load_tmpdir; # What is this?! our $path_mysqltest_log; +our $path_current_test_log; our $path_my_basedir; our $opt_vardir; # A path but set directly on cmd line our $opt_vardir_trace; # unix formatted opt_vardir for trace files @@ -191,6 +191,7 @@ our $exe_mysqltest; our $exe_slave_mysqld; our $exe_im; our $exe_my_print_defaults; +our $lib_udf_example; our $opt_bench= 0; our $opt_small_bench= 0; @@ -207,7 +208,6 @@ our $opt_sp_protocol; our $opt_cursor_protocol; our $opt_view_protocol; -our $opt_current_test; our $opt_debug; our $opt_do_test; our @opt_cases; # The test cases names in argv @@ -250,9 +250,6 @@ our $opt_ndbconnectstring; our $opt_ndbcluster_port_slave; our $opt_ndbconnectstring_slave; -our $opt_no_manager; # Does nothing now, we never use manager -our $opt_manager_port; # Does nothing now, we never use manager - our $opt_old_master; our $opt_record; @@ -262,6 +259,7 @@ our $opt_result_ext; our $opt_skip; our $opt_skip_rpl; +our $use_slaves; our $opt_skip_test; our $opt_skip_im; @@ -321,6 +319,8 @@ our $opt_with_ndbcluster_slave; our $opt_with_ndbcluster_all= 0; our $opt_with_ndbcluster_only= 0; our $opt_ndb_extra_test= 0; +our $opt_skip_master_binlog= 0; +our $opt_skip_slave_binlog= 0; our $exe_ndb_mgm; our $path_ndb_tools_dir; @@ -341,11 +341,13 @@ our @data_dir_lst; sub main (); sub initial_setup (); sub command_line_setup (); +sub snapshot_setup (); sub executable_setup (); sub environment_setup (); sub kill_running_server (); sub kill_and_cleanup (); sub check_ssl_support (); +sub check_running_as_root(); sub check_ndbcluster_support (); sub rm_ndbcluster_tables ($); sub ndbcluster_install (); @@ -355,7 +357,7 @@ sub ndbcluster_install_slave (); sub ndbcluster_start_slave ($); sub ndbcluster_stop_slave (); sub run_benchmarks ($); -sub run_tests (); +sub initialize_servers (); sub mysql_install_db (); sub install_db ($$); sub run_testcase ($); @@ -386,8 +388,9 @@ sub main () { command_line_setup(); executable_setup(); - check_ndbcluster_support(); + check_ndbcluster_support(); # We check whether to actually use it later check_ssl_support(); + check_running_as_root(); environment_setup(); signal_setup(); @@ -402,49 +405,37 @@ sub main () { gprof_prepare(); } - if ( ! $glob_use_running_server ) - { - if ( $opt_start_dirty ) - { - kill_running_server(); - } - else - { - kill_and_cleanup(); - mysql_install_db(); - if ( $opt_force ) - { - save_installed_db(); - } - } - } - - if ( $opt_start_dirty ) - { - if ( ndbcluster_start($opt_with_ndbcluster) ) - { - mtr_error("Can't start ndbcluster"); - } - if ( mysqld_start('master',0,[],[],$using_ndbcluster_master) ) - { - mtr_report("Servers started, exiting"); - } - else - { - mtr_error("Can't start the mysqld server"); - } - } - elsif ( $opt_bench ) + if ( $opt_bench ) { + initialize_servers(); run_benchmarks(shift); # Shift what? Extra arguments?! } elsif ( $opt_stress ) { + initialize_servers(); run_stress_test() } else { - run_tests(); + # Figure out which tests we are going to run + my $tests= collect_test_cases($opt_suite); + + # Turn off NDB and other similar options if no tests use it + my ($need_ndbcluster,$need_im); + foreach my $test (@$tests) + { + $need_ndbcluster||= $test->{ndb_test}; + $need_im||= $test->{component_id} eq 'im'; + $use_slaves||= $test->{slave_num}; + } + $opt_with_ndbcluster= $opt_with_ndbcluster_slave= 0 + unless $need_ndbcluster; + $opt_skip_im= 1 unless $need_im; + + snapshot_setup(); + initialize_servers(); + + run_suite($opt_suite, $tests); } mtr_exit(0); @@ -587,7 +578,6 @@ sub command_line_setup () { 'compress' => \$opt_compress, 'bench' => \$opt_bench, 'small-bench' => \$opt_small_bench, - 'no-manager' => \$opt_no_manager, # Currently not used # Control what test suites or cases to run 'force' => \$opt_force, @@ -599,6 +589,8 @@ sub command_line_setup () { 'with-ndbcluster-all' => \$opt_with_ndbcluster_all, 'with-ndbcluster-only' => \$opt_with_ndbcluster_only, 'ndb-extra-test' => \$opt_ndb_extra_test, + 'skip-master-binlog' => \$opt_skip_master_binlog, + 'skip-slave-binlog' => \$opt_skip_slave_binlog, 'do-test=s' => \$opt_do_test, 'start-from=s' => \$opt_start_from, 'suite=s' => \$opt_suite, @@ -612,7 +604,6 @@ sub command_line_setup () { 'slave_port=i' => \$opt_slave_myport, 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port, 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave, - 'manager-port=i' => \$opt_manager_port, # Currently not used 'im-port=i' => \$im_port, # Instance Manager port. 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM @@ -746,11 +737,6 @@ sub command_line_setup () { $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any - # FIXME maybe not needed? - $path_manager_log= "$opt_vardir/log/manager.log" - unless $path_manager_log; - $opt_current_test= "$opt_vardir/log/current_test" - unless $opt_current_test; # -------------------------------------------------------------------------- # Do sanity checks of command line arguments @@ -990,22 +976,32 @@ sub command_line_setup () { $path_timefile= "$opt_vardir/log/mysqltest-time"; $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; + $path_current_test_log= "$opt_vardir/log/current_test"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; +} + +sub snapshot_setup () { # Make a list of all data_dirs @data_dir_lst = ( $master->[0]->{'path_myddir'}, - $master->[1]->{'path_myddir'}, - $slave->[0]->{'path_myddir'}, - $slave->[1]->{'path_myddir'}, - $slave->[2]->{'path_myddir'}); + $master->[1]->{'path_myddir'}); - foreach my $instance (@{$instance_manager->{'instances'}}) + if ($use_slaves) { - push(@data_dir_lst, $instance->{'path_datadir'}); + push @data_dir_lst, ($slave->[0]->{'path_myddir'}, + $slave->[1]->{'path_myddir'}, + $slave->[2]->{'path_myddir'}); } + unless ($opt_skip_im) + { + foreach my $instance (@{$instance_manager->{'instances'}}) + { + push(@data_dir_lst, $instance->{'path_datadir'}); + } + } } @@ -1087,6 +1083,8 @@ sub executable_setup () { "/usr/bin/false"); $path_ndb_tools_dir= mtr_path_exists("$glob_basedir/storage/ndb/tools"); $exe_ndb_mgm= "$glob_basedir/storage/ndb/src/mgmclient/ndb_mgm"; + $lib_udf_example= + mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so"); } else { @@ -1184,7 +1182,7 @@ sub environment_setup () { # Add the path where mysqld will find udf_example.so # -------------------------------------------------------------------------- $ENV{'LD_LIBRARY_PATH'}= - "$glob_basedir/sql/.libs" . + ($lib_udf_example ? dirname($lib_udf_example) : "") . ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); @@ -1211,6 +1209,7 @@ sub environment_setup () { $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; $ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave; + $ENV{'NDB_STATUS_OK'}= "YES"; $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; $ENV{'IM_PORT'}= $instance_manager->{port}; @@ -1250,6 +1249,7 @@ sub signal_setup () { $SIG{INT}= \&handle_int_signal; } + sub handle_int_signal () { $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die... mtr_warning("got INT signal, cleaning up....."); @@ -1369,6 +1369,33 @@ sub kill_and_cleanup () { } +sub check_running_as_root () { + # Check if running as root + # i.e a file can be read regardless what mode we set it to + my $test_file= "test_running_as_root.txt"; + mtr_tofile($test_file, "MySQL"); + chmod(oct("0000"), $test_file); + + my $result=""; + if (open(FILE,"<",$test_file)) + { + $result= join('', <FILE>); + close FILE; + } + + chmod(oct("0755"), $test_file); + unlink($test_file); + + $ENV{'MYSQL_TEST_ROOT'}= "NO"; + if ($result eq "MySQL") + { + mtr_warning("running this script as _root_ will cause some " . + "tests to be skipped"); + $ENV{'MYSQL_TEST_ROOT'}= "YES"; + } +} + + sub check_ssl_support () { @@ -1436,7 +1463,7 @@ sub check_ndbcluster_support () { return; } - mtr_report("Using ndbcluster, mysqld supports it"); + mtr_report("Using ndbcluster if necessary, mysqld supports it"); $opt_with_ndbcluster= 1; if ( $opt_ndbconnectstring ) { @@ -1467,7 +1494,6 @@ sub check_ndbcluster_support () { return; } -# FIXME why is there a different start below?! sub ndbcluster_install () { @@ -1497,6 +1523,7 @@ sub ndbcluster_install () { return 0; } + sub ndbcluster_start ($) { my $use_ndbcluster= shift; @@ -1520,6 +1547,7 @@ sub ndbcluster_start ($) { if ( mtr_run("$glob_mysql_test_dir/ndb/ndbcluster", ["--port=$opt_ndbcluster_port", "--data-dir=$opt_vardir", + "--character-sets-dir=$path_charsetsdir", "--verbose=2", "--core"], "", "/dev/null", "", "") ) @@ -1723,12 +1751,9 @@ sub run_benchmarks ($) { # FIXME how to specify several suites to run? Comma separated list? -sub run_tests () { - run_suite($opt_suite); -} sub run_suite () { - my $suite= shift; + my ($suite, $tests)= @_; mtr_print_thick_line(); @@ -1736,8 +1761,6 @@ sub run_suite () { mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout); - my $tests= collect_test_cases($suite); - mtr_report("Starting Tests in the '$suite' suite"); mtr_print_header(); @@ -1779,14 +1802,37 @@ sub run_suite () { # ############################################################################## +sub initialize_servers () { + if ( ! $glob_use_running_server ) + { + if ( $opt_start_dirty ) + { + kill_running_server(); + } + else + { + kill_and_cleanup(); + mysql_install_db(); + if ( $opt_force ) + { + save_installed_db(); + } + } + } +} + sub mysql_install_db () { # FIXME not exactly true I think, needs improvements install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[1]->{'path_myddir'}); - install_db('slave', $slave->[0]->{'path_myddir'}); - install_db('slave', $slave->[1]->{'path_myddir'}); - install_db('slave', $slave->[2]->{'path_myddir'}); + + if ( $use_slaves ) + { + install_db('slave', $slave->[0]->{'path_myddir'}); + install_db('slave', $slave->[1]->{'path_myddir'}); + install_db('slave', $slave->[2]->{'path_myddir'}); + } if ( ! $opt_skip_im ) { @@ -1801,6 +1847,7 @@ sub mysql_install_db () { mtr_report("ndbcluster_install failed, continuing without cluster"); $opt_with_ndbcluster= 0; $flag_ndb_status_ok= 0; + $ENV{'NDB_STATUS_OK'}= "NO"; } else { @@ -1840,7 +1887,7 @@ sub install_db ($$) { my $init_db_sql_tmp= "/tmp/init_db.sql$$"; my $args; - mtr_report("Installing \u$type Databases"); + mtr_report("Installing \u$type Database"); open(IN, $init_db_sql) or mtr_error("Can't open $init_db_sql: $!"); @@ -1884,8 +1931,15 @@ sub install_db ($$) { mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); } + # Log bootstrap command + my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; + mtr_tofile($path_bootstrap_log, + "$exe_mysqld " . join(" ", @$args) . "\n"); + if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp, - $path_manager_log, $path_manager_log, "") != 0 ) + $path_bootstrap_log, $path_bootstrap_log, + "", { append_log_file => 1 }) != 0 ) + { unlink($init_db_sql_tmp); mtr_error("Error executing mysqld --bootstrap\n" . @@ -1907,15 +1961,15 @@ sub im_create_passwd_file($) { my $instance_manager = shift; my $pwd_file_path = $instance_manager->{'password_file'}; - + mtr_report("Creating IM password file ($pwd_file_path)"); - + open(OUT, ">", $pwd_file_path) or mtr_error("Can't write to $pwd_file_path: $!"); - + print OUT $instance_manager->{'admin_login'}, ":", $instance_manager->{'admin_sha1'}, "\n"; - + close(OUT); } @@ -1927,7 +1981,7 @@ sub im_create_defaults_file($) { open(OUT, ">", $defaults_file) or mtr_error("Can't write to $defaults_file: $!"); - + print OUT <<EOF [mysql] @@ -2009,7 +2063,7 @@ sub run_testcase ($) { my $ndbcluster_opt; - mtr_tonewfile($opt_current_test,"$tname\n"); # Always tell where we are + mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are # output current test to ndbcluster log file to enable diagnostics mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); @@ -2088,7 +2142,7 @@ sub run_testcase ($) { # ---------------------------------------------------------------------- stop_slaves(); - } + } # ---------------------------------------------------------------------- # Prepare to start masters. Even if we use embedded, we want to run @@ -2105,9 +2159,9 @@ sub run_testcase ($) { mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); } -# FIXME test cases that depend on each other, prevent this from -# being at this location. -# do_before_start_master($tname,$tinfo->{'master_sh'}); + # FIXME test cases that depend on each other, prevent this from + # being at this location. + # do_before_start_master($tname,$tinfo->{'master_sh'}); # ---------------------------------------------------------------------- # If any mysqld servers running died, we have to know @@ -2157,6 +2211,14 @@ sub run_testcase ($) { if ( $using_ndbcluster_master and ! $master->[1]->{'pid'} ) { # Test needs cluster, start an extra mysqld connected to cluster + # First wait for first mysql server to have created ndb system tables ok + if ( ! sleep_until_file_created("$master->[0]->{'path_myddir'}/cluster/apply_status.ndb", + $master->[0]->{'start_timeout'}, + $master->[0]->{'pid'})) + { + report_failure_and_restart($tinfo); + return; + } mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); $master->[1]->{'pid'}= mysqld_start('master',1,$tinfo->{'master_opt'},[], @@ -2230,10 +2292,11 @@ sub run_testcase ($) { } # ---------------------------------------------------------------------- - # If --start-and-exit given, stop here to let user manually run tests + # If --start-and-exit or --start-dirty given, stop here to let user manually + # run tests # ---------------------------------------------------------------------- - if ( $opt_start_and_exit ) + if ( $opt_start_and_exit or $opt_start_dirty ) { mtr_report("\nServers started, exiting"); exit(0); @@ -2299,25 +2362,6 @@ sub run_testcase ($) { } } -sub copy_dir($$) { - my $from_dir= shift; - my $to_dir= shift; - - mkpath("$to_dir"); - opendir(DIR, "$from_dir") - or mtr_error("Can't find $from_dir$!"); - for(readdir(DIR)) { - next if "$_" eq "." or "$_" eq ".."; - if ( -d "$from_dir/$_" ) - { - copy_dir("$from_dir/$_", "$to_dir/$_"); - next; - } - copy("$from_dir/$_", "$to_dir/$_"); - } - closedir(DIR); - -} # # Save a snapshot of the installed test db(s) @@ -2331,7 +2375,7 @@ sub save_installed_db () { foreach my $data_dir (@data_dir_lst) { my $name= basename($data_dir); - copy_dir("$data_dir", "$path_snapshot/$name"); + mtr_copy_dir("$data_dir", "$path_snapshot/$name"); } } @@ -2355,6 +2399,7 @@ sub save_files_before_restore($$) { } } + # # Restore snapshot of the installed test db(s) # if the snapshot exists @@ -2373,7 +2418,7 @@ sub restore_installed_db ($) { my $name= basename($data_dir); save_files_before_restore($test_name, $data_dir); rmtree("$data_dir"); - copy_dir("$path_snapshot/$name", "$data_dir"); + mtr_copy_dir("$path_snapshot/$name", "$data_dir"); } if ($opt_with_ndbcluster) { @@ -2430,9 +2475,9 @@ sub report_failure_and_restart ($) { # ############################################################################## + # The embedded server needs the cleanup so we do some of the start work # but stop before actually running mysqld or anything. - sub do_before_start_master ($$) { my $tname= shift; my $init_script= shift; @@ -2465,13 +2510,14 @@ sub do_before_start_master ($$) { if ( $ret != 0 ) { # FIXME rewrite those scripts to return 0 if successful -# mtr_warning("$init_script exited with code $ret"); + # mtr_warning("$init_script exited with code $ret"); } } # for gcov FIXME needed? If so we need more absolute paths -# chdir($glob_basedir); + # chdir($glob_basedir); } + sub do_before_start_slave ($$) { my $tname= shift; my $init_script= shift; @@ -2499,7 +2545,7 @@ sub do_before_start_slave ($$) { if ( $ret != 0 ) { # FIXME rewrite those scripts to return 0 if successful -# mtr_warning("$init_script exited with code $ret"); + # mtr_warning("$init_script exited with code $ret"); } } @@ -2509,6 +2555,7 @@ sub do_before_start_slave ($$) { } } + sub mysqld_arguments ($$$$$$) { my $args= shift; my $type= shift; # master/slave/bootstrap @@ -2555,8 +2602,11 @@ sub mysqld_arguments ($$$$$$) { { my $id= $idx > 0 ? $idx + 101 : 1; - mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix, - $opt_vardir, $sidx); + if (! $opt_skip_master_binlog) + { + mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix, + $opt_vardir, $sidx); + } mtr_add_arg($args, "%s--pid-file=%s", $prefix, $master->[$idx]->{'path_mypid'}); mtr_add_arg($args, "%s--port=%d", $prefix, @@ -2597,9 +2647,12 @@ sub mysqld_arguments ($$$$$$) { # FIXME slave get this option twice?! mtr_add_arg($args, "%s--exit-info=256", $prefix); mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix); - mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix, - $opt_vardir, $sidx); # FIXME use own dir for binlogs - mtr_add_arg($args, "%s--log-slave-updates", $prefix); + if (! $opt_skip_slave_binlog) + { + mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix, + $opt_vardir, $sidx); # FIXME use own dir for binlogs + mtr_add_arg($args, "%s--log-slave-updates", $prefix); + } # FIXME option duplicated for slave mtr_add_arg($args, "%s--log=%s", $prefix, $slave->[$idx]->{'path_mylog'}); @@ -2747,14 +2800,6 @@ sub mysqld_arguments ($$$$$$) { return $args; } -# FIXME -# if ( $type eq 'master' and $glob_use_embedded_server ) -# { -# # Add a -A to each argument to pass it to embedded server -# my @mysqltest_opt= map {("-A",$_)} @args; -# $opt_extra_mysqltest_opt= \@mysqltest_opt; -# return; -# } ############################################################################## # @@ -2854,6 +2899,7 @@ sub mysqld_start ($$$$$) { return 0; } + sub stop_masters_slaves () { print "Ending Tests\n"; @@ -2863,7 +2909,7 @@ sub stop_masters_slaves () { print "Shutting-down Instance Manager\n"; im_stop($instance_manager); } - + print "Shutting-down MySQL daemon\n\n"; stop_masters(); print "Master(s) shutdown finished\n"; @@ -2871,6 +2917,7 @@ sub stop_masters_slaves () { print "Slave(s) shutdown finished\n"; } + sub stop_masters () { my @args; @@ -2900,6 +2947,7 @@ sub stop_masters () { mtr_stop_mysqld_servers(\@args); } + sub stop_slaves () { my $force= shift; @@ -2954,7 +3002,7 @@ sub im_start($$) { mtr_add_arg($args, $opt); } - $instance_manager->{'pid'} = + $instance_manager->{'pid'} = mtr_spawn( $exe_im, # path to the executable $args, # cmd-line args @@ -2970,7 +3018,7 @@ sub im_start($$) { mtr_report('Could not start Instance Manager'); return; } - + # Instance Manager can be run in daemon mode. In this case, it creates # several processes and the parent process, created by mtr_spawn(), exits just # after start. So, we have to obtain Instance Manager PID from the PID file. @@ -2988,6 +3036,7 @@ sub im_start($$) { mtr_get_pid_from_file($instance_manager->{'path_pid'}); } + sub im_stop($) { my $instance_manager = shift; @@ -3022,12 +3071,13 @@ sub im_stop($) { # Kill processes. mtr_kill_processes(\@pids); - + stop_reap_all(); $instance_manager->{'pid'} = undef; } + # # Run include/check-testcase.test # Before a testcase, run in record mode, save result file to var @@ -3076,6 +3126,7 @@ sub run_check_testcase ($) { } } + sub run_mysqltest ($) { my $tinfo= shift; @@ -3169,11 +3220,6 @@ sub run_mysqltest ($) { "--port=$master->[0]->{'path_myport'} " . "--socket=$master->[0]->{'path_mysock'}"; - - - # FIXME really needing a PATH??? - # $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}"; - $ENV{'MYSQL'}= $cmdline_mysql; $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; @@ -3186,9 +3232,11 @@ sub run_mysqltest ($) { $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test; $ENV{'CHARSETSDIR'}= $path_charsetsdir; $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults; + $ENV{'UDF_EXAMPLE_LIB'}= + ($lib_udf_example ? basename($lib_udf_example) : ""); - $ENV{'NDB_STATUS_OK'}= $flag_ndb_status_ok; - $ENV{'NDB_SLAVE_STATUS_OK'}= $flag_ndb_slave_status_ok; + $ENV{'NDB_STATUS_OK'}= $flag_ndb_status_ok ? "YES" : "NO"; + $ENV{'NDB_SLAVE_STATUS_OK'}= $flag_ndb_slave_status_ok ? "YES" : "NO"; $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; $ENV{'NDB_MGM'}= $exe_ndb_mgm; $ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir; @@ -3441,6 +3489,7 @@ sub gdb_arguments { $$exe= "xterm"; } + # # Modify the exe and args so that program is run in ddd # @@ -3472,8 +3521,7 @@ sub ddd_arguments { "break mysql_parse\n" . "commands 1\n" . "disable 1\n" . - "end\n" . - "run"); + "end"); } if ( $opt_manual_ddd ) @@ -3561,7 +3609,7 @@ sub valgrind_arguments { if ( $opt_valgrind_options ) { - mtr_add_arg($args, split(' ', $opt_valgrind_options)); + mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); } @@ -3681,11 +3729,12 @@ Misc options comment=STR Write STR to the output notimer Don't show test case execution time script-debug Debug this script itself - start-and-exit Only initiate and start the "mysqld" servers, use - the startup settings for the specified test case if any - start-dirty Only start the "mysqld" servers without initiation - fast Don't try to cleanup from earlier runs - reorder Reorder tests to get less server restarts + start-and-exit Only initialize and start the servers, using the + startup settings for the specified test case (if any) + start-dirty Only start the servers (without initialization) for + the specified test case (if any) + fast Don't try to clean up from earlier runs + reorder Reorder tests to get fewer server restarts help Get this help text unified-diff | udiff When presenting differences, use unified diff diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index aad71f89ef2..7e1ae58a406 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -669,7 +669,9 @@ fi [ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp [ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run [ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log -if ! test -L $MYSQL_TEST_DIR/var/std_data_ln ; then + +# Use 'test', not '[' as the shell builtin might not have '-L +if test ! -L "$MYSQL_TEST_DIR/var/std_data_ln" ; then ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln fi @@ -1230,7 +1232,7 @@ start_ndbcluster() then NDBCLUSTER_EXTRA_OPTS="--small" fi - OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core" + OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core" if [ "x$NDB_VERBOSE" != "x0" ] ; then echo "Starting master ndbcluster " $OPTS fi diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index 6812067a8ed..74f21fdef92 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -66,6 +66,7 @@ VERBOSE=100 NDB_MGM_EXTRA_OPTS= NDB_MGMD_EXTRA_OPTS= NDBD_EXTRA_OPTS= +CHARSETSDIR= while test $# -gt 0; do case "$1" in @@ -119,6 +120,9 @@ while test $# -gt 0; do --ndbd-extra-opts=*) NDBD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndbd-extra-opts=;;"` ;; + --character-sets-dir=*) + CHARSETSDIR=`echo "$1" | sed -e "s;--character-sets-dir=;;"` + ;; --core) opt_core="--core" ;; @@ -159,7 +163,7 @@ fi exec_mgmtclient="$exec_mgmtclient --no-defaults $opt_core $NDB_MGM_EXTRA_OPTS" exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $opt_core $NDB_MGMD_EXTRA_OPTS" -exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS" +exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR" exec_waiter="$exec_waiter --no-defaults $opt_core" ndb_host="localhost" @@ -260,7 +264,7 @@ done # test if Ndb Cluster starts properly if [ `expr $VERBOSE \> 1` = 1 ] ; then - echo "Waiting for started..." + echo "Waiting for NDB data nodes to start..." fi if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else if [ `expr $VERBOSE \> 0` = 1 ] ; then diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index d28c3af4e0b..9d2706f64fa 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -175,6 +175,14 @@ SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END; case+union+test case+union+test nobug +create table t1(a float, b int default 3); +insert into t1 (a) values (2), (11), (8); +select min(a), min(case when 1=1 then a else NULL end), +min(case when 1!=1 then NULL else a end) +from t1 where b=3 group by b; +min(a) min(case when 1=1 then a else NULL end) min(case when 1!=1 then NULL else a end) +2 2 2 +drop table t1; CREATE TABLE t1 (EMPNUM INT); INSERT INTO t1 VALUES (0), (2); CREATE TABLE t2 (EMPNUM DECIMAL (4, 2)); diff --git a/mysql-test/r/case_sensitive_file_system.require b/mysql-test/r/case_sensitive_file_system.require new file mode 100644 index 00000000000..d0bdc6bf4ce --- /dev/null +++ b/mysql-test/r/case_sensitive_file_system.require @@ -0,0 +1,2 @@ +Variable_name Value +lower_case_file_system OFF diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result index 2b3765c07c4..5b607872737 100644 --- a/mysql-test/r/ctype_latin2_ch.result +++ b/mysql-test/r/ctype_latin2_ch.result @@ -28,3 +28,4 @@ select * from t1 ignore index (primary) where tt like 'AA%'; id tt select * from t1 where tt like '%AA%'; id tt +drop table t1; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index e58aaa4554f..62e2085ae09 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -674,6 +674,18 @@ Warnings: Warning 1264 Out of range value for column 'Field1' at row 1 DROP TABLE t1; SET NAMES latin1; +SELECT CONVERT(103, CHAR(50) UNICODE); +CONVERT(103, CHAR(50) UNICODE) +103 +SELECT CONVERT(103.0, CHAR(50) UNICODE); +CONVERT(103.0, CHAR(50) UNICODE) +103.0 +SELECT CONVERT(-103, CHAR(50) UNICODE); +CONVERT(-103, CHAR(50) UNICODE) +-103 +SELECT CONVERT(-103.0, CHAR(50) UNICODE); +CONVERT(-103.0, CHAR(50) UNICODE) +-103.0 CREATE TABLE t1 ( a varchar(255) NOT NULL default '', KEY a (a) diff --git a/mysql-test/r/events_logs_tests.result b/mysql-test/r/events_logs_tests.result index e6ca3c29e9b..ab1666fefb9 100644 --- a/mysql-test/r/events_logs_tests.result +++ b/mysql-test/r/events_logs_tests.result @@ -43,7 +43,7 @@ SLEEP(3) 0 SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; user_host query_time db sql_text -root[root] @ localhost [] 00:00:03 events_test SELECT SLEEP(3) +root[root] @ localhost [] SLEEPVAL events_test SELECT SLEEP(3) TRUNCATE mysql.slow_log; CREATE TABLE slow_event_test (slo_val tinyint, val tinyint); "This won't go to the slow log" @@ -75,7 +75,7 @@ slo_val val "Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10" SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; user_host query_time db sql_text -root[root] @ localhost [localhost] 00:00:05 events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5) +root[root] @ localhost [localhost] SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5) DROP EVENT long_event2; SET GLOBAL long_query_time =@old_global_long_query_time; SET SESSION long_query_time =@old_session_long_query_time; diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index 67e8e6d5691..8b1f29d320f 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -4,7 +4,9 @@ CREATE TABLE table_1(a int); CREATE TABLE table_2(a int); CREATE TABLE table_3(a int); CREATE TABLE table_4(a int); +CREATE TABLE T19170(s1 TIMESTAMP); SET GLOBAL event_scheduler=1; +CREATE EVENT E19170 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP); CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1); CREATE EVENT start_n_end ON SCHEDULE EVERY 1 SECOND @@ -29,8 +31,8 @@ DROP EVENT two_sec; SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') OK -SELECT IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; -IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') +SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') OK DROP EVENT start_n_end; "Already dropped because ended. Therefore an error." @@ -43,4 +45,8 @@ DROP TABLE table_1; DROP TABLE table_2; DROP TABLE table_3; DROP TABLE table_4; +"Checking for multiple executions in one second, should not happen -> 0 as result" +SELECT COUNT(*) FROM (SELECT s1, COUNT(*) AS cnt FROM T19170 GROUP BY s1) AS tmp WHERE tmp.cnt > 1; +COUNT(*) +0 DROP DATABASE events_test; diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 9bc8e417e19..8d6fa9927ce 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -72,3 +72,10 @@ set @@max_allowed_packet=1048576*100; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null 0 +create table t1(a blob); +insert into t1 values(NULL), (compress('a')); +select uncompress(a), uncompressed_length(a) from t1; +uncompress(a) uncompressed_length(a) +NULL NULL +a 1 +drop table t1; diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 23a587ca3a7..62b4ddf868a 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -611,6 +611,16 @@ count(distinct (f1+1)) 1 3 drop table t1; +create table t1 (f1 int unsigned, f2 varchar(255)); +insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +select f2,group_concat(f1) from t1 group by f2; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 f2 f2 253 255 255 Y 0 0 8 +def group_concat(f1) 253 400 1 Y 128 0 63 +f2 group_concat(f1) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1 +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2 +drop table t1; set names latin1; create table t1 (a char, b char); insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b'); diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 60022ae0d8f..e3257ce5fd0 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1, t2; select 1 in (1,2,3); 1 in (1,2,3) 1 @@ -225,3 +225,104 @@ a 46 DROP VIEW v1; DROP TABLE t1; +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, filler char(200), key(a)); +insert into t2 select C.a*2, 'no' from t1 A, t1 B, t1 C; +insert into t2 select C.a*2+1, 'yes' from t1 C; +explain +select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 5 NULL 12 Using where +select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); +a filler +1 yes +3 yes +5 yes +7 yes +9 yes +11 yes +13 yes +15 yes +17 yes +19 yes +explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 5 NULL 912 Using where +explain select * from t2 force index(a) where a <> 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 5 NULL 912 Using where +drop table t2; +create table t2 (a datetime, filler char(200), key(a)); +insert into t2 select '2006-04-25 10:00:00' + interval C.a minute, +'no' from t1 A, t1 B, t1 C where C.a % 2 = 0; +insert into t2 select '2006-04-25 10:00:00' + interval C.a*2+1 minute, +'yes' from t1 C; +explain +select * from t2 where a NOT IN ( +'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', +'2006-04-25 10:06:00', '2006-04-25 10:08:00'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 9 NULL 18 Using where +select * from t2 where a NOT IN ( +'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', +'2006-04-25 10:06:00', '2006-04-25 10:08:00'); +a filler +2006-04-25 10:01:00 yes +2006-04-25 10:03:00 yes +2006-04-25 10:05:00 yes +2006-04-25 10:07:00 yes +2006-04-25 10:09:00 yes +2006-04-25 10:11:00 yes +2006-04-25 10:13:00 yes +2006-04-25 10:15:00 yes +2006-04-25 10:17:00 yes +2006-04-25 10:19:00 yes +drop table t2; +create table t2 (a varchar(10), filler char(200), key(a)); +insert into t2 select 'foo', 'no' from t1 A, t1 B; +insert into t2 select 'barbar', 'no' from t1 A, t1 B; +insert into t2 select 'bazbazbaz', 'no' from t1 A, t1 B; +insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'), +('barbas','1'), ('bazbazbay', '1'),('zz','1'); +explain select * from t2 where a not in('foo','barbar', 'bazbazbaz'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 13 NULL 7 Using where +drop table t2; +create table t2 (a decimal(10,5), filler char(200), key(a)); +insert into t2 select 345.67890, 'no' from t1 A, t1 B; +insert into t2 select 43245.34, 'no' from t1 A, t1 B; +insert into t2 select 64224.56344, 'no' from t1 A, t1 B; +insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'), +(55555,'1'), (77777, '1'); +explain +select * from t2 where a not in (345.67890, 43245.34, 64224.56344); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 7 NULL 7 Using where +select * from t2 where a not in (345.67890, 43245.34, 64224.56344); +a filler +0.00000 1 +22334.12300 1 +33333.00000 1 +55555.00000 1 +77777.00000 1 +drop table t2; +create table t2 (a int, key(a), b int); +insert into t2 values (1,1),(2,2); +set @cnt= 1; +set @str="update t2 set b=1 where a not in ("; +select count(*) from ( +select @str:=concat(@str, @cnt:=@cnt+1, ",") +from t1 A, t1 B, t1 C, t1 D) Z; +count(*) +10000 +set @str:=concat(@str, "10000)"); +select substr(@str, 1, 50); +substr(@str, 1, 50) +update t2 set b=1 where a not in (2,3,4,5,6,7,8,9, +prepare s from @str; +execute s; +deallocate prepare s; +set @str=NULL; +drop table t2; +drop table t1; diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result index 61b29e9380d..24685d07f3d 100644 --- a/mysql-test/r/func_op.result +++ b/mysql-test/r/func_op.result @@ -35,3 +35,14 @@ select -1 >> 0, -1 << 0; select -1 >> 1, -1 << 1; -1 >> 1 -1 << 1 9223372036854775807 18446744073709551614 +drop table if exists t1,t2; +create table t1(a int); +create table t2(a int, b int); +insert into t1 values (1), (2), (3); +insert into t2 values (1, 7), (3, 7); +select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a; +a a b bit_count(t2.b) +1 1 7 3 +2 NULL NULL NULL +3 3 7 3 +drop table t1, t2; diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 46c37795531..0b706b24488 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1030,3 +1030,13 @@ c res y,abc abc y,abc abc drop table t1; +select cast(rtrim(' 20.06 ') as decimal(19,2)); +cast(rtrim(' 20.06 ') as decimal(19,2)) +20.06 +select cast(ltrim(' 20.06 ') as decimal(19,2)); +cast(ltrim(' 20.06 ') as decimal(19,2)) +20.06 +select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)); +cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)) +20.06 +End of 5.0 tests diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 6c6e0f19e08..12d20978cf9 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -355,3 +355,17 @@ insert into mysql.user select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; +grant all privileges on test.* to `a@`@localhost; +grant execute on * to `a@`@localhost; +create table t2 (s1 int); +insert into t2 values (1); +drop function if exists f2; +create function f2 () returns int begin declare v int; select s1 from t2 +into v; return v; end// +select f2(); +f2() +1 +drop function f2; +drop table t2; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; +drop user `a@`@localhost; diff --git a/mysql-test/r/have_ndb_status_ok.require b/mysql-test/r/have_ndb_status_ok.require new file mode 100644 index 00000000000..8a82871234b --- /dev/null +++ b/mysql-test/r/have_ndb_status_ok.require @@ -0,0 +1,2 @@ +ndb_status_ok +YES diff --git a/mysql-test/r/have_udf.require b/mysql-test/r/have_udf.require index 6204435c17a..2d21f65e4ac 100644 --- a/mysql-test/r/have_udf.require +++ b/mysql-test/r/have_udf.require @@ -1,2 +1,2 @@ Variable_name Value -have_dlopen YES +have_dynamic_loading YES diff --git a/mysql-test/r/have_udf_example.require b/mysql-test/r/have_udf_example.require new file mode 100644 index 00000000000..e60fab1dbe0 --- /dev/null +++ b/mysql-test/r/have_udf_example.require @@ -0,0 +1,2 @@ +have_udf_example_lib +1 diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index fe918e4c3ff..a37f260ff31 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -392,3 +392,16 @@ HAVING HU.PROJ.CITY = HU.STAFF.CITY); EMPNUM GRADE*1000 E3 13000 DROP SCHEMA HU; +USE test; +create table t1(f1 int); +select f1 from t1 having max(f1)=f1; +f1 +select f1 from t1 group by f1 having max(f1)=f1; +f1 +set session sql_mode='ONLY_FULL_GROUP_BY'; +select f1 from t1 having max(f1)=f1; +ERROR 42000: non-grouping field 'f1' is used in HAVING clause +select f1 from t1 group by f1 having max(f1)=f1; +f1 +set session sql_mode=''; +drop table t1; diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 5e915b5742c..002e444acca 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -50,6 +50,7 @@ KEY_COLUMN_USAGE PARTITIONS PLUGINS PROCESSLIST +REFERENTIAL_CONSTRAINTS ROUTINES SCHEMATA SCHEMA_PRIVILEGES @@ -745,7 +746,7 @@ CREATE TABLE t_crashme ( f1 BIGINT); CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; count(*) -112 +113 drop view a2, a1; drop table t_crashme; select table_schema,table_name, column_name from @@ -832,6 +833,7 @@ COLUMN_PRIVILEGES TABLE_NAME select FILES TABLE_NAME select KEY_COLUMN_USAGE TABLE_NAME select PARTITIONS TABLE_NAME select +REFERENTIAL_CONSTRAINTS TABLE_NAME select STATISTICS TABLE_NAME select TABLES TABLE_NAME select TABLE_CONSTRAINTS TABLE_NAME select @@ -843,7 +845,7 @@ flush privileges; SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; table_schema count(*) cluster 1 -information_schema 22 +information_schema 23 mysql 21 create table t1 (i int, j int); create trigger trg1 before insert on t1 for each row diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 584e1701a14..37537e257da 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -13,6 +13,7 @@ KEY_COLUMN_USAGE PARTITIONS PLUGINS PROCESSLIST +REFERENTIAL_CONSTRAINTS ROUTINES SCHEMATA SCHEMA_PRIVILEGES diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result index fb6584673f6..9bb3185c6fb 100644 --- a/mysql-test/r/information_schema_inno.result +++ b/mysql-test/r/information_schema_inno.result @@ -25,3 +25,34 @@ NULL test PRIMARY NULL test t3 id 1 NULL NULL NULL NULL NULL test t3_ibfk_1 NULL test t3 id 1 1 test t2 t1_id NULL test t3_ibfk_1 NULL test t3 t2_id 2 2 test t2 id drop table t3, t2, t1; +CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL, +PRIMARY KEY(a1, a2)) ENGINE=INNODB; +CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2), +CONSTRAINT A1 +FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2) +ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB; +CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2), +CONSTRAINT A2 +FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2) +ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB; +CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2), +CONSTRAINT A3 +FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2) +ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB; +CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2), +CONSTRAINT A4 +FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2) +ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB; +select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE, +b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, +MATCH_OPTION, UPDATE_RULE, DELETE_RULE +from information_schema.TABLE_CONSTRAINTS a, +information_schema.REFERENTIAL_CONSTRAINTS b +where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and +a.CONSTRAINT_NAME = b.CONSTRAINT_NAME; +CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE +test t2 FOREIGN KEY A1 test t1 NONE CASCADE NO ACTION +test t3 FOREIGN KEY A2 test t2 NONE SET NULL RESTRICT +test t4 FOREIGN KEY A3 test t3 NONE NO ACTION SET NULL +test t5 FOREIGN KEY A4 test t4 NONE RESTRICT CASCADE +drop tables t5, t4, t3, t2, t1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index a003ed14c77..f32d7ee264a 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1306,13 +1306,13 @@ insert into t1 (a) select b from t2; select count(*) from t1; count(*) 29267 -explain select * from t1 where c between 1 and 10000; +explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range c c 5 NULL # Using where update t1 set c=a; -explain select * from t1 where c between 1 and 10000; +explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL c NULL NULL NULL # Using where +1 SIMPLE t1 range c c 5 NULL # Using where drop table t1,t2; create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; insert into t1 (id) values (null),(null),(null),(null),(null); @@ -3233,15 +3233,6 @@ drop trigger t2t; drop trigger t3t; drop trigger t4t; drop table t1, t2, t3, t4, t5; -create table t1(a date) engine=innodb; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 -where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -a a -2005-10-01 2005-10-01 -drop table t1, t2; CREATE TABLE t1 ( field1 varchar(8) NOT NULL DEFAULT '', field2 varchar(8) NOT NULL DEFAULT '', @@ -3291,3 +3282,176 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2; +create table t1(a date) engine=innodb; +create table t2(a date, key(a)) engine=innodb; +insert into t1 values('2005-10-01'); +insert into t2 values('2005-10-01'); +select * from t1, t2 +where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; +a a +2005-10-01 2005-10-01 +drop table t1, t2; +create table t1 (id int not null, f_id int not null, f int not null, +primary key(f_id, id)) engine=innodb; +create table t2 (id int not null,s_id int not null,s varchar(200), +primary key(id)) engine=innodb; +INSERT INTO t1 VALUES (8, 1, 3); +INSERT INTO t1 VALUES (1, 2, 1); +INSERT INTO t2 VALUES (1, 0, ''); +INSERT INTO t2 VALUES (8, 1, ''); +commit; +DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) +WHERE mm.id IS NULL; +select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) +where mm.id is null lock in share mode; +id f_id f +drop table t1,t2; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); +commit; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t1 set b = 5 where b = 1; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +select * from t1 where a = 7 and b = 3 for update; +a b +7 3 +commit; +commit; +drop table t1; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); +commit; +set autocommit = 0; +select * from t1 lock in share mode; +a b +1 1 +2 2 +3 1 +4 2 +5 1 +6 2 +update t1 set b = 5 where b = 1; +set autocommit = 0; +select * from t1 where a = 2 and b = 2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +commit; +drop table t1; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(d int not null, e int, primary key(d)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +d e +3 1 +8 6 +12 1 +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t1 select * from t2; +update t1 set b = (select e from t2 where a = d); +create table t3(d int not null, e int, primary key(d)) engine=innodb +select * from t2; +commit; +commit; +drop table t1, t2, t3; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(a int not null, b int, primary key(a)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +create table t3(d int not null, b int, primary key(d)) engine=innodb; +insert into t3 values (8,6),(12,1),(3,1); +create table t5(a int not null, b int, primary key(a)) engine=innodb; +insert into t5 values (1,2),(5,3),(4,2); +create table t6(d int not null, e int, primary key(d)) engine=innodb; +insert into t6 values (8,6),(12,1),(3,1); +create table t8(a int not null, b int, primary key(a)) engine=innodb; +insert into t8 values (1,2),(5,3),(4,2); +create table t9(d int not null, e int, primary key(d)) engine=innodb; +insert into t9 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +a b +3 1 +8 6 +12 1 +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +insert into t1 select * from t2; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +update t3 set b = (select b from t2 where a = d); +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t5 (select * from t2 lock in share mode); +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t6 set e = (select b from t2 where a = d lock in share mode); +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t8 (select * from t2 for update); +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t9 set e = (select b from t2 where a = d for update); +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +drop table t1, t2, t3, t5, t6, t8, t9; +CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; +ERROR HY000: Can't create table 'test.t1' (errno: -1) +CREATE TABLE t1 ( +a BIGINT(20) NOT NULL, +PRIMARY KEY (a) +) ENGINE=INNODB DEFAULT CHARSET=UTF8; +CREATE TABLE t2 ( +a BIGINT(20) NOT NULL, +b VARCHAR(128) NOT NULL, +c TEXT NOT NULL, +PRIMARY KEY (a,b), +KEY idx_t2_b_c (b,c(200)), +CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) +ON DELETE CASCADE +) ENGINE=INNODB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1, 'bar', 'vbar'); +INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR'); +INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi'); +INSERT INTO t2 VALUES (1, 'customer_over', '1'); +SELECT * FROM t2 WHERE b = 'customer_over'; +a b c +1 customer_over 1 +SELECT * FROM t2 WHERE BINARY b = 'customer_over'; +a b c +1 customer_over 1 +SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over'; +a +1 +/* Bang: Empty result set, above was expected: */ +SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; +a +1 +SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; +a +1 +drop table t2, t1; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result new file mode 100644 index 00000000000..878c5cb5451 --- /dev/null +++ b/mysql-test/r/innodb_mysql.result @@ -0,0 +1 @@ +drop table if exists t1; diff --git a/mysql-test/r/innodb_unsafe_binlog.result b/mysql-test/r/innodb_unsafe_binlog.result index e741fbb75a4..38f0c2a12fa 100644 --- a/mysql-test/r/innodb_unsafe_binlog.result +++ b/mysql-test/r/innodb_unsafe_binlog.result @@ -15,7 +15,7 @@ where mm.id is null lock in share mode; id f_id f drop table t1,t2; create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; select * from t1 lock in share mode; @@ -26,6 +26,7 @@ a b 4 2 5 1 6 2 +7 3 update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 2 and b = 2 for update; @@ -33,3 +34,87 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; commit; drop table t1; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); +commit; +set autocommit = 0; +update t1 set b = 5 where b = 1; +set autocommit = 0; +select * from t1 where a = 7 and b = 3 for update; +a b +7 3 +commit; +commit; +drop table t1; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(d int not null, e int, primary key(d)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +d e +3 1 +8 6 +12 1 +set autocommit = 0; +insert into t1 select * from t2; +update t1 set b = (select e from t2 where a = d); +create table t3(d int not null, e int, primary key(d)) engine=innodb +select * from t2; +commit; +commit; +drop table t1, t2, t3; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(a int not null, b int, primary key(a)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +create table t3(d int not null, b int, primary key(d)) engine=innodb; +insert into t3 values (8,6),(12,1),(3,1); +create table t5(a int not null, b int, primary key(a)) engine=innodb; +insert into t5 values (1,2),(5,3),(4,2); +create table t6(d int not null, e int, primary key(d)) engine=innodb; +insert into t6 values (8,6),(12,1),(3,1); +create table t8(a int not null, b int, primary key(a)) engine=innodb; +insert into t8 values (1,2),(5,3),(4,2); +create table t9(d int not null, e int, primary key(d)) engine=innodb; +insert into t9 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +a b +3 1 +8 6 +12 1 +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +insert into t1 select * from t2; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +update t3 set b = (select b from t2 where a = d); +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; +set autocommit = 0; +insert into t5 (select * from t2 lock in share mode); +set autocommit = 0; +update t6 set e = (select b from t2 where a = d lock in share mode); +set autocommit = 0; +create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; +set autocommit = 0; +insert into t8 (select * from t2 for update); +set autocommit = 0; +update t9 set e = (select b from t2 where a = d for update); +set autocommit = 0; +create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +drop table t1, t2, t3, t5, t6, t8, t9; diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index de9a2b2c003..99f5277f817 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -289,6 +289,48 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY); +SET GLOBAL key_cache_block_size=1536; +INSERT INTO t1 VALUES (1); +SELECT @@key_cache_block_size; +@@key_cache_block_size +1536 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int); +CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int); +SET GLOBAL key_cache_block_size=1536; +INSERT INTO t1 VALUES (1,0); +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +SELECT COUNT(*) FROM t1; +COUNT(*) +4181 +SELECT @@key_cache_block_size; +@@key_cache_block_size +1536 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1,t2; set @@global.key_buffer_size=0; Warnings: Warning 1438 Cannot drop default keycache diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index ae50c714bba..a067d3ad0f8 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -85,3 +85,15 @@ c_cp932 | NULL | NULL | Τη γλώσσα | | NULL | NULL | á›–áš´ áš·á›–á› | +------+------+---------------------------+ ++------+---+------+ +| i | j | k | ++------+---+------+ +| NULL | 1 | NULL | ++------+---+------+ ++-------+---------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+---------+------+-----+---------+-------+ +| i | int(11) | YES | | NULL | | +| j | int(11) | NO | | NULL | | +| k | int(11) | YES | | NULL | | ++-------+---------+------+-----+---------+-------+ diff --git a/mysql-test/r/ndb_binlog_discover.result b/mysql-test/r/ndb_binlog_discover.result new file mode 100644 index 00000000000..2a1bf6efa84 --- /dev/null +++ b/mysql-test/r/ndb_binlog_discover.result @@ -0,0 +1,13 @@ +drop table if exists t1; +create table t1 (a int key) engine=ndb; +reset master; +insert into t1 values(1); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (cluster.apply_status) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +drop table t1; diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result index 8b16bce830c..d5ac5071a8e 100644 --- a/mysql-test/r/ndb_dd_basic.result +++ b/mysql-test/r/ndb_dd_basic.result @@ -3,11 +3,32 @@ CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M -ENGINE=NDB; +ENGINE=MYISAM; +Warnings: +Error 1539 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=XYZ; +Warnings: +Error 1266 Using storage engine MyISAM for table 'lg1' +Error 1539 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M; +Warnings: +Error 1539 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +set storage_engine=ndb; +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M; ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undofile02.dat' INITIAL_SIZE = 4M ENGINE=NDB; +set storage_engine=myisam; CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result index 229339d603e..497ad973e8b 100644 --- a/mysql-test/r/ndb_index_unique.result +++ b/mysql-test/r/ndb_index_unique.result @@ -45,6 +45,8 @@ a b c 8 2 3 alter table t1 drop index ib; insert into t1 values(1, 2, 3); +create unique index ib on t1(b); +ERROR 23000: Can't write, because of unique constraint, to table 't1' drop table t1; CREATE TABLE t1 ( a int unsigned NOT NULL PRIMARY KEY, diff --git a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result index 8225fca7a54..503283df532 100644 --- a/mysql-test/r/ndb_partition_key.result +++ b/mysql-test/r/ndb_partition_key.result @@ -165,6 +165,20 @@ ENGINE=NDB PARTITION BY KEY(c3) PARTITIONS 5; ALTER TABLE t1 COALESCE PARTITION 4; DROP TABLE t1; +CREATE TABLE t1 (a int primary key) +ENGINE=NDB +PARTITION BY KEY(a); +ALTER TABLE t1 OPTIMIZE PARTITION p0; +ERROR HY000: Table storage engine for 't1' doesn't have this option +ALTER TABLE t1 CHECK PARTITION p0; +ERROR HY000: Table storage engine for 't1' doesn't have this option +ALTER TABLE t1 REPAIR PARTITION p0; +ERROR HY000: Table storage engine for 't1' doesn't have this option +ALTER TABLE t1 ANALYZE PARTITION p0; +ERROR HY000: Table storage engine for 't1' doesn't have this option +ALTER TABLE t1 REBUILD PARTITION p0; +ERROR HY000: Table storage engine for 't1' doesn't have this option +DROP TABLE t1; CREATE TABLE t1 ( c1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, diff --git a/mysql-test/r/ndb_restore_compat.result b/mysql-test/r/ndb_restore_compat.result new file mode 100644 index 00000000000..358ca36b2df --- /dev/null +++ b/mysql-test/r/ndb_restore_compat.result @@ -0,0 +1,104 @@ +DROP DATABASE IF EXISTS BANK; +CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin; +USE BANK; +SHOW TABLES; +Tables_in_BANK +ACCOUNT +GL +ACCOUNT_TYPE +TRANSACTION +SYSTEM_VALUES +SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; +TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED +0 0 10000000 0 0 0 0 1 +0 1 30000 0 0 0 0 1 +0 2 20000 0 0 0 0 1 +0 3 20000 0 0 0 0 1 +0 4 20000 0 0 0 0 1 +1 0 10000000 0 0 0 0 0 +1 1 30000 0 0 0 0 0 +1 2 20000 0 0 0 0 0 +1 3 20000 0 0 0 0 0 +1 4 20000 0 0 0 0 0 +2 0 9981761 17 80457 19 98696 0 +2 1 17823 55 203688 46 215865 0 +2 2 47056 33 159275 33 132219 0 +2 3 15719 26 126833 29 131114 0 +2 4 27641 32 133459 36 125818 0 +SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; +ACCOUNT_ID OWNER BALANCE ACCOUNT_TYPE +0 0 9863546 0 +1 3001 12885 1 +2 3002 11012 2 +3 3003 32789 3 +4 3004 10992 4 +5 3005 2247 1 +6 3006 3170 1 +7 3007 60321 2 +8 3008 30508 3 +9 3009 62530 4 +SELECT COUNT(*) FROM TRANSACTION; +COUNT(*) +3444 +SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; +SYSTEM_VALUES_ID VALUE +0 2039 +1 3 +SELECT * FROM cluster.apply_status WHERE server_id=0; +server_id epoch +0 151 +TRUNCATE GL; +TRUNCATE ACCOUNT; +TRUNCATE TRANSACTION; +TRUNCATE SYSTEM_VALUES; +TRUNCATE ACCOUNT_TYPE; +SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; +TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED +0 0 10000000 0 0 0 0 1 +0 1 30000 0 0 0 0 1 +0 2 20000 0 0 0 0 1 +0 3 20000 0 0 0 0 1 +0 4 20000 0 0 0 0 1 +1 0 10000000 0 0 0 0 1 +1 1 30000 0 0 0 0 1 +1 2 20000 0 0 0 0 1 +1 3 20000 0 0 0 0 1 +1 4 20000 0 0 0 0 1 +2 0 10000000 0 0 0 0 1 +2 1 30000 0 0 0 0 1 +2 2 20000 0 0 0 0 1 +2 3 20000 0 0 0 0 1 +2 4 20000 0 0 0 0 1 +3 0 9963591 14 59111 19 95520 0 +3 1 44264 49 255559 53 241295 0 +3 2 25515 39 177806 36 172291 0 +3 3 16779 26 129200 29 132421 0 +3 4 39851 43 182771 34 162920 0 +4 0 9733661 141 632616 162 862546 0 +4 1 63853 426 2005337 415 1985748 0 +4 2 140473 314 1548632 297 1433674 0 +4 3 13481 310 1528043 324 1531341 0 +4 4 138532 316 1540206 309 1441525 0 +SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; +ACCOUNT_ID OWNER BALANCE ACCOUNT_TYPE +0 0 9679579 0 +1 3001 18130 1 +2 3002 12318 2 +3 3003 3049 3 +4 3004 39517 4 +5 3005 37051 1 +6 3006 144497 1 +7 3007 130670 2 +8 3008 13747 3 +9 3009 11442 4 +SELECT COUNT(*) FROM TRANSACTION; +COUNT(*) +4056 +SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; +SYSTEM_VALUES_ID VALUE +0 2297 +1 5 +SELECT * FROM cluster.apply_status WHERE server_id=0; +server_id epoch +0 331 +DROP DATABASE BANK; diff --git a/mysql-test/r/not_as_root.require b/mysql-test/r/not_as_root.require new file mode 100644 index 00000000000..d9ea5244efc --- /dev/null +++ b/mysql-test/r/not_as_root.require @@ -0,0 +1,2 @@ +running_as_root +NO diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 9a7ae446707..68fc6ff7f5f 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -278,3 +278,45 @@ field('str1', null, 'STR1') as c05, c01 c02 c03 c04 c05 c08 c09 str str 0 1 2 1 1 set names latin1; +create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM; +create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM; +create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM; +create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM; +ERROR 42000: Invalid default value for 's' +create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM; +ERROR 42000: Invalid default value for 'e' +alter table bug19145a alter column e set default null; +alter table bug19145a alter column s set default null; +alter table bug19145a add column (i int); +alter table bug19145b alter column e set default null; +alter table bug19145b alter column s set default null; +alter table bug19145b add column (i int); +alter table bug19145c alter column e set default null; +ERROR 42000: Invalid default value for 'e' +alter table bug19145c alter column s set default null; +ERROR 42000: Invalid default value for 's' +alter table bug19145c add column (i int); +show create table bug19145a; +Table Create Table +bug19145a CREATE TABLE `bug19145a` ( + `e` enum('a','b','c') DEFAULT NULL, + `s` set('x','y','z') DEFAULT NULL, + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table bug19145b; +Table Create Table +bug19145b CREATE TABLE `bug19145b` ( + `e` enum('a','b','c') DEFAULT NULL, + `s` set('x','y','z') DEFAULT NULL, + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table bug19145c; +Table Create Table +bug19145c CREATE TABLE `bug19145c` ( + `e` enum('a','b','c') NOT NULL DEFAULT 'b', + `s` set('x','y','z') NOT NULL DEFAULT 'y', + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table bug19145a; +drop table bug19145b; +drop table bug19145c; diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 77f2d5495a9..91382619b6c 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -38,7 +38,6 @@ f1 5 delete from t1; ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1' -delete from mysql.user where user='ssl_user%'; -delete from mysql.db where user='ssl_user%'; -flush privileges; +drop user ssl_user1@localhost, ssl_user2@localhost, +ssl_user3@localhost, ssl_user4@localhost; drop table t1; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 6864c35dbfc..a36935a583d 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -820,3 +820,35 @@ a 2 2 DROP TABLE t1; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,30), (2,20), (1,10), (2,30), (1,20), (2,10); +(SELECT b,a FROM t1 ORDER BY a,b) ORDER BY b,a; +b a +10 1 +10 2 +20 1 +20 2 +30 1 +30 2 +(SELECT b FROM t1 ORDER BY b DESC) ORDER BY b ASC; +b +10 +10 +20 +20 +30 +30 +(SELECT b,a FROM t1 ORDER BY b,a) ORDER BY a,b; +b a +10 1 +20 1 +30 1 +10 2 +20 2 +30 2 +(SELECT b,a FROM t1 ORDER by b,a LIMIT 3) ORDER by a,b; +b a +10 1 +20 1 +10 2 +DROP TABLE t1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 3de7ab61e73..06443cde01d 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1056,3 +1056,104 @@ a b 1 9 3 7 drop table t1; +create table t1 (a int); +create table t2 like t1; +create table t3 like t2; +prepare stmt from "repair table t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +prepare stmt from "optimize table t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +prepare stmt from "analyze table t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +prepare stmt from "repair table t1, t2, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t2 repair status OK +test.t3 repair status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t2 repair status OK +test.t3 repair status OK +prepare stmt from "optimize table t1, t2, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status OK +test.t2 optimize status OK +test.t3 optimize status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +test.t2 optimize status Table is already up to date +test.t3 optimize status Table is already up to date +prepare stmt from "analyze table t1, t2, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +test.t2 analyze status Table is already up to date +test.t3 analyze status Table is already up to date +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +test.t2 analyze status Table is already up to date +test.t3 analyze status Table is already up to date +prepare stmt from "repair table t1, t4, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t4 repair error Table 'test.t4' doesn't exist +test.t3 repair status OK +Warnings: +Error 1146 Table 'test.t4' doesn't exist +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t4 repair error Table 'test.t4' doesn't exist +test.t3 repair status OK +Warnings: +Error 1146 Table 'test.t4' doesn't exist +prepare stmt from "optimize table t1, t3, t4"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status OK +test.t3 optimize status OK +test.t4 optimize error Table 'test.t4' doesn't exist +Warnings: +Error 1146 Table 'test.t4' doesn't exist +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +test.t3 optimize status Table is already up to date +test.t4 optimize error Table 'test.t4' doesn't exist +Warnings: +Error 1146 Table 'test.t4' doesn't exist +prepare stmt from "analyze table t4, t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t4 analyze error Table 'test.t4' doesn't exist +test.t1 analyze status Table is already up to date +Warnings: +Error 1146 Table 'test.t4' doesn't exist +execute stmt; +Table Op Msg_type Msg_text +test.t4 analyze error Table 'test.t4' doesn't exist +test.t1 analyze status Table is already up to date +Warnings: +Error 1146 Table 'test.t4' doesn't exist +deallocate prepare stmt; diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result index c0d7fe502af..c849c25d646 100644 --- a/mysql-test/r/ps_11bugs.result +++ b/mysql-test/r/ps_11bugs.result @@ -116,3 +116,17 @@ execute st_1676 using @arg0, @arg1, @arg2; cola colb cold aaaa yyyy R drop table t1, t2; +create table t1 (a int primary key); +insert into t1 values (1); +explain select * from t1 where 3 in (select (1+1) union select 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +select * from t1 where 3 in (select (1+1) union select 1); +a +prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; +execute st_18492; +a +drop table t1; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 22d59c7bd8f..d0b773dfe34 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -410,13 +410,10 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; execute stmt1 ; prepare stmt1 from ' optimize table t1 ' ; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' analyze table t1 ' ; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' checksum table t1 ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' repair table t1 ' ; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' handler t1 open '; diff --git a/mysql-test/r/rpl_deadlock_innodb.result b/mysql-test/r/rpl_deadlock_innodb.result index 7d592c2d0cd..b9a23950ed8 100644 --- a/mysql-test/r/rpl_deadlock_innodb.result +++ b/mysql-test/r/rpl_deadlock_innodb.result @@ -44,8 +44,39 @@ select * from t2; a 22 show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes # 0 0 # # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # stop slave; change master to master_log_pos=536; begin; @@ -62,8 +93,39 @@ select * from t2; a 22 show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes # 0 0 # # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # set global max_relay_log_size=0; stop slave; change master to master_log_pos=536; @@ -82,6 +144,37 @@ select * from t2; a 22 show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 # Yes # 0 0 # # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # drop table t1,t2,t3,t4; diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result index 4504ad8e5a7..622b1489f91 100644 --- a/mysql-test/r/rpl_insert_id.result +++ b/mysql-test/r/rpl_insert_id.result @@ -73,3 +73,61 @@ CREATE TABLE t1 ( a INT UNIQUE ); SET FOREIGN_KEY_CHECKS=0; INSERT INTO t1 VALUES (1),(1); Got one of the listed errors +drop function if exists bug15728; +drop function if exists bug15728_insert; +drop table if exists t1, t2; +create table t1 ( +id int not null auto_increment, +last_id int, +primary key (id) +); +create function bug15728() returns int(11) +return last_insert_id(); +insert into t1 (last_id) values (0); +insert into t1 (last_id) values (last_insert_id()); +insert into t1 (last_id) values (bug15728()); +create table t2 ( +id int not null auto_increment, +last_id int, +primary key (id) +); +create function bug15728_insert() returns int(11) modifies sql data +begin +insert into t2 (last_id) values (bug15728()); +return bug15728(); +end| +create trigger t1_bi before insert on t1 for each row +begin +declare res int; +select bug15728_insert() into res; +set NEW.last_id = res; +end| +insert into t1 (last_id) values (0); +drop trigger t1_bi; +select last_insert_id(); +last_insert_id() +4 +select bug15728_insert(); +bug15728_insert() +2 +select last_insert_id(); +last_insert_id() +4 +insert into t1 (last_id) values (bug15728()); +select last_insert_id(); +last_insert_id() +5 +select * from t1; +id last_id +1 0 +2 1 +3 2 +4 1 +5 4 +select * from t2; +id last_id +1 3 +2 4 +drop function bug15728; +drop function bug15728_insert; +drop table t1, t2; diff --git a/mysql-test/r/rpl_ndb_2innodb.result b/mysql-test/r/rpl_ndb_2innodb.result new file mode 100644 index 00000000000..f8ec4624062 --- /dev/null +++ b/mysql-test/r/rpl_ndb_2innodb.result @@ -0,0 +1,855 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SET storage_engine=ndb; +--- Doing pre test cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 1 Basic testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly -- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 1 Basic testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 2 partition RANGE testing -- +--- Do setup -- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY RANGE (YEAR(t)) +(PARTITION p0 VALUES LESS THAN (1901), +PARTITION p1 VALUES LESS THAN (1946), +PARTITION p2 VALUES LESS THAN (1966), +PARTITION p3 VALUES LESS THAN (1986), +PARTITION p4 VALUES LESS THAN (2005), +PARTITION p5 VALUES LESS THAN MAXVALUE); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Show table on slave -- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 2 partition RANGE testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 3 partition LIST testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY LIST(id) +(PARTITION p0 VALUES IN (2, 4), +PARTITION p1 VALUES IN (42, 142)); +--- Test 3 Alter to add partition --- +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 3 partition LIST testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 4 partition HASH testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY HASH( YEAR(t) ) +PARTITIONS 4; +--- show that tables have been created correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 4 partition HASH testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 5 partition by key testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)) +PARTITION BY KEY() +PARTITIONS 4; +--- Show that tables on master are ndbcluster tables --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Show that tables on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still right type --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 5 key partition testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/rpl_ndb_2myisam.result b/mysql-test/r/rpl_ndb_2myisam.result new file mode 100644 index 00000000000..00fb2f5455f --- /dev/null +++ b/mysql-test/r/rpl_ndb_2myisam.result @@ -0,0 +1,855 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SET storage_engine=ndb; +--- Doing pre test cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 1 Basic testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly -- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 1 Basic testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 2 partition RANGE testing -- +--- Do setup -- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY RANGE (YEAR(t)) +(PARTITION p0 VALUES LESS THAN (1901), +PARTITION p1 VALUES LESS THAN (1946), +PARTITION p2 VALUES LESS THAN (1966), +PARTITION p3 VALUES LESS THAN (1986), +PARTITION p4 VALUES LESS THAN (2005), +PARTITION p5 VALUES LESS THAN MAXVALUE); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Show table on slave -- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 2 partition RANGE testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 3 partition LIST testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY LIST(id) +(PARTITION p0 VALUES IN (2, 4), +PARTITION p1 VALUES IN (42, 142)); +--- Test 3 Alter to add partition --- +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 3 partition LIST testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 4 partition HASH testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY HASH( YEAR(t) ) +PARTITIONS 4; +--- show that tables have been created correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 4 partition HASH testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 5 partition by key testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)) +PARTITION BY KEY() +PARTITIONS 4; +--- Show that tables on master are ndbcluster tables --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Show that tables on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still right type --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 5 key partition testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result index 40e3384be3b..b23e5f03f27 100644 --- a/mysql-test/r/rpl_ndb_basic.result +++ b/mysql-test/r/rpl_ndb_basic.result @@ -122,3 +122,28 @@ select * from t1 order by nid; nid nom prenom 1 DEAD ABC1 DROP TABLE t1; +CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +ALTER TABLE t1 ADD c2 INT; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +6 NULL +7 NULL +8 NULL +9 NULL +10 NULL +ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8; +ALTER TABLE t1 CHANGE c2 c2 BLOB; +SELECT * FROM t1 ORDER BY c1 LIMIT 5; +c1 c2 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +DROP TABLE t1; diff --git a/mysql-test/r/rpl_ndb_dd_partitions.result b/mysql-test/r/rpl_ndb_dd_partitions.result new file mode 100644 index 00000000000..ece6b84c227 --- /dev/null +++ b/mysql-test/r/rpl_ndb_dd_partitions.result @@ -0,0 +1,726 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +--- Doing pre test cleanup --- +DROP TABLE IF EXISTS t1; +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; +--- Start test 2 partition RANGE testing -- +--- Do setup -- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY RANGE (YEAR(t)) +(PARTITION p0 VALUES LESS THAN (1901), +PARTITION p1 VALUES LESS THAN (1946), +PARTITION p2 VALUES LESS THAN (1966), +PARTITION p3 VALUES LESS THAN (1986), +PARTITION p4 VALUES LESS THAN (2005), +PARTITION p5 VALUES LESS THAN MAXVALUE); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Show table on slave -- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 2 partition RANGE testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 3 partition LIST testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY LIST(id) +(PARTITION p0 VALUES IN (2, 4), +PARTITION p1 VALUES IN (42, 142)); +--- Test 3 Alter to add partition --- +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 3 partition LIST testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 4 partition HASH testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY HASH( YEAR(t) ) +PARTITIONS 4; +--- show that tables have been created correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 4 partition HASH testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 5 partition by key testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY KEY() +PARTITIONS 4; +--- Show that tables on master are ndbcluster tables --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Show that tables on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still right type --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 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 from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 5 key partition testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +alter tablespace ts1 +drop datafile 'datafile.dat' +engine=ndb; +alter tablespace ts1 +drop datafile 'datafile02.dat' +engine=ndb; +DROP TABLESPACE ts1 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result index be9ab29d8b7..4fe02088632 100644 --- a/mysql-test/r/rpl_openssl.result +++ b/mysql-test/r/rpl_openssl.result @@ -24,6 +24,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; +drop user replssl@localhost; drop table t1; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index bc5cc262079..929dc33c447 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -88,3 +88,17 @@ f 1 drop temporary table t4; drop table t5; +set @session.pseudo_thread_id=100; +create temporary table t101 (id int); +create temporary table t102 (id int); +set @session.pseudo_thread_id=200; +create temporary table t201 (id int); +create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int); +set @con1_id=connection_id(); +kill @con1_id; +create table t1(f int); +insert into t1 values (1); +select * from t1 /* must be 1 */; +f +1 +drop table t1; diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result index c00b09f90e1..d9d5706cded 100644 --- a/mysql-test/r/sp-dynamic.result +++ b/mysql-test/r/sp-dynamic.result @@ -286,12 +286,12 @@ id stmt_text status 1 select 1 supported 2 flush tables not supported 3 handler t1 open as ha not supported -4 analyze table t1 not supported +4 analyze table t1 supported 5 check table t1 not supported 6 checksum table t1 not supported 7 check table t1 not supported -8 optimize table t1 not supported -9 repair table t1 not supported +8 optimize table t1 supported +9 repair table t1 supported 10 describe extended select * from t1 supported 11 help help not supported 12 show databases supported diff --git a/mysql-test/r/sp-goto.result b/mysql-test/r/sp-goto.result deleted file mode 100644 index ca560f62318..00000000000 --- a/mysql-test/r/sp-goto.result +++ /dev/null @@ -1,205 +0,0 @@ -drop table if exists t1; -create table t1 ( -id char(16) not null default '', -data int not null -); -drop procedure if exists goto1// -create procedure goto1() -begin -declare y int; -label a; -select * from t1; -select count(*) into y from t1; -if y > 2 then -goto b; -end if; -insert into t1 values ("j", y); -goto a; -label b; -end// -call goto1()// -id data -id data -j 0 -id data -j 0 -j 1 -id data -j 0 -j 1 -j 2 -drop procedure goto1// -drop procedure if exists goto2// -create procedure goto2(a int) -begin -declare x int default 0; -declare continue handler for sqlstate '42S98' set x = 1; -label a; -select * from t1; -b: -while x < 2 do -begin -declare continue handler for sqlstate '42S99' set x = 2; -if a = 0 then -set x = x + 1; -iterate b; -elseif a = 1 then -leave b; -elseif a = 2 then -set a = 1; -goto a; -end if; -end; -end while b; -select * from t1; -end// -call goto2(0)// -id data -j 0 -j 1 -j 2 -id data -j 0 -j 1 -j 2 -call goto2(1)// -id data -j 0 -j 1 -j 2 -id data -j 0 -j 1 -j 2 -call goto2(2)// -id data -j 0 -j 1 -j 2 -id data -j 0 -j 1 -j 2 -id data -j 0 -j 1 -j 2 -drop procedure goto2// -delete from t1// -drop procedure if exists goto3// -create procedure goto3() -begin -label L1; -begin -end; -goto L1; -end// -drop procedure goto3// -drop procedure if exists goto4// -create procedure goto4() -begin -begin -label lab1; -begin -goto lab1; -end; -end; -end// -drop procedure goto4// -drop procedure if exists goto5// -create procedure goto5() -begin -begin -begin -goto lab1; -end; -label lab1; -end; -end// -drop procedure goto5// -drop procedure if exists goto6// -create procedure goto6() -begin -label L1; -goto L5; -begin -label L2; -goto L1; -goto L5; -begin -label L3; -goto L1; -goto L2; -goto L3; -goto L4; -goto L5; -end; -goto L2; -goto L4; -label L4; -end; -label L5; -goto L1; -end// -drop procedure goto6// -create procedure foo() -begin -goto foo; -end// -ERROR 42000: GOTO with no matching label: foo -create procedure foo() -begin -begin -label foo; -end; -goto foo; -end// -ERROR 42000: GOTO with no matching label: foo -create procedure foo() -begin -goto foo; -begin -label foo; -end; -end// -ERROR 42000: GOTO with no matching label: foo -create procedure foo() -begin -begin -goto foo; -end; -begin -label foo; -end; -end// -ERROR 42000: GOTO with no matching label: foo -create procedure foo() -begin -begin -label foo; -end; -begin -goto foo; -end; -end// -ERROR 42000: GOTO with no matching label: foo -create procedure p() -begin -declare continue handler for sqlexception -begin -goto L1; -end; -select field from t1; -label L1; -end// -ERROR HY000: GOTO is not allowed in a stored procedure handler -drop procedure if exists bug6898// -create procedure bug6898() -begin -goto label1; -label label1; -begin end; -goto label1; -end// -drop procedure bug6898// -drop table t1; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index a1e78cd9d7e..af4f1c16c56 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -322,6 +322,7 @@ Warnings: Warning 1541 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead. GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; DROP DATABASE db_bug7787; +drop user user_bug7787@localhost; use test; ---> connection: root diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 4468991c0ef..5aa984bfa4e 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -4858,4 +4858,60 @@ c 2 b 3 a 1 delete from t1| +drop function if exists bug15728| +drop table if exists t3| +create table t3 ( +id int not null auto_increment, +primary key (id) +)| +create function bug15728() returns int(11) +return last_insert_id()| +insert into t3 values (0)| +select last_insert_id()| +last_insert_id() +1 +select bug15728()| +bug15728() +1 +drop function bug15728| +drop table t3| +drop procedure if exists bug18787| +create procedure bug18787() +begin +declare continue handler for sqlexception begin end; +select no_such_function(); +end| +call bug18787()| +no_such_function() +NULL +drop procedure bug18787| +create database bug18344_012345678901| +use bug18344_012345678901| +create procedure bug18344() begin end| +create procedure bug18344_2() begin end| +create database bug18344_0123456789012| +use bug18344_0123456789012| +create procedure bug18344() begin end| +create procedure bug18344_2() begin end| +use test| +select schema_name from information_schema.schemata where +schema_name like 'bug18344%'| +schema_name +bug18344_012345678901 +bug18344_0123456789012 +select routine_name,routine_schema from information_schema.routines where +routine_schema like 'bug18344%'| +routine_name routine_schema +bug18344 bug18344_012345678901 +bug18344_2 bug18344_012345678901 +bug18344 bug18344_0123456789012 +bug18344_2 bug18344_0123456789012 +drop database bug18344_012345678901| +drop database bug18344_0123456789012| +select schema_name from information_schema.schemata where +schema_name like 'bug18344%'| +schema_name +select routine_name,routine_schema from information_schema.routines where +routine_schema like 'bug18344%'| +routine_name routine_schema drop table t1,t2; diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index d434f5c32ce..e39ddd1d79d 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -204,3 +204,4 @@ drop procedure bug10100pv| drop procedure bug10100pd| drop procedure bug10100pc| drop view v1| +drop table t3| diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 5461e4dd563..ca21b333a6a 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -23,3 +23,23 @@ select 1; show status like 'last_query_cost'; Variable_name Value Last_query_cost 0.000000 +FLUSH STATUS; +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 1 +SET @save_thread_cache_size=@@thread_cache_size; +SET GLOBAL thread_cache_size=3; +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 3 +FLUSH STATUS; +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 2 +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 3 +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 4 +SET GLOBAL thread_cache_size=@save_thread_cache_size; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 37823c66de9..e4850a19b4c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -744,7 +744,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `Not_used` having (<cache>(`test`.`t2`.`id`) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(`test`.`t2`.`id`) = <null_helper>(3)))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index 5cc4150e374..fe9e971af2f 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -1,4 +1,5 @@ drop table if exists t1, t2; +drop function if exists f1; create table t1 (ts timestamp); set time_zone='+00:00'; select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); @@ -268,3 +269,17 @@ select * from t1; convert_tz(NULL, NULL, NULL) NULL drop table t1; +create table t1 (ldt datetime, udt datetime); +create function f1(i datetime) returns datetime +return convert_tz(i, 'UTC', 'Europe/Moscow'); +create trigger t1_bi before insert on t1 for each row +set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC'); +insert into t1 (ldt) values ('2006-04-19 16:30:00'); +select * from t1; +ldt udt +2006-04-19 16:30:00 2006-04-19 12:30:00 +select ldt, f1(udt) as ldt2 from t1; +ldt ldt2 +2006-04-19 16:30:00 2006-04-19 16:30:00 +drop table t1; +drop function f1; diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result index 77cfe1c151e..49918038da5 100644 --- a/mysql-test/r/timezone_grant.result +++ b/mysql-test/r/timezone_grant.result @@ -1,3 +1,5 @@ +drop tables if exists t1, t2; +drop view if exists v1; delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%'; @@ -59,3 +61,18 @@ delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%'; flush privileges; drop table t1, t2; +create table t1 (a int, b datetime); +insert into t1 values (1, 20010101000000), (2, 20020101000000); +grant all privileges on test.* to mysqltest_1@localhost; +create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1; +select * from v1; +a lb +1 2001-01-01 03:00:00 +2 2002-01-01 03:00:00 +select * from v1, mysql.time_zone; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone' +drop view v1; +create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone; +ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 'time_zone' +drop table t1; +drop user mysqltest_1@localhost; diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index ac451c5c34d..5d5ea9511ba 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -949,6 +949,52 @@ insert into t1 values create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); -drop table t1; +drop table t1, t2; drop function f1; drop function f2; +create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j)); +create table t2(i int not null, n numeric(15,2), primary key(i)); +create trigger t1_ai after insert on t1 for each row +begin +declare sn numeric(15,2); +select sum(n) into sn from t1 where i=new.i; +replace into t2 values(new.i, sn); +end| +insert into t1 values +(1,1,10.00),(1,2,10.00),(1,3,10.00),(1,4,10.00),(1,5,10.00), +(1,6,10.00),(1,7,10.00),(1,8,10.00),(1,9,10.00),(1,10,10.00), +(1,11,10.00),(1,12,10.00),(1,13,10.00),(1,14,10.00),(1,15,10.00); +select * from t1; +i j n +1 1 10.00 +1 2 10.00 +1 3 10.00 +1 4 10.00 +1 5 10.00 +1 6 10.00 +1 7 10.00 +1 8 10.00 +1 9 10.00 +1 10 10.00 +1 11 10.00 +1 12 10.00 +1 13 10.00 +1 14 10.00 +1 15 10.00 +select * from t2; +i n +1 150.00 +drop tables t1, t2; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +conn_id INT, +trigger_conn_id INT +); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW +SET NEW.trigger_conn_id = CONNECTION_ID(); +INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); +INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); +SELECT * FROM t1 WHERE conn_id != trigger_conn_id; +conn_id trigger_conn_id +DROP TRIGGER t1_bi; +DROP TABLE t1; diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index 1b5f59c038a..01aa8539262 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -1,15 +1,15 @@ drop table if exists t1; -CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so'; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Can't find symbol 'myfunc_nonexist' in library -CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so'; -CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so"; -CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so'; +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; CREATE FUNCTION reverse_lookup -RETURNS STRING SONAME 'udf_example.so'; +RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; CREATE AGGREGATE FUNCTION avgcost -RETURNS REAL SONAME 'udf_example.so'; +RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; select myfunc_double(); ERROR HY000: myfunc_double must have at least one argument select myfunc_double(1); diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 8f2b89c18fd..9c3fdf0d8d2 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -215,9 +215,6 @@ select @@version; select @@global.version; @@global.version # -select @@session.VERSION; -@@session.VERSION -# set @first_var= NULL; create table t1 select @first_var; show create table t1; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index ec8a715de1b..43b32782c63 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -275,7 +275,7 @@ ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with select @@global.timestamp; ERROR HY000: Variable 'timestamp' is a SESSION variable set @@version=''; -ERROR HY000: Unknown system variable 'version' +ERROR HY000: Variable 'version' is a read only variable set @@concurrent_insert=1; ERROR HY000: Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL set @@global.sql_auto_is_null=1; @@ -384,6 +384,7 @@ select @@sql_max_join_size,@@max_join_size; set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; +set sql_select_limit=default; set sql_warnings=1; set global table_open_cache=100; set storage_engine=myisam; @@ -584,3 +585,31 @@ set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; @@global.character_set_filesystem binary +set @old_sql_big_selects = @@sql_big_selects; +set @@sql_big_selects = 1; +show variables like 'sql_big_selects'; +Variable_name Value +sql_big_selects ON +set @@sql_big_selects = @old_sql_big_selects; +set @@sql_notes = 0, @@sql_warnings = 0; +show variables like 'sql_notes'; +Variable_name Value +sql_notes OFF +show variables like 'sql_warnings'; +Variable_name Value +sql_warnings OFF +set @@sql_notes = 1, @@sql_warnings = 1; +show variables like 'sql_notes'; +Variable_name Value +sql_notes ON +show variables like 'sql_warnings'; +Variable_name Value +sql_warnings ON +select @@system_time_zone; +@@system_time_zone +# +select @@version, @@version_comment, @@version_compile_machine, +@@version_compile_os; +@@version @@version_comment @@version_compile_machine @@version_compile_os +# # # # +End of 5.0 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 0b6ebe9dd89..c5446ac314e 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2600,3 +2600,52 @@ id td 5 2005-01-04 DROP VIEW v1; DROP TABLE t1; +create table t1 (a int); +create view v1 as select * from t1; +create view v2 as select * from v1; +drop table t1; +rename table v2 to t1; +select * from v1; +ERROR HY000: `test`.`v1` contains view recursion +drop view t1, v1; +create table t1 (a int); +create function f1() returns int +begin +declare mx int; +select max(a) from t1 into mx; +return mx; +end// +create view v1 as select f1() as a; +create view v2 as select * from v1; +drop table t1; +rename table v2 to t1; +select * from v1; +ERROR HY000: Recursive stored functions and triggers are not allowed. +drop function f1; +drop view t1, v1; +create table t1 (dt datetime); +insert into t1 values (20040101000000), (20050101000000), (20060101000000); +create view v1 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from t1; +select * from v1; +ldt +2004-01-01 03:00:00 +2005-01-01 03:00:00 +2006-01-01 03:00:00 +drop view v1; +create view v1 as select * from t1 where convert_tz(dt, 'UTC', 'Europe/Moscow') >= 20050101000000; +select * from v1; +dt +2005-01-01 00:00:00 +2006-01-01 00:00:00 +create view v2 as select * from v1 where dt < 20060101000000; +select * from v2; +dt +2005-01-01 00:00:00 +drop view v2; +create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1; +select * from v2; +ldt +2005-01-01 03:00:00 +2006-01-01 03:00:00 +drop view v1, v2; +drop table t1; diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data Binary files differnew file mode 100644 index 00000000000..32494d5a1e7 --- /dev/null +++ b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data Binary files differnew file mode 100644 index 00000000000..2141fb0a6e4 --- /dev/null +++ b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl Binary files differnew file mode 100644 index 00000000000..cbe548e0ca5 --- /dev/null +++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log Binary files differnew file mode 100644 index 00000000000..e4e114d4b46 --- /dev/null +++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl Binary files differnew file mode 100644 index 00000000000..cbe548e0ca5 --- /dev/null +++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log Binary files differnew file mode 100644 index 00000000000..a1c89b7015c --- /dev/null +++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data Binary files differnew file mode 100644 index 00000000000..2407d1f261b --- /dev/null +++ b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data Binary files differnew file mode 100644 index 00000000000..f21e9886523 --- /dev/null +++ b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl Binary files differnew file mode 100644 index 00000000000..99e2f297693 --- /dev/null +++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log Binary files differnew file mode 100644 index 00000000000..4448cd98c04 --- /dev/null +++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl Binary files differnew file mode 100644 index 00000000000..99e2f297693 --- /dev/null +++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log Binary files differnew file mode 100644 index 00000000000..3be69891402 --- /dev/null +++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 42536ce8a3b..1bdfc5cc10f 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -122,6 +122,17 @@ SELECT 'case+union+test' UNION SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END; +# +# Bug #17896: problem with MIN(CASE...) +# + +create table t1(a float, b int default 3); +insert into t1 (a) values (2), (11), (8); +select min(a), min(case when 1=1 then a else NULL end), + min(case when 1!=1 then NULL else a end) +from t1 where b=3 group by b; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 533da542855..b733a23f398 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -47,7 +47,7 @@ select cast('1a' as signed); select cast('' as signed); # -# Character set convertion +# Character set conversion # set names binary; select cast(_latin1'test' as char character set latin2); diff --git a/mysql-test/t/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test index 626d83fa17d..3925d02659d 100644 --- a/mysql-test/t/ctype_latin2_ch.test +++ b/mysql-test/t/ctype_latin2_ch.test @@ -28,3 +28,5 @@ select * from t1 ignore index (primary) where tt like 'AA%'; select * from t1 where tt like '%AA%'; # End of 4.1 tests + +drop table t1; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index af46b9c385a..c7662f4f85a 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -410,6 +410,14 @@ DROP TABLE t1; SET NAMES latin1; # +# Bug#18691 Converting number to UNICODE string returns invalid result +# +SELECT CONVERT(103, CHAR(50) UNICODE); +SELECT CONVERT(103.0, CHAR(50) UNICODE); +SELECT CONVERT(-103, CHAR(50) UNICODE); +SELECT CONVERT(-103.0, CHAR(50) UNICODE); + +# # Bug#9557 MyISAM utf8 table crash # CREATE TABLE t1 ( diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 2a9feec91c1..d92aed1d1a2 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -12,45 +12,29 @@ events_bugs : BUG#17619 2006-02-21 andrey Race conditions events_stress : BUG#17619 2006-02-21 andrey Race conditions events : BUG#17619 2006-02-21 andrey Race conditions -events_scheduling : BUG#18958 2006-04-13 andrey Test case unstable -events_logs_tests : BUG#18953 2006-04-12 kent Test is randomly failing +events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog -ndb_cache2 : BUG#18597 2006-03-28 brian simultaneous drop table and ndb statistics update triggers node failure -ndb_cache_multi2 : BUG#18597 2006-04-10 kent simultaneous drop table and ndb statistics update triggers node failure +ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown +#ndb_cache2 : BUG#18597 2006-03-28 brian simultaneous drop table and ndb statistics update triggers node failure +#ndb_cache_multi2 : BUG#18597 2006-04-10 kent simultaneous drop table and ndb statistics update triggers node failure partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open -rpl_deadlock_innodb : BUG#16920 2006-04-12 kent fails in show slave status (randomly) -rpl_ndb_2innodb : BUG#19004 2006-03-22 tomas ndb: partition by range and update hangs -rpl_ndb_2myisam : BUG#19004 2006-03-22 tomas ndb: partition by range and update hangs +rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated +rpl_ndb_2myisam : BUG#19227 2006-04-20 pekka pk delete apparently not replicated rpl_ndb_auto_inc : BUG#17086 2006-02-16 jmiller CR: auto_increment_increment and auto_increment_offset produce duplicate key er -rpl_ndb_ddl : result file needs update + test needs to checked -rpl_ndb_innodb2ndb : BUG#18094 2006-03-16 mats Slave caches invalid table definition after atlters causes select failure +rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on solaris +rpl_ndb_ddl : BUG#18946 result file needs update + test needs to checked +rpl_ndb_innodb2ndb : BUG#17400 2006-04-19 tomas Cluster Replication: delete & update of rows in table without pk fails on slave. rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ -rpl_ndb_myisam2ndb : BUG#18094 2006-03-16 mats Slave caches invalid table definition after atlters causes select failure -#rpl_ndb_relay_space : BUG#16993 2006-02-16 jmiller RBR: ALTER TABLE ZEROFILL AUTO_INCREMENT is not replicated correctly +rpl_ndb_myisam2ndb : BUG#17400 2006-04-19 tomas Cluster Replication: delete & update of rows in table without pk fails on slave. rpl_switch_stm_row_mixed : BUG#18590 2006-03-28 brian -#rpl_row_basic_7ndb : BUG#17400 2006-04-09 brian Cluster Replication: delete & update of rows in table without pk fails on slave. rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed rpl_row_inexist_tbl : BUG#18948 2006-03-09 mats Disabled since patch makes this test wait forever rpl_sp : BUG#16456 2006-02-16 jmiller -rpl_until : BUG#15886 2006-02-16 jmiller Unstable test case -sp-goto : BUG#18949 2006-02-16 jmiller GOTO is currently is disabled - will be fixed in the future mysqldump : BUG#18078 2006-03-10 lars udf : BUG#18564 2006-03-27 ian (Permission by Brian) # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open #ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events - -# the below ndb failures have not been objerved for > 5 push builds, close bugs -#ndb_gis : BUG#18600 2006-03-28 brian ndb_gis test failure -#ndb_load : BUG#17233 2006-02-16 jmiller failed load data from infile causes mysqld dbug_assert, binlog not flushed -#rpl_ndb_basic : BUG#18592 2006-03-28 brian rpl_ndb_basic failure -#rpl_ndb_dd_advance : BUG#18924 2006-04-09 brian rpl_ndb_dd_advance failure -rpl_ndb_dd_partitions : BUG#18094 2006-04-19 mats Slave caches invalid table definition... -#rpl_ndb_dd_basic : BUG#18569 2006-03-28 brian rpl_ndb_dd_basic failure -#rpl_ndb_insert_ignore : BUG#18567 2006-03-28 brian rpl_ndb_insert_ignore failure -#rpl_ndb_multi_update2 : BUG#18928 2006-04-09 brian rpl_ndb_multi_update2 failed -#rpl_ndb_multi_update3 : BUG#18627 2006-03-29 monty Cluster Replication: rpl_ndb_multi_update3 fails on Intel 64 bit -#rpl_ndb_trig004 : BUG#18977 2006-04-10 kent Test fails randomly diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test index f80297682b7..fbcd4924d56 100644 --- a/mysql-test/t/events.test +++ b/mysql-test/t/events.test @@ -320,9 +320,9 @@ drop event one_event; create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; drop event e_26; ---error 1504 +--error ER_WRONG_VALUE create event e_26 on schedule at NULL disabled do set @a = 5; ---error 1504 +--error ER_WRONG_VALUE create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5; set names utf8; diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test index e586184c9e4..21adc17d5b8 100644 --- a/mysql-test/t/events_logs_tests.test +++ b/mysql-test/t/events_logs_tests.test @@ -56,6 +56,7 @@ SET GLOBAL long_query_time=4; SET SESSION long_query_time=2; --echo "Check that logging is working" SELECT SLEEP(3); +--replace_regex /00:00:0[3-5]/SLEEPVAL/ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; TRUNCATE mysql.slow_log; CREATE TABLE slow_event_test (slo_val tinyint, val tinyint); @@ -79,6 +80,7 @@ CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_te --echo "Check our table. Should see 2 rows" SELECT * FROM slow_event_test; --echo "Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10" +--replace_regex /00:00:0[5-7]/SLEEPVAL/ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; DROP EVENT long_event2; SET GLOBAL long_query_time =@old_global_long_query_time; diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index f83d919515b..ae3cc7d5fac 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -4,7 +4,9 @@ CREATE TABLE table_1(a int); CREATE TABLE table_2(a int); CREATE TABLE table_3(a int); CREATE TABLE table_4(a int); +CREATE TABLE T19170(s1 TIMESTAMP); SET GLOBAL event_scheduler=1; +CREATE EVENT E19170 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO T19170 VALUES(CURRENT_TIMESTAMP); CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1); CREATE EVENT start_n_end ON SCHEDULE EVERY 1 SECOND @@ -21,7 +23,7 @@ SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_3; SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4; DROP EVENT two_sec; SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; -SELECT IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; DROP EVENT start_n_end; --echo "Already dropped because ended. Therefore an error." --error ER_EVENT_DOES_NOT_EXIST @@ -33,4 +35,6 @@ DROP TABLE table_1; DROP TABLE table_2; DROP TABLE table_3; DROP TABLE table_4; +--echo "Checking for multiple executions in one second, should not happen -> 0 as result" +SELECT COUNT(*) FROM (SELECT s1, COUNT(*) AS cnt FROM T19170 GROUP BY s1) AS tmp WHERE tmp.cnt > 1; DROP DATABASE events_test; diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index a78017ddb2f..4ae749f2343 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -47,4 +47,13 @@ set @@max_allowed_packet=1048576*100; --replace_result "''" XXX "'1'" XXX eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null; +# +# Bug #18643: problem with null values +# + +create table t1(a blob); +insert into t1 values(NULL), (compress('a')); +select uncompress(a), uncompressed_length(a) from t1; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index aa28c9d5f52..fbfdfa3b5d0 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -397,6 +397,17 @@ insert into t1 values(1),(2),(3); select f1, group_concat(f1+1) from t1 group by f1 with rollup; select count(distinct (f1+1)) from t1 group by f1 with rollup; drop table t1; + +# +# Bug#14169 type of group_concat() result changed to blob if tmp_table was used +# +create table t1 (f1 int unsigned, f2 varchar(255)); +insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +--enable_metadata +select f2,group_concat(f1) from t1 group by f2; +--disable_metadata +drop table t1; + # End of 4.1 tests # diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 0472968f918..351d1fc2c92 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -1,6 +1,6 @@ # Initialise --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings # # test of IN (NULL) @@ -128,3 +128,95 @@ SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + +# BUG#15872: Excessive memory consumption of range analysis of NOT IN +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, filler char(200), key(a)); + +insert into t2 select C.a*2, 'no' from t1 A, t1 B, t1 C; +insert into t2 select C.a*2+1, 'yes' from t1 C; + +explain +select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); +select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); + +explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2); +explain select * from t2 force index(a) where a <> 2; + +drop table t2; + +# +# Repeat the test for DATETIME +# +create table t2 (a datetime, filler char(200), key(a)); + +insert into t2 select '2006-04-25 10:00:00' + interval C.a minute, + 'no' from t1 A, t1 B, t1 C where C.a % 2 = 0; + +insert into t2 select '2006-04-25 10:00:00' + interval C.a*2+1 minute, + 'yes' from t1 C; + +explain +select * from t2 where a NOT IN ( + '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', + '2006-04-25 10:06:00', '2006-04-25 10:08:00'); +select * from t2 where a NOT IN ( + '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', + '2006-04-25 10:06:00', '2006-04-25 10:08:00'); +drop table t2; + +# +# Repeat the test for CHAR(N) +# +create table t2 (a varchar(10), filler char(200), key(a)); + +insert into t2 select 'foo', 'no' from t1 A, t1 B; +insert into t2 select 'barbar', 'no' from t1 A, t1 B; +insert into t2 select 'bazbazbaz', 'no' from t1 A, t1 B; + +insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'), + ('barbas','1'), ('bazbazbay', '1'),('zz','1'); + +explain select * from t2 where a not in('foo','barbar', 'bazbazbaz'); + +drop table t2; + +# +# Repeat for DECIMAL +# +create table t2 (a decimal(10,5), filler char(200), key(a)); + +insert into t2 select 345.67890, 'no' from t1 A, t1 B; +insert into t2 select 43245.34, 'no' from t1 A, t1 B; +insert into t2 select 64224.56344, 'no' from t1 A, t1 B; + +insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'), + (55555,'1'), (77777, '1'); + +explain +select * from t2 where a not in (345.67890, 43245.34, 64224.56344); +select * from t2 where a not in (345.67890, 43245.34, 64224.56344); + +drop table t2; + +# Try a very big IN-list +create table t2 (a int, key(a), b int); +insert into t2 values (1,1),(2,2); + +set @cnt= 1; +set @str="update t2 set b=1 where a not in ("; +select count(*) from ( + select @str:=concat(@str, @cnt:=@cnt+1, ",") + from t1 A, t1 B, t1 C, t1 D) Z; + +set @str:=concat(@str, "10000)"); +select substr(@str, 1, 50); +prepare s from @str; +execute s; +deallocate prepare s; +set @str=NULL; + +drop table t2; +drop table t1; + diff --git a/mysql-test/t/func_op.test b/mysql-test/t/func_op.test index 24266150e4c..0a4f5034f4c 100644 --- a/mysql-test/t/func_op.test +++ b/mysql-test/t/func_op.test @@ -17,4 +17,18 @@ select 0 | -1, 0 ^ -1, 0 & -1; select -1 >> 0, -1 << 0; select -1 >> 1, -1 << 1; +# +# Bug 13044: wrong bit_count() results +# + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings +create table t1(a int); +create table t2(a int, b int); +insert into t1 values (1), (2), (3); +insert into t2 values (1, 7), (3, 7); +select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a; +drop table t1, t2; + # End of 4.1 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index ef20d766bce..85cedee0f4a 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -684,4 +684,11 @@ insert into t1 values ('y,abc'),('y,abc'); select c, substring_index(lcase(c), @q:=',', -1) as res from t1; drop table t1; -# End of 5.0 tests +# +# Bug #17043: Casting trimmed string to decimal loses precision +# +select cast(rtrim(' 20.06 ') as decimal(19,2)); +select cast(ltrim(' 20.06 ') as decimal(19,2)); +select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)); + +--echo End of 5.0 tests diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index ce1d0fb2271..b3e2d2f7998 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -462,3 +462,29 @@ drop table t1, t2; drop database TESTDB; flush privileges; +# +# BUG#13310 incorrect user parsing by SP +# + +grant all privileges on test.* to `a@`@localhost; +grant execute on * to `a@`@localhost; +connect (bug13310,localhost,'a@',,test); +connection bug13310; +create table t2 (s1 int); +insert into t2 values (1); +--disable_warnings +drop function if exists f2; +--enable_warnings +delimiter //; +create function f2 () returns int begin declare v int; select s1 from t2 +into v; return v; end// +delimiter ;// +select f2(); + +drop function f2; +drop table t2; +disconnect bug13310; + +connection default; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; +drop user `a@`@localhost; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 9b21e544657..41266cc6d32 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -393,3 +393,16 @@ SELECT EMPNUM, GRADE*1000 HAVING HU.PROJ.CITY = HU.STAFF.CITY); DROP SCHEMA HU; +USE test; +# +# Bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode. +# +create table t1(f1 int); +select f1 from t1 having max(f1)=f1; +select f1 from t1 group by f1 having max(f1)=f1; +set session sql_mode='ONLY_FULL_GROUP_BY'; +--error ER_NON_GROUPING_FIELD_USED +select f1 from t1 having max(f1)=f1; +select f1 from t1 group by f1 having max(f1)=f1; +set session sql_mode=''; +drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index c6dd9c7226d..b7151b03ae1 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1,10 +1,13 @@ # This test uses grants, which can't get tested for embedded server -- source include/not_embedded.inc -# check that CSV engine was compiled in, as the result of the test -# depends on the presence of the log tables (which are CSV-based). +# check that CSV engine was compiled in, as the result of the test depends +# on the presence of the log tables (which are CSV-based). --source include/have_csv.inc +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + # Test for information_schema.schemata & # show databases diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test index 9cd64a54ad9..195bf57a880 100644 --- a/mysql-test/t/information_schema_inno.test +++ b/mysql-test/t/information_schema_inno.test @@ -21,3 +21,35 @@ select * from information_schema.KEY_COLUMN_USAGE where TABLE_SCHEMA= "test"; drop table t3, t2, t1; + +# +# Test for REFERENTIAL_CONSTRAINTS table +# +CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL, + PRIMARY KEY(a1, a2)) ENGINE=INNODB; +CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2), + CONSTRAINT A1 + FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2) + ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB; +CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2), + CONSTRAINT A2 + FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2) + ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB; +CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2), + CONSTRAINT A3 + FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2) + ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB; +CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2), + CONSTRAINT A4 + FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2) + ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB; + + +select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE, + b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, + MATCH_OPTION, UPDATE_RULE, DELETE_RULE +from information_schema.TABLE_CONSTRAINTS a, + information_schema.REFERENTIAL_CONSTRAINTS b +where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and +a.CONSTRAINT_NAME = b.CONSTRAINT_NAME; +drop tables t5, t4, t3, t2, t1; diff --git a/mysql-test/t/innodb-master.opt b/mysql-test/t/innodb-master.opt index 4cb927540bf..4901efb416c 100644 --- a/mysql-test/t/innodb-master.opt +++ b/mysql-test/t/innodb-master.opt @@ -1 +1 @@ ---binlog_cache_size=32768 +--binlog_cache_size=32768 --innodb_lock_wait_timeout=1 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index ab408e9b4a5..cadb611714c 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1,3 +1,16 @@ +####################################################################### +# # +# Please, DO NOT TOUCH this file as well as the innodb.result file. # +# These files are to be modified ONLY BY INNOBASE guys. # +# # +# Use innodb_mysql.[test|result] files instead. # +# # +# If nevertheless you need to make some changes here, please, forward # +# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com # +# (otherwise your changes may be erased). # +# # +####################################################################### + -- source include/have_innodb.inc # @@ -901,10 +914,10 @@ insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; select count(*) from t1; --replace_column 9 # -explain select * from t1 where c between 1 and 10000; +explain select * from t1 where c between 1 and 2500; update t1 set c=a; --replace_column 9 # -explain select * from t1 where c between 1 and 10000; +explain select * from t1 where c between 1 and 2500; drop table t1,t2; # @@ -2130,18 +2143,6 @@ disconnect a; disconnect b; # -# Bug #14360: problem with intervals -# - -create table t1(a date) engine=innodb; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 - where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -drop table t1, t2; - -# # Test that cascading updates leading to duplicate keys give the correct # error message (bug #9680) # @@ -2193,3 +2194,303 @@ alter table t1 drop foreign key c2_fk; show create table t1; # drop table t1, t2; + +# +# Bug #14360: problem with intervals +# + +create table t1(a date) engine=innodb; +create table t2(a date, key(a)) engine=innodb; +insert into t1 values('2005-10-01'); +insert into t2 values('2005-10-01'); +select * from t1, t2 + where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; +drop table t1, t2; + +create table t1 (id int not null, f_id int not null, f int not null, +primary key(f_id, id)) engine=innodb; +create table t2 (id int not null,s_id int not null,s varchar(200), +primary key(id)) engine=innodb; +INSERT INTO t1 VALUES (8, 1, 3); +INSERT INTO t1 VALUES (1, 2, 1); +INSERT INTO t2 VALUES (1, 0, ''); +INSERT INTO t2 VALUES (8, 1, ''); +commit; +DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) +WHERE mm.id IS NULL; +select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) +where mm.id is null lock in share mode; +drop table t1,t2; + +# +# Test case where X-locks on unused rows should be released in a +# update (because READ COMMITTED isolation level) +# + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); +commit; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +update t1 set b = 5 where b = 1; +connection b; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +# +# X-lock to record (7,3) should be released in a update +# +select * from t1 where a = 7 and b = 3 for update; +connection a; +commit; +connection b; +commit; +drop table t1; +connection default; +disconnect a; +disconnect b; + +# +# Test case where no locks should be released (because we are not +# using READ COMMITTED isolation level) +# + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); +commit; +set autocommit = 0; +select * from t1 lock in share mode; +update t1 set b = 5 where b = 1; +connection b; +set autocommit = 0; +# +# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update +# +--error 1205 +select * from t1 where a = 2 and b = 2 for update; +# +# X-lock to record (1,1),(3,1),(5,1) should not be released in a update +# +--error 1205 +connection a; +commit; +connection b; +commit; +connection default; +disconnect a; +disconnect b; +drop table t1; + +# +# Consistent read should be used in following selects +# +# 1) INSERT INTO ... SELECT +# 2) UPDATE ... = ( SELECT ...) +# 3) CREATE ... SELECT + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(d int not null, e int, primary key(d)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +connection b; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +insert into t1 select * from t2; +update t1 set b = (select e from t2 where a = d); +create table t3(d int not null, e int, primary key(d)) engine=innodb +select * from t2; +commit; +connection a; +commit; +connection default; +disconnect a; +disconnect b; +drop table t1, t2, t3; + +# +# Consistent read should not be used if +# +# (a) isolation level is serializable OR +# (b) select ... lock in share mode OR +# (c) select ... for update +# +# in following queries: +# +# 1) INSERT INTO ... SELECT +# 2) UPDATE ... = ( SELECT ...) +# 3) CREATE ... SELECT + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connect (c,localhost,root,,); +connect (d,localhost,root,,); +connect (e,localhost,root,,); +connect (f,localhost,root,,); +connect (g,localhost,root,,); +connect (h,localhost,root,,); +connect (i,localhost,root,,); +connect (j,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(a int not null, b int, primary key(a)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +create table t3(d int not null, b int, primary key(d)) engine=innodb; +insert into t3 values (8,6),(12,1),(3,1); +create table t5(a int not null, b int, primary key(a)) engine=innodb; +insert into t5 values (1,2),(5,3),(4,2); +create table t6(d int not null, e int, primary key(d)) engine=innodb; +insert into t6 values (8,6),(12,1),(3,1); +create table t8(a int not null, b int, primary key(a)) engine=innodb; +insert into t8 values (1,2),(5,3),(4,2); +create table t9(d int not null, e int, primary key(d)) engine=innodb; +insert into t9 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +connection b; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +--send +insert into t1 select * from t2; +connection c; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +--send +update t3 set b = (select b from t2 where a = d); +connection d; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +--send +create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; +connection e; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--send +insert into t5 (select * from t2 lock in share mode); +connection f; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--send +update t6 set e = (select b from t2 where a = d lock in share mode); +connection g; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--send +create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; +connection h; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--send +insert into t8 (select * from t2 for update); +connection i; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--send +update t9 set e = (select b from t2 where a = d for update); +connection j; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--send +create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; + +connection b; +--error 1205 +reap; + +connection c; +--error 1205 +reap; + +connection d; +--error 1205 +reap; + +connection e; +--error 1205 +reap; + +connection f; +--error 1205 +reap; + +connection g; +--error 1205 +reap; + +connection h; +--error 1205 +reap; + +connection i; +--error 1205 +reap; + +connection j; +--error 1205 +reap; + +connection a; +commit; + +connection default; +disconnect a; +disconnect b; +disconnect c; +disconnect d; +disconnect e; +disconnect f; +disconnect g; +disconnect h; +disconnect i; +disconnect j; +drop table t1, t2, t3, t5, t6, t8, t9; + +# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID" +--error 1005 +CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; + +# +# Bug #17152: Wrong result with BINARY comparison on aliased column +# + +CREATE TABLE t1 ( + a BIGINT(20) NOT NULL, + PRIMARY KEY (a) + ) ENGINE=INNODB DEFAULT CHARSET=UTF8; + +CREATE TABLE t2 ( + a BIGINT(20) NOT NULL, + b VARCHAR(128) NOT NULL, + c TEXT NOT NULL, + PRIMARY KEY (a,b), + KEY idx_t2_b_c (b,c(200)), + CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) + ON DELETE CASCADE + ) ENGINE=INNODB DEFAULT CHARSET=UTF8; + +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1, 'bar', 'vbar'); +INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR'); +INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi'); +INSERT INTO t2 VALUES (1, 'customer_over', '1'); + +SELECT * FROM t2 WHERE b = 'customer_over'; +SELECT * FROM t2 WHERE BINARY b = 'customer_over'; +SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over'; +/* Bang: Empty result set, above was expected: */ +SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; +SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; + +drop table t2, t1; diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test new file mode 100644 index 00000000000..b942b9fbc0d --- /dev/null +++ b/mysql-test/t/innodb_mysql.test @@ -0,0 +1,5 @@ +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings diff --git a/mysql-test/t/innodb_unsafe_binlog-master.opt b/mysql-test/t/innodb_unsafe_binlog-master.opt index 503c8457b2c..9581c225d6d 100644 --- a/mysql-test/t/innodb_unsafe_binlog-master.opt +++ b/mysql-test/t/innodb_unsafe_binlog-master.opt @@ -1 +1 @@ ---innodb_locks_unsafe_for_binlog=true +--innodb_locks_unsafe_for_binlog=true --innodb_lock_wait_timeout=1 diff --git a/mysql-test/t/innodb_unsafe_binlog.test b/mysql-test/t/innodb_unsafe_binlog.test index e4cb683e59d..af1091e4421 100644 --- a/mysql-test/t/innodb_unsafe_binlog.test +++ b/mysql-test/t/innodb_unsafe_binlog.test @@ -1,7 +1,9 @@ -- source include/have_innodb.inc # -# Note that these tests uses a innodb_locks_unsafe_for_binlog option. -# +# Note that these tests uses options +# innodb_locks_unsafe_for_binlog = true +# innodb_lock_timeout = 5 + # # Test cases for a bug #15650 # @@ -33,7 +35,7 @@ connect (a,localhost,root,,); connect (b,localhost,root,,); connection a; create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; select * from t1 lock in share mode; @@ -50,6 +52,197 @@ commit; connection b; commit; drop table t1; +connection default; +disconnect a; +disconnect b; + +# +# unlock row test +# + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); +commit; +set autocommit = 0; +update t1 set b = 5 where b = 1; +connection b; +set autocommit = 0; +# +# X-lock to record (7,3) should be released in a update +# +select * from t1 where a = 7 and b = 3 for update; +commit; +connection a; +commit; +drop table t1; +connection default; +disconnect a; +disconnect b; + + +# +# Consistent read should be used in following selects +# +# 1) INSERT INTO ... SELECT +# 2) UPDATE ... = ( SELECT ...) +# 3) CREATE ... SELECT + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(d int not null, e int, primary key(d)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +connection b; +set autocommit = 0; +insert into t1 select * from t2; +update t1 set b = (select e from t2 where a = d); +create table t3(d int not null, e int, primary key(d)) engine=innodb +select * from t2; +commit; +connection a; +commit; +connection default; disconnect a; disconnect b; +drop table t1, t2, t3; +# +# Consistent read should not be used if +# +# (a) isolation level is serializable OR +# (b) select ... lock in share mode OR +# (c) select ... for update +# +# in following queries: +# +# 1) INSERT INTO ... SELECT +# 2) UPDATE ... = ( SELECT ...) +# 3) CREATE ... SELECT + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connect (c,localhost,root,,); +connect (d,localhost,root,,); +connect (e,localhost,root,,); +connect (f,localhost,root,,); +connect (g,localhost,root,,); +connect (h,localhost,root,,); +connect (i,localhost,root,,); +connect (j,localhost,root,,); +connection a; +create table t1(a int not null, b int, primary key(a)) engine=innodb; +insert into t1 values (1,2),(5,3),(4,2); +create table t2(a int not null, b int, primary key(a)) engine=innodb; +insert into t2 values (8,6),(12,1),(3,1); +create table t3(d int not null, b int, primary key(d)) engine=innodb; +insert into t3 values (8,6),(12,1),(3,1); +create table t5(a int not null, b int, primary key(a)) engine=innodb; +insert into t5 values (1,2),(5,3),(4,2); +create table t6(d int not null, e int, primary key(d)) engine=innodb; +insert into t6 values (8,6),(12,1),(3,1); +create table t8(a int not null, b int, primary key(a)) engine=innodb; +insert into t8 values (1,2),(5,3),(4,2); +create table t9(d int not null, e int, primary key(d)) engine=innodb; +insert into t9 values (8,6),(12,1),(3,1); +commit; +set autocommit = 0; +select * from t2 for update; +connection b; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +--send +insert into t1 select * from t2; +connection c; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +--send +update t3 set b = (select b from t2 where a = d); +connection d; +set autocommit = 0; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +--send +create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; +connection e; +set autocommit = 0; +--send +insert into t5 (select * from t2 lock in share mode); +connection f; +set autocommit = 0; +--send +update t6 set e = (select b from t2 where a = d lock in share mode); +connection g; +set autocommit = 0; +--send +create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; +connection h; +set autocommit = 0; +--send +insert into t8 (select * from t2 for update); +connection i; +set autocommit = 0; +--send +update t9 set e = (select b from t2 where a = d for update); +connection j; +set autocommit = 0; +--send +create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; + +connection b; +--error 1205 +reap; + +connection c; +--error 1205 +reap; + +connection d; +--error 1205 +reap; + +connection e; +--error 1205 +reap; + +connection f; +--error 1205 +reap; + +connection g; +--error 1205 +reap; + +connection h; +--error 1205 +reap; + +connection i; +--error 1205 +reap; + +connection j; +--error 1205 +reap; + +connection a; +commit; + +connection default; +disconnect a; +disconnect b; +disconnect c; +disconnect d; +disconnect e; +disconnect f; +disconnect g; +disconnect h; +disconnect i; +disconnect j; +drop table t1, t2, t3, t5, t6, t8, t9; diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index df584021af1..4001e0df4af 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -149,6 +149,7 @@ show status like 'key_blocks_used'; --replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED show status like 'key_blocks_unused'; + # Cleanup # We don't reset keycache2 as we want to ensure that mysqld will reset it set global keycache2.key_buffer_size=0; @@ -157,7 +158,7 @@ set global keycache2.key_buffer_size=0; set global keycache3.key_buffer_size=100; set global keycache3.key_buffer_size=0; -# Test case for buf 6447 +# Test case for bug 6447 create table t1 (mytext text, FULLTEXT (mytext)); insert t1 values ('aaabbb'); @@ -169,6 +170,44 @@ check table t1; drop table t1; # +# Bug #19079: corrupted index when key_cache_block_size is not multiple of +# myisam_block_size + +CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY); +SET GLOBAL key_cache_block_size=1536; +INSERT INTO t1 VALUES (1); +SELECT @@key_cache_block_size; +CHECK TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int); +CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int); +SET GLOBAL key_cache_block_size=1536; +INSERT INTO t1 VALUES (1,0); +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +INSERT INTO t2(b) SELECT b FROM t1; +INSERT INTO t1(b) SELECT b FROM t2; +SELECT COUNT(*) FROM t1; +SELECT @@key_cache_block_size; +CHECK TABLE t1; +DROP TABLE t1,t2; + +# # Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO # (One cannot drop the default key cache.) # diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 95cba2743da..e76553f42e7 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -67,3 +67,8 @@ drop table t1; # --exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('á›–áš´ áš·á›–á›'); select * from t1; DROP TABLE t1;" +# +# "DESCRIBE" commands may return strange NULLness flags. +# +--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;" + diff --git a/mysql-test/t/mysql_client_test-master.opt b/mysql-test/t/mysql_client_test-master.opt new file mode 100644 index 00000000000..3711946168d --- /dev/null +++ b/mysql-test/t/mysql_client_test-master.opt @@ -0,0 +1 @@ +--log --log-output=FILE diff --git a/mysql-test/t/ndb_binlog_discover.test b/mysql-test/t/ndb_binlog_discover.test new file mode 100644 index 00000000000..e74bd3380bd --- /dev/null +++ b/mysql-test/t/ndb_binlog_discover.test @@ -0,0 +1,19 @@ +-- source include/have_ndb.inc +-- source include/have_binlog_format_row.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Bug #14516 Restart of cluster can cause NDB API replication failure +# +create table t1 (a int key) engine=ndb; +reset master; +--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null +--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null +--exec $NDB_MGM --no-defaults -e "all start" > /dev/null +--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null +insert into t1 values(1); +--source include/show_binlog_events.inc +drop table t1; diff --git a/mysql-test/t/ndb_dd_basic.test b/mysql-test/t/ndb_dd_basic.test index 0bc0e07fad8..9df2cfb0371 100644 --- a/mysql-test/t/ndb_dd_basic.test +++ b/mysql-test/t/ndb_dd_basic.test @@ -14,16 +14,33 @@ DROP TABLE IF EXISTS t1; --enable_warnings +# some negative tests +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=MYISAM; + +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=XYZ; + +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M; + ################################## # Basic test of disk tables for NDB # Start by creating a logfile group ################################## +set storage_engine=ndb; CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' INITIAL_SIZE 16M -UNDO_BUFFER_SIZE = 1M -ENGINE=NDB; +UNDO_BUFFER_SIZE = 1M; ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undofile02.dat' @@ -34,6 +51,7 @@ ENGINE=NDB; # Create a tablespace connected to the logfile group ################################################### +set storage_engine=myisam; CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test index 4fb6422b359..700ff55c2d5 100644 --- a/mysql-test/t/ndb_index_unique.test +++ b/mysql-test/t/ndb_index_unique.test @@ -32,8 +32,8 @@ select * from t1 order by a; alter table t1 drop index ib; insert into t1 values(1, 2, 3); # Bug# #18129 -#--error 1169 -#create unique index ib on t1(b); +--error 1169 +create unique index ib on t1(b); drop table t1; diff --git a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test index 87933671529..ce939663ab8 100644 --- a/mysql-test/t/ndb_partition_key.test +++ b/mysql-test/t/ndb_partition_key.test @@ -155,6 +155,24 @@ ALTER TABLE t1 COALESCE PARTITION 4; DROP TABLE t1; # +# Bug 16822: OPTIMIZE TABLE hangs test +# +CREATE TABLE t1 (a int primary key) +ENGINE=NDB +PARTITION BY KEY(a); +--error 1031 +ALTER TABLE t1 OPTIMIZE PARTITION p0; +--error 1031 +ALTER TABLE t1 CHECK PARTITION p0; +--error 1031 +ALTER TABLE t1 REPAIR PARTITION p0; +--error 1031 +ALTER TABLE t1 ANALYZE PARTITION p0; +--error 1031 +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; + +# # BUG 16806: ALTER TABLE fails # CREATE TABLE t1 ( diff --git a/mysql-test/t/ndb_restore_compat.test b/mysql-test/t/ndb_restore_compat.test new file mode 100644 index 00000000000..774011e362d --- /dev/null +++ b/mysql-test/t/ndb_restore_compat.test @@ -0,0 +1,43 @@ +-- source include/have_ndb.inc +-- source include/not_embedded.inc +-- source include/have_case_sensitive_file_system.inc + +# This test currently requires case sensitive file system as the tables +# are originally stored with uppercase + +# +# Bug #18594 ndb_restore log boken in 5.1 +# + +--disable_warnings +DROP DATABASE IF EXISTS BANK; +--enable_warnings +CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin; +USE BANK; +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT +SHOW TABLES; +SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; +SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; +SELECT COUNT(*) FROM TRANSACTION; +SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; +SELECT * FROM cluster.apply_status WHERE server_id=0; + +# +# verify restore of 5.0 backup +# here we must use the already created tables as restoring the old +# table definitions will not work +# +TRUNCATE GL; +TRUNCATE ACCOUNT; +TRUNCATE TRANSACTION; +TRUNCATE SYSTEM_VALUES; +TRUNCATE ACCOUNT_TYPE; +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT +SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; +SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; +SELECT COUNT(*) FROM TRANSACTION; +SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; +SELECT * FROM cluster.apply_status WHERE server_id=0; +DROP DATABASE BANK; diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 183308880ed..4aec745f3f7 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -190,4 +190,45 @@ select # Restore charset to the default value. set names latin1; +# +# Bug#19145: mysqld crashes if you set the default value of an enum field to NULL +# +create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM; +create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM; + +create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM; + +# Invalid default value for 's' +--error 1067 +create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM; + +# Invalid default value for 'e' +--error 1067 +create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM; + +alter table bug19145a alter column e set default null; +alter table bug19145a alter column s set default null; +alter table bug19145a add column (i int); + +alter table bug19145b alter column e set default null; +alter table bug19145b alter column s set default null; +alter table bug19145b add column (i int); + +# Invalid default value for 'e' +--error 1067 +alter table bug19145c alter column e set default null; + +# Invalid default value for 's' +--error 1067 +alter table bug19145c alter column s set default null; +alter table bug19145c add column (i int); + +show create table bug19145a; +show create table bug19145b; +show create table bug19145c; + +drop table bug19145a; +drop table bug19145b; +drop table bug19145c; + # End of 4.1 tests diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 359b8b69a4d..4cc9113048f 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -48,9 +48,9 @@ select * from t1; delete from t1; connection default; -delete from mysql.user where user='ssl_user%'; -delete from mysql.db where user='ssl_user%'; -flush privileges; +drop user ssl_user1@localhost, ssl_user2@localhost, +ssl_user3@localhost, ssl_user4@localhost; + drop table t1; # End of 4.1 tests diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index b1807579b20..98e542dac95 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -563,4 +563,18 @@ SELECT a FROM t1 ORDER BY a; (SELECT a FROM t1) ORDER BY a; DROP TABLE t1; +# +# Bug #18767: global ORDER BY applied to a SELECT with ORDER BY either was +# ignored or 'concatened' to the latter. + +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,30), (2,20), (1,10), (2,30), (1,20), (2,10); + +(SELECT b,a FROM t1 ORDER BY a,b) ORDER BY b,a; +(SELECT b FROM t1 ORDER BY b DESC) ORDER BY b ASC; +(SELECT b,a FROM t1 ORDER BY b,a) ORDER BY a,b; +(SELECT b,a FROM t1 ORDER by b,a LIMIT 3) ORDER by a,b; + +DROP TABLE t1; + # End of 4.1 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 9ffdb72ca22..639a576fb35 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1110,4 +1110,40 @@ select * from t1 order by 1+1; drop table t1; +# +# Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS". +# Add test coverage for the added commands. +# +create table t1 (a int); +create table t2 like t1; +create table t3 like t2; +prepare stmt from "repair table t1"; +execute stmt; +execute stmt; +prepare stmt from "optimize table t1"; +execute stmt; +execute stmt; +prepare stmt from "analyze table t1"; +execute stmt; +execute stmt; +prepare stmt from "repair table t1, t2, t3"; +execute stmt; +execute stmt; +prepare stmt from "optimize table t1, t2, t3"; +execute stmt; +execute stmt; +prepare stmt from "analyze table t1, t2, t3"; +execute stmt; +execute stmt; +prepare stmt from "repair table t1, t4, t3"; +execute stmt; +execute stmt; +prepare stmt from "optimize table t1, t3, t4"; +execute stmt; +execute stmt; +prepare stmt from "analyze table t4, t1"; +execute stmt; +execute stmt; +deallocate prepare stmt; + # End of 5.0 tests diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test index e214afeaaf3..ff1c87f3bd8 100644 --- a/mysql-test/t/ps_11bugs.test +++ b/mysql-test/t/ps_11bugs.test @@ -130,3 +130,17 @@ drop table t1, t2; # end of bug#1676 # End of 4.1 tests + +# bug#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol + +create table t1 (a int primary key); +insert into t1 values (1); + +explain select * from t1 where 3 in (select (1+1) union select 1); + +select * from t1 where 3 in (select (1+1) union select 1); + +prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; +execute st_18492; + +drop table t1; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 6b168711de8..f61a7820afe 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -456,13 +456,10 @@ into table t1 fields terminated by ''\t'' '; prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; execute stmt1 ; ## ---error 1295 prepare stmt1 from ' optimize table t1 ' ; ---error 1295 prepare stmt1 from ' analyze table t1 ' ; --error 1295 prepare stmt1 from ' checksum table t1 ' ; ---error 1295 prepare stmt1 from ' repair table t1 ' ; --error 1295 prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 7596a7ba708..e2ff20e6ecc 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -207,7 +207,7 @@ show status like "Qcache_queries_in_cache"; drop table t1; # -# Charset convertion (cp1251_koi8 always present) +# Charset conversion (cp1251_koi8 always present) # create table t1 (a char(1) not null collate koi8r_general_ci); insert into t1 values(_koi8r"á"); diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test index d7d1d50d88f..c702908ed68 100644 --- a/mysql-test/t/rpl_ndb_basic.test +++ b/mysql-test/t/rpl_ndb_basic.test @@ -146,4 +146,35 @@ select * from t1 order by nid; # cleanup --connection master DROP TABLE t1; + + +# +# BUG#18094 +# Slave caches invalid table definition after atlters causes select failure +# +--connection master +CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB; + +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +ALTER TABLE t1 ADD c2 INT; + +--sync_slave_with_master +connection slave; +SELECT * FROM t1 ORDER BY c1; + +connection master; +ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8; +ALTER TABLE t1 CHANGE c2 c2 BLOB; + +--sync_slave_with_master +connection slave; +# here we would get error 1412 prior to bug +SELECT * FROM t1 ORDER BY c1 LIMIT 5; + + + +# cleanup +--connection master +DROP TABLE t1; -- source include/master-slave-end.inc diff --git a/mysql-test/t/rpl_ndb_dd_partitions.test b/mysql-test/t/rpl_ndb_dd_partitions.test index 026c31bbdc7..9291f38e8db 100644 --- a/mysql-test/t/rpl_ndb_dd_partitions.test +++ b/mysql-test/t/rpl_ndb_dd_partitions.test @@ -297,5 +297,14 @@ SHOW CREATE TABLE t1; --echo --- Do Cleanup --- DROP TABLE IF EXISTS t1; +alter tablespace ts1 +drop datafile 'datafile.dat' +engine=ndb; +alter tablespace ts1 +drop datafile 'datafile02.dat' +engine=ndb; +DROP TABLESPACE ts1 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; +--sync_slave_with_master # End of 5.1 test case diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test index 8a85443e71f..00ae5c935bf 100644 --- a/mysql-test/t/rpl_openssl.test +++ b/mysql-test/t/rpl_openssl.test @@ -53,6 +53,7 @@ stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; connection master; +drop user replssl@localhost; drop table t1; save_master_pos; connection slave; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 7f76aaf3355..a5c8a87c74d 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,3 +1,6 @@ +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + # # Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 7269b54556b..612ab54dff1 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -131,6 +131,8 @@ drop table t1,t2; create temporary table t3 (f int); sync_with_master; +# The server will now close done + # # Bug#17284 erroneous temp table cleanup on slave # @@ -156,5 +158,31 @@ connection master; drop temporary table t4; drop table t5; -# The server will now close done +# +# BUG#17263 incorrect generation DROP temp tables +# Temporary tables of connection are dropped in batches +# where a batch correspond to pseudo_thread_id +# value was set up at the moment of temp table creation +# +connection con1; +set @session.pseudo_thread_id=100; +create temporary table t101 (id int); +create temporary table t102 (id int); +set @session.pseudo_thread_id=200; +create temporary table t201 (id int); +create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int); +set @con1_id=connection_id(); +kill @con1_id; + +#now do something to show that slave is ok after DROP temp tables +connection master; +create table t1(f int); +insert into t1 values (1); + +sync_slave_with_master; +#connection slave; +select * from t1 /* must be 1 */; + +connection master; +drop table t1; # End of 5.1 tests diff --git a/mysql-test/t/rpl_view-slave.opt b/mysql-test/t/rpl_view-slave.opt new file mode 100644 index 00000000000..79b3bf6174b --- /dev/null +++ b/mysql-test/t/rpl_view-slave.opt @@ -0,0 +1 @@ +--replicate-ignore-table=test.foo diff --git a/mysql-test/t/sp-goto.test b/mysql-test/t/sp-goto.test deleted file mode 100644 index e770dd285ff..00000000000 --- a/mysql-test/t/sp-goto.test +++ /dev/null @@ -1,238 +0,0 @@ -# -# The non-standard GOTO, for compatibility -# -# QQQ The "label" syntax is temporary, it will (hopefully) -# change to the more common "L:" syntax soon. -# For the time being, this feature is disabled, until -# the syntax (and some other known bugs) can be fixed. -# -# Test cases for bugs are added at the end. See template there. -# - ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 ( - id char(16) not null default '', - data int not null -); - -delimiter //; - ---disable_warnings -drop procedure if exists goto1// ---enable_warnings -create procedure goto1() -begin - declare y int; - -label a; - select * from t1; - select count(*) into y from t1; - if y > 2 then - goto b; - end if; - insert into t1 values ("j", y); - goto a; -label b; -end// - -call goto1()// -drop procedure goto1// - -# With dummy handlers, just to test restore of contexts with jumps ---disable_warnings -drop procedure if exists goto2// ---enable_warnings -create procedure goto2(a int) -begin - declare x int default 0; - declare continue handler for sqlstate '42S98' set x = 1; - -label a; - select * from t1; -b: - while x < 2 do - begin - declare continue handler for sqlstate '42S99' set x = 2; - - if a = 0 then - set x = x + 1; - iterate b; - elseif a = 1 then - leave b; - elseif a = 2 then - set a = 1; - goto a; - end if; - end; - end while b; - - select * from t1; -end// - -call goto2(0)// -call goto2(1)// -call goto2(2)// - -drop procedure goto2// -delete from t1// - -# Check label visibility for some more cases. We don't call these. ---disable_warnings -drop procedure if exists goto3// ---enable_warnings -create procedure goto3() -begin - label L1; - begin - end; - goto L1; -end// -drop procedure goto3// - ---disable_warnings -drop procedure if exists goto4// ---enable_warnings -create procedure goto4() -begin - begin - label lab1; - begin - goto lab1; - end; - end; -end// -drop procedure goto4// - ---disable_warnings -drop procedure if exists goto5// ---enable_warnings -create procedure goto5() -begin - begin - begin - goto lab1; - end; - label lab1; - end; -end// -drop procedure goto5// - ---disable_warnings -drop procedure if exists goto6// ---enable_warnings -create procedure goto6() -begin - label L1; - goto L5; - begin - label L2; - goto L1; - goto L5; - begin - label L3; - goto L1; - goto L2; - goto L3; - goto L4; - goto L5; - end; - goto L2; - goto L4; - label L4; - end; - label L5; - goto L1; -end// -drop procedure goto6// - -# Mismatching labels ---error 1308 -create procedure foo() -begin - goto foo; -end// ---error 1308 -create procedure foo() -begin - begin - label foo; - end; - goto foo; -end// ---error 1308 -create procedure foo() -begin - goto foo; - begin - label foo; - end; -end// ---error 1308 -create procedure foo() -begin - begin - goto foo; - end; - begin - label foo; - end; -end// ---error 1308 -create procedure foo() -begin - begin - label foo; - end; - begin - goto foo; - end; -end// - -# No goto in a handler ---error 1358 -create procedure p() -begin - declare continue handler for sqlexception - begin - goto L1; - end; - - select field from t1; - label L1; -end// - - -# -# Test cases for old bugs -# - -# -# BUG#6898: Stored procedure crash if GOTO statements exist -# ---disable_warnings -drop procedure if exists bug6898// ---enable_warnings -create procedure bug6898() -begin - goto label1; - label label1; - begin end; - goto label1; -end// -drop procedure bug6898// - -# -# BUG#NNNN: New bug synopsis -# -#--disable_warnings -#drop procedure if exists bugNNNN// -#--enable_warnings -#create procedure bugNNNN... - - -# Add bugs above this line. Use existing tables t1 and t2 when -# practical, or create table t3, t4 etc temporarily (and drop them). -delimiter ;// -drop table t1; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index f369dc64b0e..a8c3c0a22eb 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -545,6 +545,7 @@ GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; # Cleanup. DROP DATABASE db_bug7787; +drop user user_bug7787@localhost; use test; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 29e657004ed..8ccd954eeea 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -5705,6 +5705,81 @@ delete from t1| # +# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0 +# +# The solution is not to reset last_insert_id on enter to sub-statement. +# +--disable_warnings +drop function if exists bug15728| +drop table if exists t3| +--enable_warnings + +create table t3 ( + id int not null auto_increment, + primary key (id) +)| +create function bug15728() returns int(11) + return last_insert_id()| + +insert into t3 values (0)| +select last_insert_id()| +select bug15728()| + +drop function bug15728| +drop table t3| + + +# +# BUG#18787: Server crashed when calling a stored procedure containing +# a misnamed function +# +--disable_warnings +drop procedure if exists bug18787| +--enable_warnings +create procedure bug18787() +begin + declare continue handler for sqlexception begin end; + + select no_such_function(); +end| + +call bug18787()| +drop procedure bug18787| + + +# +# BUG#18344: DROP DATABASE does not drop associated routines +# (... if the database name is longer than 21 characters) +# +# 1234567890123456789012 +create database bug18344_012345678901| +use bug18344_012345678901| +create procedure bug18344() begin end| +create procedure bug18344_2() begin end| + +create database bug18344_0123456789012| +use bug18344_0123456789012| +create procedure bug18344() begin end| +create procedure bug18344_2() begin end| + +use test| + +select schema_name from information_schema.schemata where + schema_name like 'bug18344%'| +select routine_name,routine_schema from information_schema.routines where + routine_schema like 'bug18344%'| + +drop database bug18344_012345678901| +drop database bug18344_0123456789012| + +# Should be nothing left. +select schema_name from information_schema.schemata where + schema_name like 'bug18344%'| +select routine_name,routine_schema from information_schema.routines where + routine_schema like 'bug18344%'| + + +# # BUG#NNNN: New bug synopsis # #--disable_warnings diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 3854297ec0c..4eb429156b2 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -258,5 +258,6 @@ drop procedure bug10100pv| drop procedure bug10100pd| drop procedure bug10100pc| drop view v1| +drop table t3| delimiter ;| diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 929a0cb5877..1a71425d2a7 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -36,11 +36,111 @@ reap; show status like 'Table_lock%'; drop table t1; +disconnect con2; +disconnect con1; +connection default; + # End of 4.1 tests # -# lost_query_cost +# last_query_cost # select 1; show status like 'last_query_cost'; + +# +# Test for Bug #15933 max_used_connections is wrong after FLUSH STATUS +# if connections are cached +# +# +# The first suggested fix from the bug report was chosen +# (see http://bugs.mysql.com/bug.php?id=15933): +# +# a) On flushing the status, set max_used_connections to +# threads_connected, not to 0. +# +# b) Check if it is necessary to increment max_used_connections when +# taking a thread from the cache as well as when creating new threads +# + +# Wait for at most $disconnect_timeout seconds for disconnects to finish. +let $disconnect_timeout = 10; + +# Wait for any previous disconnects to finish. +FLUSH STATUS; +--disable_query_log +--disable_result_log +eval SET @wait_left = $disconnect_timeout; +let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`; +eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0; +let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`; +while ($wait_more) +{ + sleep 1; + FLUSH STATUS; + SET @wait_left = @wait_left - 1; + let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`; + eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0; + let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`; +} +--enable_query_log +--enable_result_log + +# Prerequisite. +SHOW STATUS LIKE 'max_used_connections'; + +# Save original setting. +SET @save_thread_cache_size=@@thread_cache_size; +SET GLOBAL thread_cache_size=3; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; +disconnect con2; + +# Check that max_used_connections still reflects maximum value. +SHOW STATUS LIKE 'max_used_connections'; + +# Check that after flush max_used_connections equals to current number +# of connections. First wait for previous disconnect to finish. +FLUSH STATUS; +--disable_query_log +--disable_result_log +eval SET @wait_left = $disconnect_timeout; +let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`; +eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0; +let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`; +while ($wait_more) +{ + sleep 1; + FLUSH STATUS; + SET @wait_left = @wait_left - 1; + let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`; + eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0; + let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`; +} +--enable_query_log +--enable_result_log +# Check that we don't count disconnected thread any longer. +SHOW STATUS LIKE 'max_used_connections'; + +# Check that max_used_connections is updated when cached thread is +# reused... +connect (con2,localhost,root,,); +SHOW STATUS LIKE 'max_used_connections'; + +# ...and when new thread is created. +connect (con3,localhost,root,,); +SHOW STATUS LIKE 'max_used_connections'; + +# Restore original setting. +connection default; +SET GLOBAL thread_cache_size=@save_thread_cache_size; + +disconnect con3; +disconnect con2; +disconnect con1; + +# End of 5.0 tests diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index 069c19341e4..bfc909d6995 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -3,6 +3,7 @@ # Preparing playground --disable_warnings drop table if exists t1, t2; +drop function if exists f1; --enable_warnings @@ -222,3 +223,22 @@ select * from t1; drop table t1; # End of 4.1 tests + +# +# Test for bug #11081 "Using a CONVERT_TZ function in a stored function +# or trigger fails". +# +create table t1 (ldt datetime, udt datetime); +create function f1(i datetime) returns datetime + return convert_tz(i, 'UTC', 'Europe/Moscow'); +create trigger t1_bi before insert on t1 for each row + set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC'); +# This should work without errors +insert into t1 (ldt) values ('2006-04-19 16:30:00'); +select * from t1; +# This should work without errors as well +select ldt, f1(udt) as ldt2 from t1; +drop table t1; +drop function f1; + +# End of 5.0 tests diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test index f94d86eb266..450c1edc47e 100644 --- a/mysql-test/t/timezone_grant.test +++ b/mysql-test/t/timezone_grant.test @@ -1,6 +1,11 @@ # Embedded server testing does not support grants -- source include/not_embedded.inc +--disable_warnings +drop tables if exists t1, t2; +drop view if exists v1; +--enable_warnings + # # Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone # tables". We should allow implicit access to time zone description tables @@ -82,3 +87,29 @@ flush privileges; drop table t1, t2; # End of 4.1 tests + +# +# Additional test for bug #15153: CONVERT_TZ() is not allowed in all +# places in views. +# +# Let us check that usage of CONVERT_TZ() function in view does not +# require additional privileges. + +# Let us rely on that previous tests done proper cleanups +create table t1 (a int, b datetime); +insert into t1 values (1, 20010101000000), (2, 20020101000000); +grant all privileges on test.* to mysqltest_1@localhost; +connect (tzuser3, localhost, mysqltest_1,,); +create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1; +select * from v1; +# Of course we should not be able select from mysql.time_zone tables +--error ER_TABLEACCESS_DENIED_ERROR +select * from v1, mysql.time_zone; +drop view v1; +--error ER_TABLEACCESS_DENIED_ERROR +create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone; +connection default; +drop table t1; +drop user mysqltest_1@localhost; + +# End of 5.0 tests diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index c5925bbd9d5..00c85a650d1 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1111,6 +1111,58 @@ insert into t1 values create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); -drop table t1; +drop table t1, t2; drop function f1; drop function f2; + +# +# Test for bug #16021 "Wrong index given to function in trigger" which +# was caused by the same bulk insert optimization as bug #17764 but had +# slightly different symptoms (instead of reporting table as crashed +# storage engine reported error number 124) +# +create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j)); +create table t2(i int not null, n numeric(15,2), primary key(i)); +delimiter |; +create trigger t1_ai after insert on t1 for each row +begin + declare sn numeric(15,2); + select sum(n) into sn from t1 where i=new.i; + replace into t2 values(new.i, sn); +end| +delimiter ;| +insert into t1 values + (1,1,10.00),(1,2,10.00),(1,3,10.00),(1,4,10.00),(1,5,10.00), + (1,6,10.00),(1,7,10.00),(1,8,10.00),(1,9,10.00),(1,10,10.00), + (1,11,10.00),(1,12,10.00),(1,13,10.00),(1,14,10.00),(1,15,10.00); +select * from t1; +select * from t2; +drop tables t1, t2; + +# +# Test for Bug #16461 connection_id() does not work properly inside trigger +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + conn_id INT, + trigger_conn_id INT +); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW + SET NEW.trigger_conn_id = CONNECTION_ID(); + +INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); + +connect (con1,localhost,root,,); +INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); +connection default; +disconnect con1; + +SELECT * FROM t1 WHERE conn_id != trigger_conn_id; + +DROP TRIGGER t1_bi; +DROP TABLE t1; + +# End of 5.0 tests diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index c9f22cf410b..e2556692612 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -14,18 +14,26 @@ drop table if exists t1; # Create the example functions from udf_example # -CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so'; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB --error ER_CANT_FIND_DL_ENTRY -CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so'; -CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so"; -CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so'; -CREATE FUNCTION reverse_lookup - RETURNS STRING SONAME 'udf_example.so'; -CREATE AGGREGATE FUNCTION avgcost - RETURNS REAL SONAME 'udf_example.so'; +eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION reverse_lookup + RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE AGGREGATE FUNCTION avgcost + RETURNS REAL SONAME "$UDF_EXAMPLE_LIB"; --error 0 select myfunc_double(); diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 61861c26ea8..e1b23a1782f 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -143,8 +143,6 @@ select @@Max_Allowed_Packet; select @@version; --replace_column 1 # select @@global.version; ---replace_column 1 # -select @@session.VERSION; # End of 4.1 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 649265dcc5e..018337f2631 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -169,7 +169,7 @@ set collation_connection=NULL; set global autocommit=1; --error 1238 select @@global.timestamp; ---error 1193 +--error 1238 set @@version=''; --error 1229 set @@concurrent_insert=1; @@ -258,6 +258,8 @@ select @@sql_max_join_size,@@max_join_size; set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; +# reset it, so later tests don't get confused +set sql_select_limit=default; set sql_warnings=1; set global table_open_cache=100; set storage_engine=myisam; @@ -472,4 +474,38 @@ select @@character_set_filesystem; set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; -# End of 5.0 tests +# +# Bug #17849: Show sql_big_selects in SHOW VARIABLES +# +set @old_sql_big_selects = @@sql_big_selects; +set @@sql_big_selects = 1; +show variables like 'sql_big_selects'; +set @@sql_big_selects = @old_sql_big_selects; + +# +# Bug #16195: SHOW VARIABLES doesn't report correctly sql_warnings and +# sql_notes values +# +set @@sql_notes = 0, @@sql_warnings = 0; +show variables like 'sql_notes'; +show variables like 'sql_warnings'; +set @@sql_notes = 1, @@sql_warnings = 1; +show variables like 'sql_notes'; +show variables like 'sql_warnings'; + +# +# Bug #12792: @@system_time_zone is not SELECTable. +# +# Don't actually output, since it depends on the system +--replace_column 1 # +select @@system_time_zone; + +# +# Bug #15684: system variables cannot be SELECTed (e.g. @@version_comment) +# +# Don't actually output, since it depends on the system +--replace_column 1 # 2 # 3 # 4 # +select @@version, @@version_comment, @@version_compile_machine, + @@version_compile_os; + +--echo End of 5.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 82f053fb223..6094382c094 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2459,3 +2459,61 @@ SELECT * FROM v1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04'; DROP VIEW v1; DROP TABLE t1; + +# +# BUG#14308: Recursive view definitions +# +# using view only +create table t1 (a int); +create view v1 as select * from t1; +create view v2 as select * from v1; +drop table t1; +rename table v2 to t1; +-- error ER_VIEW_RECURSIVE +select * from v1; +drop view t1, v1; +# using SP function +create table t1 (a int); +delimiter //; +create function f1() returns int +begin + declare mx int; + select max(a) from t1 into mx; + return mx; +end// +delimiter ;// +create view v1 as select f1() as a; +create view v2 as select * from v1; +drop table t1; +rename table v2 to t1; +-- error ER_SP_NO_RECURSION +select * from v1; +drop function f1; +drop view t1, v1; + +# +# Bug #15153: CONVERT_TZ() is not allowed in all places in VIEWs +# +# Error was reported when one tried to use CONVERT_TZ() function +# select list of view which was processed using MERGE algorithm. +# (Also see additional test in timezone_grant.test) +create table t1 (dt datetime); +insert into t1 values (20040101000000), (20050101000000), (20060101000000); +# Let us test that convert_tz() can be used in view's select list +create view v1 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from t1; +select * from v1; +drop view v1; +# And in its where part +create view v1 as select * from t1 where convert_tz(dt, 'UTC', 'Europe/Moscow') >= 20050101000000; +select * from v1; +# Other interesting case - a view which uses convert_tz() function +# through other view. +create view v2 as select * from v1 where dt < 20060101000000; +select * from v2; +drop view v2; +# And even more interesting case when view uses convert_tz() both +# directly and indirectly +create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1; +select * from v2; +drop view v1, v2; +drop table t1; diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 8335c1de20a..8deff474587 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -32,7 +32,7 @@ grant create view,select on test.* to mysqltest_1@localhost; connect (user1,localhost,mysqltest_1,,test); connection user1; --- error ER_SPECIFIC_ACCESS_DENIED +-- error ER_SPECIFIC_ACCESS_DENIED_ERROR create definer=root@localhost view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1; # try to modify view without DROP privilege on it |