diff options
author | Satya B <satya.bn@sun.com> | 2009-06-05 17:03:33 +0530 |
---|---|---|
committer | Satya B <satya.bn@sun.com> | 2009-06-05 17:03:33 +0530 |
commit | 518e2498534cd996544238eb50d7e71da026ae19 (patch) | |
tree | 9f2ad71c11b05abfb2facd6e42132e9f1a218ec6 | |
parent | a4f69c8951db7a39dc8e3ce45fd0e83b5728b6ab (diff) | |
parent | 58436f5c22f46f3799769fc4e7965a68ab4e2da4 (diff) | |
download | mariadb-git-518e2498534cd996544238eb50d7e71da026ae19.tar.gz |
merge from mysql-5.1-innodb_plugin branch.
change tree name to 'mysql-5.1-innodb_plugin'
-rw-r--r-- | .bzr-mysql/default.conf | 2 | ||||
-rwxr-xr-x | CMakeLists.txt | 4 | ||||
-rw-r--r-- | client/mysqltest.cc | 60 | ||||
-rw-r--r-- | include/myisam.h | 3 | ||||
-rw-r--r-- | mysql-test/collections/default.push | 10 | ||||
-rw-r--r-- | mysql-test/lib/mtr_report.pm | 8 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 14 | ||||
-rw-r--r-- | mysql-test/r/mysqltest.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/funcs_1/datadict/processlist_priv.inc | 4 | ||||
-rw-r--r-- | mysql-test/t/connect.test | 3 | ||||
-rw-r--r-- | mysql-test/t/mysqltest.test | 54 | ||||
-rw-r--r-- | sql/table.cc | 2 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 2 | ||||
-rw-r--r-- | storage/myisam/myisamchk.c | 10 | ||||
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 4 |
15 files changed, 153 insertions, 30 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index e98e74a6fd2..d777160cf3e 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "satya.bn@sun.com,svoj@sun.com,joro@sun.com" post_push_to = "satya.bn@sun.com,svoj@sun.com,joro@sun.com" -tree_name = "mysql-5.1-bugteam-innodb_plugin" +tree_name = "mysql-5.1-innodb_plugin" diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c173c9cb49..e4dc16040a7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,10 @@ SET(WITH_MYISAMMRG_STORAGE_ENGINE TRUE) ADD_DEFINITIONS(-DWITH_MYISAMMRG_STORAGE_ENGINE) SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin") +IF(WITH_COMMUNITY_FEATURES) + ADD_DEFINITIONS(-DENABLED_PROFILING -DCOMMUNITY_SERVER) +ENDIF(WITH_COMMUNITY_FEATURES) + IF(WITH_ARCHIVE_STORAGE_ENGINE) ADD_DEFINITIONS(-DWITH_ARCHIVE_STORAGE_ENGINE) SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_archive_plugin") diff --git a/client/mysqltest.cc b/client/mysqltest.cc index f29fd36aa27..a39cabdc64d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -280,6 +280,7 @@ enum enum_commands { Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, + Q_MOVE_FILE, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -376,6 +377,7 @@ const char *command_names[]= "list_files_append_file", "send_shutdown", "shutdown_server", + "move_file", 0 }; @@ -966,6 +968,7 @@ void check_command_args(struct st_command *command, for (i= 0; i < num_args; i++) { const struct command_arg *arg= &args[i]; + char delimiter; switch (arg->type) { /* A string */ @@ -974,8 +977,15 @@ void check_command_args(struct st_command *command, while (*ptr && *ptr == ' ') ptr++; start= ptr; - /* Find end of arg, terminated by "delimiter_arg" */ - while (*ptr && *ptr != delimiter_arg) + delimiter = delimiter_arg; + /* If start of arg is ' ` or " search to matching quote end instead */ + if (*ptr && strchr ("'`\"", *ptr)) + { + delimiter= *ptr; + start= ++ptr; + } + /* Find end of arg, terminated by "delimiter" */ + while (*ptr && *ptr != delimiter) ptr++; if (ptr > start) { @@ -987,6 +997,11 @@ void check_command_args(struct st_command *command, /* Empty string */ init_dynamic_string(arg->ds, "", 0, 0); } + /* Find real end of arg, terminated by "delimiter_arg" */ + /* This will do nothing if arg was not closed by quotes */ + while (*ptr && *ptr != delimiter_arg) + ptr++; + command->last_argument= (char*)ptr; /* Step past the delimiter */ @@ -1794,7 +1809,7 @@ void check_result() log_file.file_name(), reject_file, errno); show_diff(NULL, result_file_name, reject_file); - die(mess); + die("%s", mess); break; } default: /* impossible */ @@ -2891,6 +2906,42 @@ void do_copy_file(struct st_command *command) /* SYNOPSIS + do_move_file + command command handle + + DESCRIPTION + move_file <from_file> <to_file> + Move <from_file> to <to_file> +*/ + +void do_move_file(struct st_command *command) +{ + int error; + static DYNAMIC_STRING ds_from_file; + static DYNAMIC_STRING ds_to_file; + const struct command_arg move_file_args[] = { + { "from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to move from" }, + { "to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to move to" } + }; + DBUG_ENTER("do_move_file"); + + check_command_args(command, command->first_argument, + move_file_args, + sizeof(move_file_args)/sizeof(struct command_arg), + ' '); + + DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str)); + error= (my_rename(ds_from_file.str, ds_to_file.str, + MYF(0)) != 0); + handle_command_error(command, error); + dynstr_free(&ds_from_file); + dynstr_free(&ds_to_file); + DBUG_VOID_RETURN; +} + + +/* + SYNOPSIS do_chmod_file command command handle @@ -4546,7 +4597,7 @@ void select_connection(struct st_command *command) }; check_command_args(command, command->first_argument, connection_args, sizeof(connection_args)/sizeof(struct command_arg), - ','); + ' '); DBUG_PRINT("info", ("changing connection: %s", ds_connection.str)); select_connection_name(ds_connection.str); @@ -7680,6 +7731,7 @@ int main(int argc, char **argv) case Q_CHANGE_USER: do_change_user(command); break; case Q_CAT_FILE: do_cat_file(command); break; case Q_COPY_FILE: do_copy_file(command); break; + case Q_MOVE_FILE: do_move_file(command); break; case Q_CHMOD_FILE: do_chmod_file(command); break; case Q_PERL: do_perl(command); break; case Q_DELIMITER: diff --git a/include/myisam.h b/include/myisam.h index d7bfdf7191e..02251eeacb4 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -404,7 +404,8 @@ typedef struct st_mi_check_param my_off_t keydata,totaldata,key_blocks,start_check_pos; ha_rows total_records,total_deleted; ha_checksum record_checksum,glob_crc; - ulong use_buffers,read_buffer_length,write_buffer_length, + ulonglong use_buffers; + ulong read_buffer_length,write_buffer_length, sort_buffer_length,sort_key_blocks; uint out_flag,warning_printed,error_printed,verbose; uint opt_sort_key,total_files,max_level; diff --git a/mysql-test/collections/default.push b/mysql-test/collections/default.push index 0879b6fde2c..0f7c8d9949e 100644 --- a/mysql-test/collections/default.push +++ b/mysql-test/collections/default.push @@ -1,5 +1,5 @@ -perl mysql-test-run.pl --timer --force --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental -perl mysql-test-run.pl --timer --force --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental -perl mysql-test-run.pl --timer --force --comment=embedded --embedded --experimental=collections/default.experimental -perl mysql-test-run.pl --timer --force --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental -perl mysql-test-run.pl --timer --force --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --embedded --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 93463d88d74..a246c5bbef6 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -71,6 +71,8 @@ sub _mtr_report_test_name ($) { print _name(), _timestamp(); printf "%-40s ", $tname; + my $worker = $tinfo->{worker}; + printf "w$worker " if $worker; return $tname; } @@ -219,8 +221,8 @@ sub mtr_report_test ($) { } -sub mtr_report_stats ($) { - my $tests= shift; +sub mtr_report_stats ($;$) { + my ($tests, $dont_error)= @_; # ---------------------------------------------------------------------- # Find out how we where doing @@ -372,7 +374,7 @@ sub mtr_report_stats ($) { if ( $tot_failed != 0 || $found_problems) { - mtr_error("there were failing test cases"); + mtr_error("there were failing test cases") unless $dont_error; } } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 45ee54442d6..2a6a069d81c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -313,7 +313,7 @@ sub main { ####################################################################### my $num_tests= @$tests; - if ( not defined $opt_parallel ) { + if ( $opt_parallel eq "auto" ) { # Try to find a suitable value for number of workers my $sys_info= My::SysInfo->new(); @@ -528,6 +528,8 @@ sub run_test_server ($$$) { elsif ($opt_max_test_fail > 0 and $num_failed_test >= $opt_max_test_fail) { $suite_timeout_proc->kill(); + push(@$completed, $result); + mtr_report_stats($completed, 1); mtr_report("Too many tests($num_failed_test) failed!", "Terminating..."); return undef; @@ -659,6 +661,7 @@ sub run_test_server ($$$) { # ---------------------------------------------------- if ( ! $suite_timeout_proc->wait_one(0) ) { + mtr_report_stats($completed, 1); mtr_report("Test suite timeout! Terminating..."); return undef; } @@ -723,6 +726,8 @@ sub run_worker ($) { delete($test->{'comment'}); delete($test->{'logfile'}); + $test->{worker} = $thread_num if $opt_parallel > 1; + run_testcase($test); #$test->{result}= 'MTR_RES_PASSED'; # Send it back, now with results set @@ -790,7 +795,7 @@ sub command_line_setup { 'vs-config' => \$opt_vs_config, # Max number of parallel threads to use - 'parallel=i' => \$opt_parallel, + 'parallel=s' => \$opt_parallel, # Config file to use as template for all tests 'defaults-file=s' => \&collect_option, @@ -1130,9 +1135,9 @@ sub command_line_setup { # -------------------------------------------------------------------------- # Check parallel value # -------------------------------------------------------------------------- - if ($opt_parallel < 1) + if ($opt_parallel ne "auto" && $opt_parallel < 1) { - mtr_error("0 or negative parallel value makes no sense, use positive number"); + mtr_error("0 or negative parallel value makes no sense, use 'auto' or positive number"); } # -------------------------------------------------------------------------- @@ -5197,6 +5202,7 @@ Misc options fast Run as fast as possible, dont't wait for servers to shutdown etc. parallel=N Run tests in N parallel threads (default=1) + Use parallel=auto for auto-setting of N repeat=N Run each test N number of times retry=N Retry tests that fail N times, limit number of failures to $opt_retry_failure diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index a9c20e34517..52a1734ea54 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -545,6 +545,8 @@ mysqltest: At line 1: Failed to open file 'non_existing_file' mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' +mysqltest: At line 1: Missing required argument 'from_file' to command 'move_file' +mysqltest: At line 1: Missing required argument 'to_file' to command 'move_file' mysqltest: At line 1: Missing required argument 'mode' to command 'chmod' mysqltest: At line 1: You must write a 4 digit octal number for mode mysqltest: At line 1: You must write a 4 digit octal number for mode @@ -697,6 +699,7 @@ statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=int(11) statement=SHOW COLUMNS FROM t1 row_number=1, column_name=Default, Value=NULL value= ->A B<- value= 1 +value= 2 mysqltest: At line 1: query_get_value - argument list started with '(' must be ended with ')' mysqltest: At line 1: Missing required argument 'query' to command 'query_get_value' mysqltest: At line 1: Missing required argument 'column name' to command 'query_get_value' diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index d8e1b398bfc..b5c40c63566 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -212,7 +212,7 @@ GRANT PROCESS ON *.* TO ''@'localhost'; --echo anonymous user with PROCESS privilege --echo SHOW/SELECT shows all processes/threads. --echo #################################################################################### -connect (anonymous1,localhost,'',,information_schema); +connect (anonymous1,localhost,"''",,information_schema); SHOW GRANTS; --replace_column 1 ID 3 HOST_NAME 6 TIME SHOW processlist; @@ -253,7 +253,7 @@ REVOKE PROCESS ON *.* FROM ''@'localhost'; --echo #################################################################################### --echo 7.1 New connection (anonymous2,localhost,'',,information_schema) -connect (anonymous2,localhost,'',,information_schema); +connect (anonymous2,localhost,"''",,information_schema); --echo The anonymous user has no more the PROCESS privilege --echo Again only the processes of the anonymous user are visible. --echo #################################################################################### diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index f609240646a..9a29e4ff861 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -55,7 +55,8 @@ disconnect con4; connect (fail_con,localhost,test,,test2); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect (fail_con,localhost,test,,""); +# Need to protect "" within '' so it's interpreted literally +connect (fail_con,localhost,test,,'""'); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR connect (fail_con,localhost,test,zorro,test2); diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 55cd041aaf5..578b2bf5c6c 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1780,6 +1780,56 @@ remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp; --error 1 --exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1 + +# ---------------------------------------------------------------------------- +# test for move_file +# ---------------------------------------------------------------------------- + +# - Check that if source file does not exist, nothing will be created. + +--error 1 +file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp; +--error 1 +file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp; +--error 1 +move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp; +--error 1 +file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp; +--error 1 +file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp; + +# - Check that if source file exists, everything works properly. + +--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp +file1 +EOF + +move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp; +--error 1 +file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp; +file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp; + +# - Check that if destination file exists, everything works properly. +# (file2.tmp exists from the previous check; file1.tmp needs to be created) + +--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp +file1 +EOF + +move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp; +--error 1 +file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp; +file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp; +remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp; + +# - Check usage. + +--error 1 +--exec echo "move_file ;" | $MYSQL_TEST 2>&1 + +--error 1 +--exec echo "move_file from_file;" | $MYSQL_TEST 2>&1 + # ---------------------------------------------------------------------------- # test for chmod # ---------------------------------------------------------------------------- @@ -2037,6 +2087,10 @@ let $value= query_get_value(SELECT 'A B' AS "MyColumn", MyColumn, 1); let $value= query_get_value(SELECT 1 AS "My Column", My Column, 1); --echo value= $value # +# 4.1 Query containing , protected by quotes, quotes also on column +let $value= query_get_value('SELECT 1 as a, 2 as b', "b", 1); +--echo value= $value +# #------------ Negative tests ------------ # 5. Incomplete statement including missing parameters # 5.1 incomplete statement diff --git a/sql/table.cc b/sql/table.cc index d24ee4c6a27..066bbc953fa 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -779,7 +779,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, strpos=disk_buff+6; if (!(rec_per_key= (ulong*) alloc_root(&share->mem_root, - sizeof(ulong*)*key_parts))) + sizeof(ulong)*key_parts))) goto err; for (i=0 ; i < keys ; i++, keyinfo++) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 1845859ec81..cf290e2018a 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1807,7 +1807,7 @@ int ha_myisam::info(uint flag) if (share->key_parts) memcpy((char*) table->key_info[0].rec_per_key, (char*) misam_info.rec_per_key, - sizeof(table->key_info[0].rec_per_key[0])*share->key_parts); + sizeof(table->key_info[0].rec_per_key[0])*share->key_parts); if (share->tmp_table == NO_TMP_TABLE) pthread_mutex_unlock(&share->mutex); diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index ac0be2f01cc..75678375ce7 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -287,8 +287,8 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "", (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0, - GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, + GET_ULL, REQUIRED_ARG, USE_BUFFER_INIT, MALLOC_OVERHEAD, + SIZE_T_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "", (uchar**) &opt_key_cache_block_size, (uchar**) &opt_key_cache_block_size, 0, @@ -1102,7 +1102,7 @@ static int myisamchk(MI_CHECK *param, char * filename) { if (param->testflag & (T_EXTEND | T_MEDIUM)) VOID(init_key_cache(dflt_key_cache,opt_key_cache_block_size, - param->use_buffers, 0, 0)); + (size_t) param->use_buffers, 0, 0)); VOID(init_io_cache(¶m->read_cache,datafile, (uint) param->read_buffer_length, READ_CACHE, @@ -1525,8 +1525,8 @@ static int mi_sort_records(MI_CHECK *param, if (share->state.key_root[sort_key] == HA_OFFSET_ERROR) DBUG_RETURN(0); /* Nothing to do */ - init_key_cache(dflt_key_cache, opt_key_cache_block_size, param->use_buffers, - 0, 0); + init_key_cache(dflt_key_cache, opt_key_cache_block_size, + (size_t) param->use_buffers, 0, 0); if (init_io_cache(&info->rec_cache,-1,(uint) param->write_buffer_length, WRITE_CACHE,share->pack.header_length,1, MYF(MY_WME | MY_WAIT_IF_FULL))) diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 7e25309ae70..1e82983b97c 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -925,11 +925,11 @@ int ha_myisammrg::info(uint flag) with such a number, it'll be an error later anyway. */ bzero((char*) table->key_info[0].rec_per_key, - sizeof(table->key_info[0].rec_per_key) * table->s->key_parts); + sizeof(table->key_info[0].rec_per_key[0]) * table->s->key_parts); #endif memcpy((char*) table->key_info[0].rec_per_key, (char*) mrg_info.rec_per_key, - sizeof(table->key_info[0].rec_per_key) * + sizeof(table->key_info[0].rec_per_key[0]) * min(file->keys, table->s->key_parts)); } } |