From 2f33711f1db70c669791dd4a08f06b126a64f0d1 Mon Sep 17 00:00:00 2001 From: "Kristofer.Pettersson@naruto." <> Date: Fri, 22 Sep 2006 11:22:01 +0200 Subject: [PATCH 01/19] Bug#21811 Odd casting with date + INTERVAL arithmetic - The definition of the result type of a type_date function didn't include INTERVAL_WEEK - This patch adds an explicit test for INTERVAL_WEEK which results in the result type for an item_date_add_intervall operation being DATE rather than DATETIME when one parameter is INTERVAL_WEEK. --- sql/item_timefunc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index febc92e34f6..3886af27158 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1876,7 +1876,7 @@ void Item_date_add_interval::fix_length_and_dec() cached_field_type= MYSQL_TYPE_DATETIME; else if (arg0_field_type == MYSQL_TYPE_DATE) { - if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH) + if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH || int_type == INTERVAL_WEEK ) cached_field_type= arg0_field_type; else cached_field_type= MYSQL_TYPE_DATETIME; From b62f0c7b93ef907796fbbe4b6c5f6c055b3591c9 Mon Sep 17 00:00:00 2001 From: "Kristofer.Pettersson@naruto." <> Date: Wed, 11 Oct 2006 13:42:48 +0200 Subject: [PATCH 02/19] Cset exclude: Kristofer.Pettersson@naruto.|ChangeSet|20060922092201|15946 --- sql/item_timefunc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 0b65fdafe31..02c8ab19354 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1876,7 +1876,7 @@ void Item_date_add_interval::fix_length_and_dec() cached_field_type= MYSQL_TYPE_DATETIME; else if (arg0_field_type == MYSQL_TYPE_DATE) { - if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH || int_type == INTERVAL_WEEK ) + if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH) cached_field_type= arg0_field_type; else cached_field_type= MYSQL_TYPE_DATETIME; From c8261b12085abb64e606b573f6b6f91a13f6ed65 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Thu, 12 Oct 2006 17:55:06 +0200 Subject: [PATCH 03/19] Use autorun.sh from BUILD/ instead of netware specific version --- netware/BUILD/compile-netware-END | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END index c5c08cea908..a8d829499bd 100755 --- a/netware/BUILD/compile-netware-END +++ b/netware/BUILD/compile-netware-END @@ -15,11 +15,11 @@ if test -e "Makefile"; then make -k clean; fi rm -f */.deps/*.P rm -rf Makefile.in.bk -# Metrowerks enviornment +# Setup Metrowerks environment . $path/mwenv -# run auto tools -. $path/compile-AUTOTOOLS +# Run autotools(use BUILD/autorun.sh) +. BUILD/autorun.sh # configure ./configure $base_configs $extra_configs From 21e257b9af79c44eaabc2eeda1c7da63b9cb6e50 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Thu, 12 Oct 2006 20:02:17 +0200 Subject: [PATCH 04/19] Add ATTRIBUTE_FORMAT for _db_doprnt, it will catch problems with DBUG_PRINT format specifiers --- include/my_dbug.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/my_dbug.h b/include/my_dbug.h index bf2e8d9969b..8a8d622e2a3 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -36,7 +36,8 @@ extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, uint *_slevel_); extern void _db_pargs_(uint _line_,const char *keyword); -extern void _db_doprnt_ _VARARGS((const char *format,...)); +extern void _db_doprnt_ _VARARGS((const char *format,...)) + ATTRIBUTE_FORMAT(printf, 1, 2); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); extern void _db_output_(uint flag); From 889e7147f69368edbba4b713df684f0f6cd93555 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Thu, 12 Oct 2006 20:15:56 +0200 Subject: [PATCH 05/19] Add ATTRIBUTE_FORMAT specifier to _db_doprnt, which is used by DBUG_PRINT This will hopefully avoiid annoying crashes when running with --debug Fix warnings from the above in mysqltest.c --- client/mysqltest.c | 8 +++----- include/my_dbug.h | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index e2317560404..4aa30ba3f1e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -890,7 +890,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) die(NullS); if (!eval_result && (uint) stat_info.st_size != ds->length) { - DBUG_PRINT("info",("Size differs: result size: %u file size: %u", + DBUG_PRINT("info",("Size differs: result size: %u file size: %llu", ds->length, stat_info.st_size)); DBUG_PRINT("info",("result: '%s'", ds->str)); DBUG_RETURN(RESULT_LENGTH_MISMATCH); @@ -2558,7 +2558,7 @@ void do_get_errcodes(struct st_command *command) *to_ptr= 0; to->type= ERR_SQLSTATE; - DBUG_PRINT("info", ("ERR_SQLSTATE: %d", to->code.sqlstate)); + DBUG_PRINT("info", ("ERR_SQLSTATE: %s", to->code.sqlstate)); } else if (*p == 's') { @@ -4317,7 +4317,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, bind[i].is_null= &is_null[i]; bind[i].length= &length[i]; - DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %d", + DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu", i, bind[i].buffer_type, bind[i].buffer_length)); } @@ -7267,5 +7267,3 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val) char *end= longlong10_to_str(val, buff, 10); replace_dynstr_append_mem(ds, buff, end - buff); } - - diff --git a/include/my_dbug.h b/include/my_dbug.h index 711ece4335c..d2f6e40f3c6 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -35,7 +35,8 @@ extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, uint *_slevel_); extern void _db_pargs_(uint _line_,const char *keyword); -extern void _db_doprnt_ _VARARGS((const char *format,...)); +extern void _db_doprnt_ _VARARGS((const char *format,...)) + ATTRIBUTE_FORMAT(printf, 1, 2); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); extern void _db_output_(); From 31f4aaa5be627da5651fd3767edd1f699562ce86 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Thu, 12 Oct 2006 20:52:53 +0200 Subject: [PATCH 06/19] Skip looking for ndbapi-examples in 4.1, not part of dist --- mysql-test/mysql-test-run.pl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 0c46bbeac79..dc2212f953b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1386,11 +1386,14 @@ sub executable_setup () { mtr_exe_exists("$ndb_path/src/kernel/ndbd", "$glob_basedir/bin/ndbd"); - $path_ndb_examples_dir= - mtr_path_exists("$ndb_path/ndbapi-examples", - "$ndb_path/examples"); - $exe_ndb_example= - mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple"); + if ( $mysql_version_id >= 50000 ) + { + $path_ndb_examples_dir= + mtr_path_exists("$ndb_path/ndbapi-examples", + "$ndb_path/examples"); + $exe_ndb_example= + mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple"); + } } # Look for the udf_example library @@ -1548,8 +1551,11 @@ sub environment_setup () { $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring; - $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; - $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example; + if ( $mysql_version_id >= 50000 ) + { + $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; + $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example; + } $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log; } From 6e3280fd3b94324e6cc57e7f3f57e6dc92dfd93a Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 08:48:47 +0200 Subject: [PATCH 07/19] Add missing semicolon in test file --- mysql-test/r/csv.result | 3 +-- mysql-test/t/csv.test | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 2e3d11ad461..7c7bcc3440c 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -4913,8 +4913,7 @@ bonfire Colombo nondecreasing DROP TABLE t1; -ALTER TABLE t2 RENAME t1 -#; +ALTER TABLE t2 RENAME t1; DROP TABLE t1; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 5b693335a43..e78c2ccc578 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1295,7 +1295,7 @@ SELECT fld3 FROM t2; # DROP TABLE t1; -ALTER TABLE t2 RENAME t1 +ALTER TABLE t2 RENAME t1; # # Drop and recreate From 927c20dd0fcbe221e03c4b5f4d210a93c315848f Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 10:41:40 +0200 Subject: [PATCH 08/19] Improve function that finds the reason why test was skipped, the old version only looked at the ast line, but there might be some additional debug info there so it's better to scan the whole file. There should be only one line that says "reason: " --- mysql-test/mysql-test-run.pl | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index dc2212f953b..24cdedce712 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2815,6 +2815,33 @@ sub do_after_run_mysqltest($) } +sub find_testcase_skipped_reason($) +{ + my ($tinfo)= @_; + + # Open mysqltest.log + my $F= IO::File->new($path_timefile) or + mtr_error("can't open file \"$path_timefile\": $!"); + my $reason; + + while ( my $line= <$F> ) + { + # Look for "reason: " + if ( $line =~ /reason: (.*)/ ) + { + $reason= $1; + } + } + + if ( ! $reason ) + { + mtr_warning("Could not find reason for skipping test in $path_timefile"); + $reason= "Detected by testcase(reason unknown) "; + } + $tinfo->{'comment'}= $reason; +} + + ############################################################################## # # Run a single test case @@ -2887,10 +2914,7 @@ sub run_testcase ($) { # Testcase itself tell us to skip this one # Try to get reason from mysqltest.log - my $last_line= mtr_lastlinefromfile($path_timefile) if -f $path_timefile; - my $reason= mtr_match_prefix($last_line, "reason: "); - $tinfo->{'comment'}= - defined $reason ? $reason : "Detected by testcase(reason unknown) "; + find_testcase_skipped_reason($tinfo); mtr_report_test_skipped($tinfo); } elsif ( $res == 63 ) From c2574de306aefba0a88c7f58366cb4ac30c1c4e0 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 11:05:46 +0200 Subject: [PATCH 09/19] Improve the function that parses test files looking for what features it uses Now also detects "source nnnn;" command, previous version only detected "--source" --- mysql-test/lib/mtr_cases.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index e6980a0abb9..42062b7ba24 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -575,8 +575,6 @@ sub mtr_options_from_test_file($$) { while ( my $line= <$F> ) { - next if ( $line !~ /^--/ ); - # Match this line against tag in "tags" array foreach my $tag (@tags) { @@ -588,14 +586,21 @@ sub mtr_options_from_test_file($$) { } # If test sources another file, open it as well - if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ ) + if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ or + $line =~ /^([[:space:]]*)source(.*);$/ ) { my $value= $2; $value =~ s/^\s+//; # Remove leading space $value =~ s/[[:space:]]+$//; # Remove ending space my $sourced_file= "$::glob_mysql_test_dir/$value"; - mtr_options_from_test_file($tinfo, $sourced_file); + if ( -f $sourced_file ) + { + # Only source the file if it exists, we may get + # false positives in the regexes above if someone + # writes "source nnnn;" in a test case(such as mysqltest.test) + mtr_options_from_test_file($tinfo, $sourced_file); + } } } From de3f217e10e5403db60c69eb2d5dc85d6d6d9709 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 11:38:32 +0200 Subject: [PATCH 10/19] Use 'my_strnncoll_simple' instead of 'strncasecmp' --- client/mysqltest.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 4aa30ba3f1e..e46f22de4df 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -3397,8 +3397,10 @@ int read_line(char *buf, int size) DBUG_RETURN(0); } else if ((c == '{' && - (!strncasecmp(buf, "while", min(5, p - buf)) || - !strncasecmp(buf, "if", min(2, p - buf))))) + (!my_strnncoll_simple(charset_info, "while", 5, + buf, min(5, p - buf), 0) || + !my_strnncoll_simple(charset_info, "if", 2, + buf, min(2, p - buf), 0)))) { /* Only if and while commands can be terminated by { */ *p++= c; From c31a028b9db0c4b7da781fa5c3b1bec594b3f751 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 11:53:19 +0200 Subject: [PATCH 11/19] Optimize restarts by using --force-restart option --- mysql-test/t/rpl_dual_pos_advance-master.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/rpl_dual_pos_advance-master.opt b/mysql-test/t/rpl_dual_pos_advance-master.opt index 35fcc5f30c6..cef79bc8585 100644 --- a/mysql-test/t/rpl_dual_pos_advance-master.opt +++ b/mysql-test/t/rpl_dual_pos_advance-master.opt @@ -1 +1 @@ ---loose-to-force-a-restart +--force-restart From adea21fd1c811318929488a08d4fe086dd62dbbd Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Fri, 13 Oct 2006 10:57:50 -0400 Subject: [PATCH 12/19] Merge fix-up. --- sql/sql_view.cc | 15 ++++++++++++++- vio/viossl.c | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sql/sql_view.cc b/sql/sql_view.cc index a3e0f6b1e5a..82acab7129e 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -573,6 +573,19 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, } append_identifier(thd, &buff, views->table_name, views->table_name_length); + if (lex->view_list.elements) + { + List_iterator_fast names(lex->view_list); + LEX_STRING *name; + int i; + + for (i= 0; name= names++; i++) + { + buff.append(i ? ", " : "("); + append_identifier(thd, &buff, name->str, name->length); + } + buff.append(')'); + } buff.append(STRING_WITH_LEN(" AS ")); buff.append(views->source.str, views->source.length); @@ -1378,7 +1391,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) error= TRUE; query_cache_invalidate3(thd, view, 0); sp_cache_invalidate(); - + } if (mysql_bin_log.is_open()) { thd->clear_error(); diff --git a/vio/viossl.c b/vio/viossl.c index e869493c604..090b837b972 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -82,7 +82,7 @@ int vio_ssl_read(Vio *vio, gptr buf, int size) { int r; DBUG_ENTER("vio_ssl_read"); - DBUG_PRINT("enter", ("sd: %d, buf: 0x%p, size: %d, ssl_: 0x%p", + DBUG_PRINT("enter", ("sd: %d, buf: 0x%lx, size: %d, ssl_: 0x%lx", vio->sd, buf, size, vio->ssl_arg)); r= SSL_read((SSL*) vio->ssl_arg, buf, size); @@ -99,7 +99,7 @@ int vio_ssl_write(Vio *vio, const gptr buf, int size) { int r; DBUG_ENTER("vio_ssl_write"); - DBUG_PRINT("enter", ("sd: %d, buf: 0x%p, size: %d", vio->sd, buf, size)); + DBUG_PRINT("enter", ("sd: %d, buf: 0x%lx, size: %d", vio->sd, buf, size)); r= SSL_write((SSL*) vio->ssl_arg, buf, size); #ifndef DBUG_OFF From 8c55cf8f9a9784bce6c20f2f1ef232bada48f114 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 20:22:56 +0200 Subject: [PATCH 13/19] rpl_empty_master_crash need a master restart so that all log files are deleted --- mysql-test/t/rpl_empty_master_crash-master.opt | 1 + 1 file changed, 1 insertion(+) create mode 100644 mysql-test/t/rpl_empty_master_crash-master.opt diff --git a/mysql-test/t/rpl_empty_master_crash-master.opt b/mysql-test/t/rpl_empty_master_crash-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/t/rpl_empty_master_crash-master.opt @@ -0,0 +1 @@ +--force-restart From 1c2113de4078b0ab3e46042ba819b84cf8f91feb Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Fri, 13 Oct 2006 20:29:27 +0200 Subject: [PATCH 14/19] Look for client bindirs client_release and client_debug before other directories. --- mysql-test/mysql-test-run.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 24cdedce712..3cc0110ed05 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -468,11 +468,11 @@ sub initial_setup () { # # Look for the path where to find the client binaries - $path_client_bindir= mtr_path_exists("$glob_basedir/client/release", + $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", + "$glob_basedir/client_debug", + "$glob_basedir/client/release", "$glob_basedir/client/debug", "$glob_basedir/client", - "$glob_basedir/client_release", - "$glob_basedir/client_debug", "$glob_basedir/bin"); # Look for the mysqld executable @@ -484,6 +484,7 @@ sub initial_setup () { "$path_client_bindir/mysqld-debug", "$path_client_bindir/mysqld-max", "$glob_basedir/libexec/mysqld", + "$glob_basedir/bin/mysqld", "$glob_basedir/sql/release/mysqld", "$glob_basedir/sql/debug/mysqld"); From a9bd28307db529fdfde6204213aea6002ac8f3e7 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Sat, 14 Oct 2006 16:31:20 +0200 Subject: [PATCH 15/19] Skip looking for mysql_client_test in 4.1 on windows as it's not built by default --- mysql-test/mysql-test-run.pl | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 3cc0110ed05..79f01c3cb68 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1417,18 +1417,27 @@ sub executable_setup () { } - # Look for mysql_client_test executable - if ( $glob_use_embedded_server ) + if ( $glob_win32 and $mysql_version_id < 50000 ) { - $exe_mysql_client_test= - mtr_exe_exists("$glob_basedir/libmysqld/examples/mysql_client_test_embedded"); + # Skip looking for exe_mysql_client_test as its not built by default + # in 4.1 for windows. + exe_mysql_client_test= "unavailable"; } else { - $exe_mysql_client_test= - mtr_exe_exists("$glob_basedir/tests/mysql_client_test", - "$glob_basedir/tests/release/mysql_client_test", - "$glob_basedir/tests/debug/mysql_client_test"); + # Look for mysql_client_test executable + if ( $glob_use_embedded_server ) + { + $exe_mysql_client_test= + mtr_exe_exists("$glob_basedir/libmysqld/examples/mysql_client_test_embedded"); + } + else + { + $exe_mysql_client_test= + mtr_exe_exists("$glob_basedir/tests/mysql_client_test", + "$glob_basedir/tests/release/mysql_client_test", + "$glob_basedir/tests/debug/mysql_client_test"); + } } } From d8b9f7cb0eaa3be9fa5f71f2b0ab8c22d9d6b592 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Sat, 14 Oct 2006 17:02:43 +0200 Subject: [PATCH 16/19] Improving debugging support in 'read_line' function --- client/mysqltest.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index e46f22de4df..7029e0af3e1 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -3346,7 +3346,7 @@ int read_line(char *buf, int size) LINT_INIT(last_quote); start_lineno= cur_file->lineno; - DBUG_PRINT("info", ("start_lineno: %d", start_lineno)); + DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno)); for (; p < buf_end ;) { skip_char= 0; @@ -3370,7 +3370,7 @@ int read_line(char *buf, int size) die("Missing end of block"); *p= 0; - DBUG_PRINT("info", ("end of file")); + DBUG_PRINT("info", ("end of file at line %d", cur_file->lineno)); DBUG_RETURN(1); } cur_file--; @@ -3393,7 +3393,8 @@ int read_line(char *buf, int size) if (end_of_query(c)) { *p= 0; - DBUG_PRINT("exit", ("Found delimiter '%s'", delimiter)); + DBUG_PRINT("exit", ("Found delimiter '%s' at line %d", + delimiter, cur_file->lineno)); DBUG_RETURN(0); } else if ((c == '{' && @@ -3405,7 +3406,8 @@ int read_line(char *buf, int size) /* Only if and while commands can be terminated by { */ *p++= c; *p= 0; - DBUG_PRINT("exit", ("Found '{' indicating begining of block")); + DBUG_PRINT("exit", ("Found '{' indicating start of block at line %d", + cur_file->lineno)); DBUG_RETURN(0); } else if (c == '\'' || c == '"' || c == '`') @@ -3420,7 +3422,8 @@ int read_line(char *buf, int size) { /* Comments are terminated by newline */ *p= 0; - DBUG_PRINT("exit", ("Found newline in comment")); + DBUG_PRINT("exit", ("Found newline in comment at line: %d", + cur_file->lineno)); DBUG_RETURN(0); } break; @@ -3435,13 +3438,19 @@ int read_line(char *buf, int size) { /* Skip all space at begining of line */ if (c == '\n') - start_lineno= cur_file->lineno; /* Query hasn't started yet */ + { + /* Query hasn't started yet */ + start_lineno= cur_file->lineno; + DBUG_PRINT("info", ("Query hasn't started yet, start_lineno: %d", + start_lineno)); + } skip_char= 1; } else if (end_of_query(c)) { *p= 0; - DBUG_PRINT("exit", ("Found delimiter '%s'", delimiter)); + DBUG_PRINT("exit", ("Found delimiter '%s' at line: %d", + delimiter, cur_file->lineno)); DBUG_RETURN(0); } else if (c == '}') @@ -3449,7 +3458,8 @@ int read_line(char *buf, int size) /* A "}" need to be by itself in the begining of a line to terminate */ *p++= c; *p= 0; - DBUG_PRINT("exit", ("Found '}' in begining of a line")); + DBUG_PRINT("exit", ("Found '}' in begining of a line at line: %d", + cur_file->lineno)); DBUG_RETURN(0); } else if (c == '\'' || c == '"' || c == '`') From a9e60bab2917d263db14f9543b4af9f230155b46 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Sat, 14 Oct 2006 17:09:06 +0200 Subject: [PATCH 17/19] Use char as datatype for the byte that are read with my_fgetc, fixes problem with mysqltest.test on Solaris and Mac. write_file produced nice files with all zeroes. --- client/mysqltest.c | 2 +- mysql-test/mysql-test-run.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 7029e0af3e1..efb5f1915f4 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1810,7 +1810,7 @@ void my_ungetc(int c) void read_until_delimiter(DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_delimiter) { - int c; + char c; DBUG_ENTER("read_until_delimiter"); DBUG_PRINT("enter", ("delimiter: %s, length: %d", ds_delimiter->str, ds_delimiter->length)); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 79f01c3cb68..35782733b20 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1421,7 +1421,7 @@ sub executable_setup () { { # Skip looking for exe_mysql_client_test as its not built by default # in 4.1 for windows. - exe_mysql_client_test= "unavailable"; + $exe_mysql_client_test= "unavailable"; } else { From 88e11706c3491e83f359729d08aab362d36b4403 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Sat, 14 Oct 2006 17:14:03 +0200 Subject: [PATCH 18/19] No need to continue in 'mtr_report_test_failed' after timeout detected, return immediately after --- mysql-test/lib/mtr_report.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index ec1bed9671b..b173896d48a 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -133,6 +133,7 @@ sub mtr_report_test_failed ($) { if ( $tinfo->{'timeout'} ) { print "[ fail ] timeout\n"; + return; } elsif ( $tinfo->{'ndb_test'} and $::cluster->[0]->{'installed_ok'} eq "NO") { From 3a709f50b27acf9bce0fd6e5ddcd45ae2f277bee Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Tue, 17 Oct 2006 11:06:11 -0400 Subject: [PATCH 19/19] Fix previous bad patch for Bug#14262. Remove table engine qualification where it's unnecessary. --- mysql-test/r/view.result | 4 ++-- mysql-test/t/view.test | 4 ++-- sql/sql_parse.cc | 2 ++ sql/sql_view.cc | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 213a1dcde20..d71f046d095 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1980,7 +1980,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI drop view v1; drop table t1; set sql_mode='strict_all_tables'; -CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = INNODB; +CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL); CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1; CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2; INSERT INTO t1 (col1) VALUES(12); @@ -2032,7 +2032,7 @@ f3 f1 1 3 drop view v1; drop table t1; -CREATE TABLE t1 (f1 char) ENGINE = innodb; +CREATE TABLE t1 (f1 char); INSERT INTO t1 VALUES ('A'); CREATE VIEW v1 AS SELECT * FROM t1; INSERT INTO t1 VALUES('B'); diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index b631d2032c4..f53f5c1d46c 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1801,7 +1801,7 @@ drop table t1; # underlying tables (BUG#6443) # set sql_mode='strict_all_tables'; -CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = INNODB; +CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL); CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1; CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2; -- error 1364 @@ -1857,7 +1857,7 @@ drop table t1; # # Test for bug #11771: wrong query_id in SELECT * FROM # -CREATE TABLE t1 (f1 char) ENGINE = innodb; +CREATE TABLE t1 (f1 char); INSERT INTO t1 VALUES ('A'); CREATE VIEW v1 AS SELECT * FROM t1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index febe256807a..e0b870e7381 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4720,6 +4720,8 @@ end_with_restore_list: { if (end_active_trans(thd)) goto error; + + res= mysql_create_view(thd, first_table, thd->lex->create_view_mode); break; } case SQLCOM_DROP_VIEW: diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 82acab7129e..245ef1a9f54 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1384,7 +1384,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) non_existant_views.append(','); non_existant_views.append(String(view->table_name,system_charset_info)); } - VOID(pthread_mutex_unlock(&LOCK_open)); continue; } if (my_delete(path, MYF(MY_WME)))