From c828e4cec30cee4b9a8ceb7edb371e80bcb6aaab Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Aug 2006 09:49:01 -0400 Subject: [PATCH 01/52] Bug#18875: Default value of tmp_table_size is meaningless It makes no sense to have a default tmp_table_size larger than the max_heap_table_size . In usage, the tmp is ever limited to the max value, so I lowered the default tmp to the default max value. A great idea would be to emit a warning when the tmp_table_size is set to greater than max_heap_table_size . sql/mysqld.cc: Lowered tmp_table_size default to be the same as max_heap_table_size default. --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 087613c6b7c..4c6e5c5326b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6310,7 +6310,7 @@ The minimum value for this variable is 4096.", "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", (gptr*) &global_system_variables.tmp_table_size, (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG, - REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0}, + REQUIRED_ARG, 16*1024*1024L, 1024, ~0L, 0, 1, 0}, /* See max_heap_table_size . */ {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, "Allocation block size for transactions to be stored in binary log", (gptr*) &global_system_variables.trans_alloc_block_size, From 943543ba09e37502278454a70877fe467352e261 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Aug 2006 15:31:06 -0400 Subject: [PATCH 02/52] Bug#21224: mysql_upgrade uses possibly insecure temporary files We open for writing a known location, which is exploitable with a symlink attack. Now, use the EXCLusive flag, so that the presence of anything at that location causes a failure. Try once to open safely, and if failure then remove that location and try again to open safely. If both fail, then raise an error. client/mysql_upgrade.c: Open the file with the O_EXCL flag, so that a symlink attack would not work. If opening it fails, try removing something at that location, and try again. If the second time fails, then abort as previous. --- client/mysql_upgrade.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 3288b627554..053eb86b051 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -149,17 +149,29 @@ static int create_defaults_file(const char *path, const char *our_defaults_path) File our_defaults_file, defaults_file; char buffer[512]; char *buffer_end; + int failed_to_open_count= 0; int error; /* check if the defaults file is needed at all */ if (!opt_password) return 0; - defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY, +retry_open: + defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL, MYF(MY_FAE | MY_WME)); if (defaults_file < 0) - return 1; + { + if (failed_to_open_count == 0) + { + remove(path); + failed_to_open_count+= 1; + goto retry_open; + } + else + return 1; + } + upgrade_defaults_created= 1; if (our_defaults_path) { From 3212b399a85b3c985655b950443fe09133c0922c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Aug 2006 17:09:19 -0600 Subject: [PATCH 03/52] Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb Make the encryption functions MD5(), SHA1() and ENCRYPT() return binary results. Make MAKE_SET() and EXPORT_SET() use the correct character set for their default separator strings. mysql-test/r/ctype_ucs.result: Add tests for bug #20536. mysql-test/t/ctype_ucs.test: Add tests for bug #20536. Tests showing correct behavior for MD5(), SHA1(), MAKE_SET() and EXPORT_SET(). Also, tests showing incorrect behavior, which will remain "Won't fix", for PASSWORD(), OLD_PASSWORD(), ENCRYPT() and QUOTE(). sql/item_strfunc.cc: Make the encryption functions MD5(), SHA1() and ENCRYPT() return binary results. Make MAKE_SET() and EXPORT_SET() use the correct character set for their default separator strings. sql/item_strfunc.h: Make the encryption functions MD5(), SHA1() and ENCRYPT() return binary results. --- mysql-test/r/ctype_ucs.result | 43 +++++++++++++++++++++++++++++++++++ mysql-test/t/ctype_ucs.test | 41 ++++++++++++++++++++++++++++++++- sql/item_strfunc.cc | 14 ++++++++---- sql/item_strfunc.h | 26 +++++++++++++++++---- 4 files changed, 115 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index bcf9cc77519..3a65287ffc5 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -722,3 +722,46 @@ id MIN(s) 1 ZZZ 2 ZZZ DROP TABLE t1; +drop table if exists bug20536; +set names latin1; +create table bug20536 (id bigint not null auto_increment primary key, name +varchar(255) character set ucs2 not null); +insert into `bug20536` (`id`,`name`) values (1, _latin1 x'74657374311a'), (2, "'test\\_2'"); +select md5(name) from bug20536; +md5(name) +3417d830fe24ffb2f81a28e54df2d1b3 +48d95db0d8305c2fe11548a3635c9385 +select sha1(name) from bug20536; +sha1(name) +72228a6d56efb7a89a09543068d5d8fa4c330881 +677d4d505355eb5b0549b865fcae4b7f0c28aef5 +select make_set(3, name, upper(name)) from bug20536; +make_set(3, name, upper(name)) +test1,TEST1 +'test\_2','TEST\_2' +select export_set(5, name, upper(name)) from bug20536; +export_set(5, name, upper(name)) +test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1 +'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2' +select export_set(5, name, upper(name), ",", 5) from bug20536; +export_set(5, name, upper(name), ",", 5) +test1,TEST1,test1,TEST1,TEST1 +'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2' +select password(name) from bug20536; +password(name) +???????????????????? +???????????????????? +select old_password(name) from bug20536; +old_password(name) +???????? +???????? +select encrypt(name, 'SALT') from bug20536; +encrypt(name, 'SALT') +SA5pDi1UPZdys +SA5pDi1UPZdys +select quote(name) from bug20536; +quote(name) +?????????? +???????????????? +drop table bug20536; +End of 4.1 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index a4d4d1846a7..0ad38d98403 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -463,4 +463,43 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ'); SELECT id, MIN(s) FROM t1 GROUP BY id; DROP TABLE t1; -# End of 4.1 tests + +# +# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb +# + +--disable_warnings +drop table if exists bug20536; +--enable_warnings + +set names latin1; +create table bug20536 (id bigint not null auto_increment primary key, name +varchar(255) character set ucs2 not null); +insert into `bug20536` (`id`,`name`) values (1, _latin1 x'74657374311a'), (2, "'test\\_2'"); +select md5(name) from bug20536; +select sha1(name) from bug20536; +select make_set(3, name, upper(name)) from bug20536; +select export_set(5, name, upper(name)) from bug20536; +select export_set(5, name, upper(name), ",", 5) from bug20536; + +# Some broken functions: add these tests just to document current behavior. + +# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would +# not be backwards compatible in all cases, so it's best to leave it alone +select password(name) from bug20536; +select old_password(name) from bug20536; + +# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it +# doesn't return good results for strings with embedded 0 bytes. It won't be +# fixed unless we choose to re-implement the crypt() function ourselves to take +# an extra size_t string_length argument. +select encrypt(name, 'SALT') from bug20536; + +# QUOTE doesn't work with UCS2 data. It would require a total rewrite +# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is +# supported fully as a client character set. +select quote(name) from bug20536; + +drop table bug20536; + +--echo End of 4.1 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7bc7956283b..56a31d074ac 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -88,6 +88,7 @@ String *Item_func_md5::val_str(String *str) { DBUG_ASSERT(fixed == 1); String * sptr= args[0]->val_str(str); + str->set_charset(&my_charset_bin); if (sptr) { my_MD5_CTX context; @@ -134,6 +135,7 @@ String *Item_func_sha::val_str(String *str) { DBUG_ASSERT(fixed == 1); String * sptr= args[0]->val_str(str); + str->set_charset(&my_charset_bin); if (sptr) /* If we got value different from NULL */ { SHA1_CONTEXT context; /* Context used to generate SHA1 hash */ @@ -1529,7 +1531,7 @@ String *Item_func_encrypt::val_str(String *str) null_value= 1; return 0; } - str->set(tmp,(uint) strlen(tmp),res->charset()); + str->set(tmp, (uint) strlen(tmp), &my_charset_bin); str->copy(); pthread_mutex_unlock(&LOCK_crypt); return str; @@ -1926,7 +1928,7 @@ String *Item_func_make_set::val_str(String *str) return &my_empty_string; result= &tmp_str; } - if (tmp_str.append(',') || tmp_str.append(*res)) + if (tmp_str.append(",", 1, &my_charset_bin) || tmp_str.append(*res)) return &my_empty_string; } } @@ -2592,8 +2594,12 @@ String* Item_func_export_set::val_str(String* str) } break; case 3: - sep_buf.set(",", 1, default_charset()); - sep = &sep_buf; + { + /* errors is not checked - assume "," can always be converted */ + uint errors; + sep_buf.copy(",", 1, &my_charset_bin, collation.collation, &errors); + sep = &sep_buf; + } break; default: DBUG_ASSERT(0); // cannot happen diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index f800c17182b..d3e2d24099b 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -41,7 +41,10 @@ class Item_func_md5 :public Item_str_func { String tmp_value; public: - Item_func_md5(Item *a) :Item_str_func(a) {} + Item_func_md5(Item *a) :Item_str_func(a) + { + collation.set(&my_charset_bin); + } String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "md5"; } @@ -51,7 +54,10 @@ public: class Item_func_sha :public Item_str_func { public: - Item_func_sha(Item *a) :Item_str_func(a) {} + Item_func_sha(Item *a) :Item_str_func(a) + { + collation.set(&my_charset_bin); + } String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "sha"; } @@ -306,9 +312,21 @@ public: class Item_func_encrypt :public Item_str_func { String tmp_value; + + /* Encapsulate common constructor actions */ + void constructor_helper() + { + collation.set(&my_charset_bin); + } public: - Item_func_encrypt(Item *a) :Item_str_func(a) {} - Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {} + Item_func_encrypt(Item *a) :Item_str_func(a) + { + constructor_helper(); + } + Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) + { + constructor_helper(); + } String *val_str(String *); void fix_length_and_dec() { maybe_null=1; max_length = 13; } const char *func_name() const { return "ecrypt"; } From 2606cb9321d7d3179506587043a2a24782ee802e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Aug 2006 01:42:57 +0200 Subject: [PATCH 04/52] Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Fixes the following bugs: - Bug #19834: Using cursors when running in READ-COMMITTED can cause InnoDB to crash - Bug #20213: DBT2 testing cause mysqld to core using Innodb - Bug #20493: on partition tables, select and show command casue server crash - Bug #21113: Duplicate printout in SHOW INNODB STATUS - Bug #21313: rsql_..._recover_innodb_tmp_table is redundant and broken - Bug #21467: Manual URL wrong in InnoDB "page corrupted" error report mysql-test/r/innodb.result: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. innodb.result: Adjust Innodb_rows_inserted and Innodb_rows_updated to reflect the deleted statements in r420, which somehow reappeared in the MySQL tree. mysql-test/t/innodb.test: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. sql/ha_innodb.cc: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. ha_innobase::start_stmt(): patch from Heikki: Do not call read_view_close_for_mysql(). (Bug #19834) Fix Bug#20213 and its duplicates: stress test crashes of InnoDB-5.1 Fix Bug #20493 : we must prepare prebuilt->trx to point to the trx of this thd before using it Add update_thd() to several places in ha_innodb.cc to make sure prebuilt->trx points to the right trx object; in other functions add assertions that prebuilt->trx is for this thd; when 5.1 stabilizes, we can change these assertions to ut_ad() debug version assertions Remove redundant check_trx_exists() and ut_a() from r701, as suggested by Marko Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/btr/btr0btr.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/buf/buf0buf.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/dict/dict0dict.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/fil/fil0fil.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Make the tablespace cache hash size 100 or 1000 times bigger. Fixes bug #21112. After ut_print_timestamp(), always display " InnoDB:" (note two spaces). Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/fsp/fsp0fsp.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/ibuf/ibuf0ibuf.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. ibuf_print(): Don't print redundant information. Fixes bug #21113. Remove non-varying variable ibuf->meter and related constant IBUF_THRESHOLD. storage/innobase/include/btr0cur.ic: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. btr_cur_get_page(): Remove buggy assertion. storage/innobase/include/buf0buf.ic: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/include/ibuf0ibuf.ic: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Remove non-varying variable ibuf->meter and related constant IBUF_THRESHOLD. storage/innobase/log/log0log.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/log/log0recv.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/os/os0file.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/row/row0mysql.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Remove the special treatment of tables rsql_IDENTIFIER_recover_innodb_tmp_table, which is redundant and was broken with the introduction of the "safe" file name encoding of identifiers. (Bug #21313) ChangeSet@1.2181.173.1 2006-08-02 17:57:06+02:00 ingo@local Bug#18775 - Temporary table from alter table visible to other threads Continued implementation of WL#1324 (table name to filename encoding) Changed back the encoded temp file prefix to #sql. After ut_print_timestamp(), always display " InnoDB:" (note two spaces). Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/row/row0sel.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/row/row0vers.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. row_vers_build_for_semi_consistent_read(): rec_trx_id was uninitialized in a comparison. Initialize it. storage/innobase/srv/srv0start.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/ut/ut0dbg.c: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. ut_dbg_assertion_failed(): Print space between timestamp and start of error message. After ut_print_timestamp(), always display " InnoDB:" (note two spaces). Correct all URLs pointing to the MySQL manual. (Bug #21467) storage/innobase/Makefile.am: Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots. All but ss677 are against the mysql-5.1 tree only. --- mysql-test/r/innodb.result | 16 +--- mysql-test/t/innodb.test | 8 -- sql/ha_innodb.cc | 129 +++++++++++++------------ storage/innobase/Makefile.am | 3 +- storage/innobase/btr/btr0btr.c | 2 +- storage/innobase/buf/buf0buf.c | 5 +- storage/innobase/dict/dict0dict.c | 11 +-- storage/innobase/fil/fil0fil.c | 26 ++--- storage/innobase/fsp/fsp0fsp.c | 2 +- storage/innobase/ibuf/ibuf0ibuf.c | 17 +--- storage/innobase/include/btr0cur.ic | 5 +- storage/innobase/include/buf0buf.ic | 8 +- storage/innobase/include/ibuf0ibuf.ic | 11 +-- storage/innobase/log/log0log.c | 2 +- storage/innobase/log/log0recv.c | 4 +- storage/innobase/os/os0file.c | 12 +-- storage/innobase/row/row0mysql.c | 133 ++++---------------------- storage/innobase/row/row0sel.c | 2 +- storage/innobase/row/row0vers.c | 2 +- storage/innobase/srv/srv0start.c | 2 +- storage/innobase/ut/ut0dbg.c | 4 +- 21 files changed, 138 insertions(+), 266 deletions(-) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 3034fc2035e..e26e6fb271a 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1295,24 +1295,16 @@ insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; select count(*) from t1; count(*) -29267 +623 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 2500; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using where +1 SIMPLE t1 ALL c NULL NULL 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); @@ -1786,10 +1778,10 @@ Variable_name Value Innodb_rows_deleted 2070 show status like "Innodb_rows_inserted"; Variable_name Value -Innodb_rows_inserted 31727 +Innodb_rows_inserted 3083 show status like "Innodb_rows_updated"; Variable_name Value -Innodb_rows_updated 29530 +Innodb_rows_updated 886 show status like "Innodb_row_lock_waits"; Variable_name Value Innodb_row_lock_waits 0 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index d00c5499ef9..1a2afad3b44 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -904,14 +904,6 @@ insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -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 2500; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 00a92e05ffb..6b19ea228e5 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -208,6 +208,7 @@ static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root); static const char innobase_hton_name[]= "InnoDB"; + handlerton innobase_hton; static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root) @@ -2364,8 +2365,7 @@ ha_innobase::open( "have forgotten\nto delete the corresponding " ".frm files of InnoDB tables, or you\n" "have moved .frm files to another database?\n" - "Look from section 15.1 of " - "http://www.innodb.com/ibman.html\n" + "See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "how you can resolve the problem.\n", norm_name); free_share(share); @@ -2382,8 +2382,7 @@ ha_innobase::open( "Have you deleted the .ibd file from the " "database directory under\nthe MySQL datadir, " "or have you used DISCARD TABLESPACE?\n" - "Look from section 15.1 of " - "http://www.innodb.com/ibman.html\n" + "See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "how you can resolve the problem.\n", norm_name); free_share(share); @@ -3664,7 +3663,7 @@ ha_innobase::update_row( DBUG_ENTER("ha_innobase::update_row"); - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) @@ -3725,7 +3724,7 @@ ha_innobase::delete_row( DBUG_ENTER("ha_innobase::delete_row"); - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); if (last_query_id != user_thd->query_id) { @@ -3823,6 +3822,9 @@ ha_innobase::try_semi_consistent_read(bool yes) { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + ut_a(prebuilt->trx == + (trx_t*) current_thd->ha_data[innobase_hton.slot]); + /* Row read type is set to semi consistent read if this was requested by the MySQL and either innodb_locks_unsafe_for_binlog option is used or this session is using READ COMMITTED isolation @@ -3987,7 +3989,7 @@ ha_innobase::index_read( DBUG_ENTER("index_read"); - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); statistic_increment(current_thd->status_var.ha_read_key_count, @@ -4102,7 +4104,7 @@ ha_innobase::change_active_index( DBUG_ENTER("change_active_index"); ut_ad(user_thd == current_thd); - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); active_index = keynr; @@ -4192,7 +4194,7 @@ ha_innobase::general_fetch( DBUG_ENTER("general_fetch"); - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); innodb_srv_conc_enter_innodb(prebuilt->trx); @@ -4428,7 +4430,7 @@ ha_innobase::rnd_pos( statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status); - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); if (prebuilt->clust_index_was_generated) { @@ -4478,7 +4480,7 @@ ha_innobase::position( row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; uint len; - ut_ad(prebuilt->trx == + ut_a(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); if (prebuilt->clust_index_was_generated) { @@ -5006,7 +5008,6 @@ ha_innobase::delete_all_rows(void) { row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt; int error; - trx_t* trx; THD* thd = current_thd; DBUG_ENTER("ha_innobase::delete_all_rows"); @@ -5019,13 +5020,13 @@ ha_innobase::delete_all_rows(void) } /* Get the transaction associated with the current thd, or create one - if not yet created */ + if not yet created, and update prebuilt->trx */ - trx = check_trx_exists(thd); + update_thd(thd); /* Truncate the table in InnoDB */ - error = row_truncate_table_for_mysql(prebuilt->table, trx); + error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx); if (error == DB_ERROR) { /* Cannot truncate; resort to ha_innobase::delete_row() */ goto fallback; @@ -5308,6 +5309,9 @@ ha_innobase::records_in_range( DBUG_ENTER("records_in_range"); + ut_a(prebuilt->trx == + (trx_t*) current_thd->ha_data[innobase_hton.slot]); + prebuilt->trx->op_info = (char*)"estimating records in index range"; /* In case MySQL calls this in the middle of a SELECT query, release @@ -5604,13 +5608,14 @@ ha_innobase::info( for (i = 0; i < table->s->keys; i++) { if (index == NULL) { ut_print_timestamp(stderr); - sql_print_error("Table %s contains less " + sql_print_error("Table %s contains fewer " "indexes inside InnoDB than " "are defined in the MySQL " ".frm file. Have you mixed up " ".frm files from different " - "installations? See section " - "15.1 at http://www.innodb.com/ibman.html", + "installations? See " +"http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", + ib_table->name); break; } @@ -5619,17 +5624,11 @@ ha_innobase::info( if (j + 1 > index->n_uniq) { ut_print_timestamp(stderr); - sql_print_error("Index %s of %s has " - "%lu columns unique " - "inside InnoDB, but " - "MySQL is asking " - "statistics for %lu " - "columns. Have you " - "mixed up .frm files " - "from different " - "installations? See " - "section 15.1 at " - "http://www.innodb.com/ibman.html", + sql_print_error( +"Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking " +"statistics for %lu columns. Have you mixed up .frm files from different " +"installations? " +"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", index->name, ib_table->name, (unsigned long) @@ -6035,6 +6034,10 @@ ha_innobase::can_switch_engines(void) bool can_switch; DBUG_ENTER("ha_innobase::can_switch_engines"); + + ut_a(prebuilt->trx == + (trx_t*) current_thd->ha_data[innobase_hton.slot]); + prebuilt->trx->op_info = "determining if there are foreign key constraints"; row_mysql_lock_data_dictionary(prebuilt->trx); @@ -6172,14 +6175,6 @@ ha_innobase::start_stmt( innobase_release_stat_resources(trx); - if (trx->isolation_level <= TRX_ISO_READ_COMMITTED - && trx->global_read_view) { - /* At low transaction isolation levels we let - each consistent read set its own snapshot */ - - read_view_close_for_mysql(trx); - } - prebuilt->sql_stat_start = TRUE; prebuilt->hint_need_to_fetch_extra_cols = 0; prebuilt->read_just_key = 0; @@ -6438,7 +6433,7 @@ ha_innobase::transactional_table_lock( "table %s does not exist.\n" "Have you deleted the .ibd file from the database directory under\n" "the MySQL datadir?" -"Look from section 15.1 of http://www.innodb.com/ibman.html\n" +"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "how you can resolve the problem.\n", prebuilt->table->name); DBUG_RETURN(HA_ERR_CRASHED); @@ -6792,7 +6787,15 @@ ha_innobase::store_lock( TL_IGNORE */ { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - trx_t* trx = prebuilt->trx; + trx_t* trx; + + /* Call update_thd() to update prebuilt->trx to point to the trx + object of thd! Failure to do this caused a serious memory + corruption bug in 5.1.11. */ + + update_thd(thd); + + trx = prebuilt->trx; /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE! Be careful to ignore TL_IGNORE if we are going to do something with @@ -6909,28 +6912,28 @@ ha_innobase::store_lock( stored function call (MySQL does have thd->in_lock_tables TRUE there). */ - if ((lock_type >= TL_WRITE_CONCURRENT_INSERT - && lock_type <= TL_WRITE) - && !(thd->in_lock_tables - && thd->lex->sql_command == SQLCOM_LOCK_TABLES) - && !thd->tablespace_op - && thd->lex->sql_command != SQLCOM_TRUNCATE - && thd->lex->sql_command != SQLCOM_OPTIMIZE + if ((lock_type >= TL_WRITE_CONCURRENT_INSERT + && lock_type <= TL_WRITE) + && !(thd->in_lock_tables + && thd->lex->sql_command == SQLCOM_LOCK_TABLES) + && !thd->tablespace_op + && thd->lex->sql_command != SQLCOM_TRUNCATE + && thd->lex->sql_command != SQLCOM_OPTIMIZE + #ifdef __WIN__ - /* - for alter table on win32 for succesfull operation - completion it is used TL_WRITE(=10) lock instead of - TL_WRITE_ALLOW_READ(=6), however here in innodb handler - TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes - race condition when several clients do alter table - simultaneously (bug #17264). This fix avoids the problem. - */ - && thd->lex->sql_command != SQLCOM_ALTER_TABLE + /* For alter table on win32 for succesful operation + completion it is used TL_WRITE(=10) lock instead of + TL_WRITE_ALLOW_READ(=6), however here in innodb handler + TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes + race condition when several clients do alter table + simultaneously (bug #17264). This fix avoids the problem. */ + && thd->lex->sql_command != SQLCOM_ALTER_TABLE #endif - && thd->lex->sql_command != SQLCOM_CREATE_TABLE) { + + && thd->lex->sql_command != SQLCOM_CREATE_TABLE) { lock_type = TL_WRITE_ALLOW_WRITE; - } + } /* In queries of type INSERT INTO t1 SELECT ... FROM t2 ... MySQL would use the lock TL_READ_NO_INSERT on t2, and that @@ -6977,10 +6980,11 @@ ha_innobase::innobase_read_and_init_auto_inc( int error; ut_a(prebuilt); - ut_a(prebuilt->trx == - (trx_t*) current_thd->ha_data[innobase_hton.slot]); ut_a(prebuilt->table); + /* Prepare prebuilt->trx in the table handle */ + update_thd(current_thd); + if (prebuilt->trx->conc_state == TRX_NOT_STARTED) { trx_was_not_started = TRUE; } @@ -7115,6 +7119,9 @@ void ha_innobase::get_auto_increment( longlong nr; int error; + /* Prepare prebuilt->trx in the table handle */ + update_thd(current_thd); + error = innobase_read_and_init_auto_inc(&nr); if (error) { @@ -7143,6 +7150,8 @@ ha_innobase::reset_auto_increment(ulonglong value) row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; int error; + update_thd(current_thd); + error = row_lock_table_autoinc_for_mysql(prebuilt); if (error != DB_SUCCESS) { @@ -7183,7 +7192,7 @@ ha_innobase::cmp_ref( const mysql_byte* ref2) /* in: an (internal) primary key value in the MySQL key value format */ { - row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; enum_field_types mysql_type; Field* field; KEY_PART_INFO* key_part; diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 7884715d839..3f46f059fc0 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -77,8 +77,7 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \ include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \ include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \ - include/ut0list.h include/ut0list.ic \ - include/ut0wqueue.h \ + include/ut0list.h include/ut0list.ic include/ut0wqueue.h \ CMakeLists.txt noinst_LIBRARIES = libinnobase.a diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index ae3e722b513..57c6289e5f7 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -624,7 +624,7 @@ btr_page_get_father_for_rec( fputs( "InnoDB: You should dump + drop + reimport the table to fix the\n" "InnoDB: corruption. If the crash happens at the database startup, see\n" -"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html about\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html about\n" "InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr); } diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 5f3e4a9ea50..ad23da4af93 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -323,7 +323,8 @@ buf_page_is_corrupted( "InnoDB: is in the future! Current system log sequence number %lu %lu.\n" "InnoDB: Your database may be corrupt or you may have copied the InnoDB\n" "InnoDB: tablespace but not the InnoDB log files. See\n" -"http://dev.mysql.com/doc/mysql/en/backing-up.html for more information.\n", +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" +"InnoDB: for more information.\n", (ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET), (ulong) ut_dulint_get_high( mach_read_from_8(read_buf + FIL_PAGE_LSN)), @@ -1923,7 +1924,7 @@ buf_page_io_complete( "InnoDB: the corrupt table. You can use CHECK\n" "InnoDB: TABLE to scan your table for corruption.\n" "InnoDB: See also " - "http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index ce075138cb1..3470b19ed71 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -2215,8 +2215,8 @@ dict_foreign_error_report( if (fk->foreign_index) { fputs("The index in the foreign key in table is ", file); ut_print_name(file, NULL, FALSE, fk->foreign_index->name); - fputs( -"\nSee http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n" + fputs("\n" +"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n" "for correct foreign key definition.\n", file); } @@ -3119,7 +3119,7 @@ col_loop1: ut_print_name(ef, NULL, TRUE, name); fprintf(ef, " where the columns appear\n" "as the first columns. Constraint:\n%s\n" -"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n" +"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n" "for correct foreign key definition.\n", start_of_latest_foreign); mutex_exit(&dict_foreign_err_mutex); @@ -3387,7 +3387,7 @@ try_find_index: "Note that the internal storage type of ENUM and SET changed in\n" "tables created with >= InnoDB-4.1.12, and such columns in old tables\n" "cannot be referenced by such columns in new tables.\n" -"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n" +"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n" "for correct foreign key definition.\n", start_of_latest_foreign); mutex_exit(&dict_foreign_err_mutex); @@ -3941,8 +3941,7 @@ dict_update_statistics_low( fprintf(stderr, " InnoDB: cannot calculate statistics for table %s\n" "InnoDB: because the .ibd file is missing. For help, please refer to\n" -"InnoDB: " -"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n", +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", table->name); return; diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index b2935a119a5..722ffc12743 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -251,9 +251,6 @@ struct fil_system_struct { initialized. */ fil_system_t* fil_system = NULL; -/* The tablespace memory cache hash table size */ -#define FIL_SYSTEM_HASH_SIZE 50 /* TODO: make bigger! */ - /************************************************************************ NOTE: you must call fil_mutex_enter_and_prepare_for_io() first! @@ -1323,11 +1320,17 @@ fil_init( /*=====*/ ulint max_n_open) /* in: max number of open files */ { + ulint hash_size; + ut_a(fil_system == NULL); - /*printf("Initializing the tablespace cache with max %lu open files\n", - max_n_open); */ - fil_system = fil_system_create(FIL_SYSTEM_HASH_SIZE, max_n_open); + if (srv_file_per_table) { + hash_size = 50000; + } else { + hash_size = 5000; + } + + fil_system = fil_system_create(hash_size, max_n_open); } /*********************************************************************** @@ -2560,7 +2563,7 @@ fil_reset_too_high_lsns( ut_print_timestamp(stderr); fprintf(stderr, -" InnoDB: Flush lsn in the tablespace file %lu to be imported\n" +" InnoDB: Flush lsn in the tablespace file %lu to be imported\n" "InnoDB: is %lu %lu, which exceeds current system lsn %lu %lu.\n" "InnoDB: We reset the lsn's in the file ", (ulong) space_id, @@ -2685,8 +2688,7 @@ fil_open_single_table_tablespace( "InnoDB: It is also possible that this is a temporary table #sql...,\n" "InnoDB: and MySQL removed the .ibd file for this.\n" "InnoDB: Please refer to\n" -"InnoDB:" -" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: for how to resolve the issue.\n", stderr); mem_free(filepath); @@ -2725,8 +2727,7 @@ fil_open_single_table_tablespace( "InnoDB: Have you moved InnoDB .ibd files around without using the\n" "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n" "InnoDB: Please refer to\n" -"InnoDB:" -" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: for how to resolve the issue.\n", (ulong) space_id, (ulong) id); ret = FALSE; @@ -3373,8 +3374,7 @@ fil_space_for_table_exists_in_mem( error_exit: fputs( "InnoDB: Please refer to\n" -"InnoDB:" -" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: for how to resolve the issue.\n", stderr); mem_free(path); diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c index 43c7ba005cb..9b0406a1c26 100644 --- a/storage/innobase/fsp/fsp0fsp.c +++ b/storage/innobase/fsp/fsp0fsp.c @@ -2988,7 +2988,7 @@ fseg_free_page_low( crash: fputs( "InnoDB: Please refer to\n" -"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); ut_error; } diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index f1ae43033bd..4e38e1f0353 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -373,7 +373,6 @@ ibuf_init_at_db_start(void) ibuf->max_size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE / IBUF_POOL_SIZE_PER_MAX_SIZE; - ibuf->meter = IBUF_THRESHOLD + 1; UT_LIST_INIT(ibuf->data_list); @@ -3517,21 +3516,9 @@ ibuf_print( data = UT_LIST_GET_FIRST(ibuf->data_list); while (data) { - fprintf(file, - "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,", - (ulong) data->space, (ulong) data->size, - (ulong) data->free_list_len, - (ulong) data->seg_size); - - if (data->empty) { - fputs(" is empty\n", file); - } else { - fputs(" is not empty\n", file); - } fprintf(file, - "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n" - "%lu inserts, %lu merged recs, %lu merges\n", - (ulong) data->space, + "Ibuf: size %lu, free list len %lu, seg size %lu,\n" + "%lu inserts, %lu merged recs, %lu merges\n", (ulong) data->size, (ulong) data->free_list_len, (ulong) data->seg_size, diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic index a199c3d4d32..7fbdf6035b0 100644 --- a/storage/innobase/include/btr0cur.ic +++ b/storage/innobase/include/btr0cur.ic @@ -52,10 +52,7 @@ btr_cur_get_page( /* out: pointer to page */ btr_cur_t* cursor) /* in: tree cursor */ { - page_t* page = buf_frame_align(page_cur_get_rec(&(cursor->page_cur))); - ut_ad(!!page_is_comp(page) - == dict_table_is_comp(cursor->index->table)); - return(page); + return(buf_frame_align(page_cur_get_rec(&(cursor->page_cur)))); } /************************************************************* diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index 15187c03636..3c7a64cbcb0 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -216,8 +216,8 @@ buf_block_align( "InnoDB: Error: trying to access a stray pointer %p\n" "InnoDB: buf pool start is at %p, end at %p\n" "InnoDB: Probable reason is database corruption or memory\n" -"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" -"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" +"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" "InnoDB: how to force recovery.\n", ptr, frame_zero, buf_pool->high_end); @@ -252,8 +252,8 @@ buf_frame_align( "InnoDB: Error: trying to access a stray pointer %p\n" "InnoDB: buf pool start is at %p, end at %p\n" "InnoDB: Probable reason is database corruption or memory\n" -"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" -"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" +"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" "InnoDB: how to force recovery.\n", ptr, buf_pool->frame_zero, buf_pool->high_end); diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic index 4eea8f41e32..7e75fccc160 100644 --- a/storage/innobase/include/ibuf0ibuf.ic +++ b/storage/innobase/include/ibuf0ibuf.ic @@ -39,19 +39,11 @@ struct ibuf_data_struct{ ulint n_merged_recs;/* number of records merged */ }; -/* If the ibuf meter exceeds this value, then the suitable inserts are made to -the insert buffer instead of directly to the disk page */ -#define IBUF_THRESHOLD 50 - struct ibuf_struct{ ulint size; /* current size of the ibuf index trees in pages */ ulint max_size; /* recommended maximum size in pages for the ibuf index tree */ - ulint meter; /* heuristic meter which measures - desirability of doing inserts to the - insert buffer instead of directly to - the disk page */ UT_LIST_BASE_NODE_T(ibuf_data_t) data_list; /* list of ibuf data structs for each tablespace */ @@ -88,8 +80,7 @@ ibuf_should_try( decide */ { if (!(index->type & DICT_CLUSTERED) - && (ignore_sec_unique || !(index->type & DICT_UNIQUE)) - && ibuf->meter > IBUF_THRESHOLD) { + && (ignore_sec_unique || !(index->type & DICT_UNIQUE))) { ibuf_flush_count++; diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c index db6b8fabf6f..2351c6055de 100644 --- a/storage/innobase/log/log0log.c +++ b/storage/innobase/log/log0log.c @@ -720,7 +720,7 @@ failure: "InnoDB: To get mysqld to start up, set innodb_thread_concurrency in my.cnf\n" "InnoDB: to a lower value, for example, to 8. After an ERROR-FREE shutdown\n" "InnoDB: of mysqld you can adjust the size of ib_logfiles, as explained in\n" -"InnoDB: http://dev.mysql.com/doc/mysql/en/Adding_and_removing.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/adding-and-removing.html\n" "InnoDB: Cannot continue operation. Calling exit(1).\n", (ulong)srv_thread_concurrency); diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index 63a90f05212..8150dba165c 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -542,7 +542,7 @@ recv_find_max_checkpoint( "InnoDB: the problem may be that during an earlier attempt you managed\n" "InnoDB: to create the InnoDB data files, but log file creation failed.\n" "InnoDB: If that is the case, please refer to\n" -"InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n"); +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/error-creating-innodb.html\n"); return(DB_ERROR); } @@ -1962,7 +1962,7 @@ recv_report_corrupt_log( "InnoDB: far enough in recovery! Please run CHECK TABLE\n" "InnoDB: on your InnoDB tables to check that they are ok!\n" "InnoDB: If mysqld crashes after this recovery, look at\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n" + "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); fflush(stderr); diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 74905ce06dd..6cd44a5ad08 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -248,7 +248,7 @@ os_file_get_last_error( fprintf(stderr, "InnoDB: Some operating system error numbers are described at\n" "InnoDB: " - "http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n"); + "http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n"); } } @@ -295,7 +295,7 @@ os_file_get_last_error( fprintf(stderr, "InnoDB: Some operating system error numbers are described at\n" "InnoDB: " - "http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n"); + "http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n"); } } @@ -688,7 +688,7 @@ next_file: /* TODO: test Windows symlinks */ /* TODO: MySQL has apparently its own symlink implementation in Windows, dbname.sym can redirect a database directory: -http://www.mysql.com/doc/en/Windows_symbolic_links.html */ +http://dev.mysql.com/doc/refman/5.1/en/windows-symbolic-links.html */ info->type = OS_FILE_TYPE_LINK; } else if (lpFindFileData->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { @@ -2343,7 +2343,7 @@ retry: "InnoDB: offset %lu %lu. Operating system error number %lu.\n" "InnoDB: Some operating system error numbers are described at\n" "InnoDB: " -"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n", +"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n", name, (ulong) offset_high, (ulong) offset, (ulong) GetLastError()); @@ -2408,7 +2408,7 @@ retry: fprintf(stderr, "InnoDB: Some operating system error numbers are described at\n" "InnoDB: " -"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n"); +"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n"); os_has_said_disk_full = TRUE; } @@ -2444,7 +2444,7 @@ retry: fprintf(stderr, "InnoDB: Some operating system error numbers are described at\n" "InnoDB: " -"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n"); +"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n"); os_has_said_disk_full = TRUE; } diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 5f4a882f4a8..f2d501e0ba7 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -54,27 +54,6 @@ static const char S_innodb_tablespace_monitor[] = "innodb_tablespace_monitor"; static const char S_innodb_table_monitor[] = "innodb_table_monitor"; static const char S_innodb_mem_validate[] = "innodb_mem_validate"; -/* Name suffix for recovered orphaned temporary tables */ -static const char S_recover_innodb_tmp_table[] = "_recover_innodb_tmp_table"; -/*********************************************************************** -Determine if the given name ends in the suffix reserved for recovered -orphaned temporary tables. */ -static -ibool -row_mysql_is_recovered_tmp_table( -/*=============================*/ - /* out: TRUE if table name ends in - the reserved suffix */ - const char* name) -{ - ulint namelen = strlen(name) + 1; - return(namelen >= sizeof S_recover_innodb_tmp_table - && !memcmp(name + namelen - - sizeof S_recover_innodb_tmp_table, - S_recover_innodb_tmp_table, - sizeof S_recover_innodb_tmp_table)); -} - /*********************************************************************** Determine if the given name is a name reserved for MySQL system tables. */ static @@ -550,7 +529,7 @@ handle_new_error: "InnoDB: tables and recreate the whole InnoDB tablespace.\n" "InnoDB: If the mysqld server crashes after the startup or when\n" "InnoDB: you dump the tables, look at\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html" + "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html" " for help.\n", stderr); } else { @@ -1083,7 +1062,7 @@ row_insert_for_mysql( "InnoDB: Have you deleted the .ibd file from the database directory under\n" "InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n" "InnoDB: Look from\n" -"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: how you can resolve the problem.\n", prebuilt->table->name); return(DB_ERROR); @@ -1319,7 +1298,7 @@ row_update_for_mysql( "InnoDB: Have you deleted the .ibd file from the database directory under\n" "InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n" "InnoDB: Look from\n" -"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: how you can resolve the problem.\n", prebuilt->table->name); return(DB_ERROR); @@ -1659,48 +1638,6 @@ row_get_mysql_key_number_for_index( return(i); } -/************************************************************************* -Recovers an orphaned tmp table inside InnoDB by renaming it. In the table -name #sql becomes rsql, and "_recover_innodb_tmp_table" is catenated to -the end of name. table->name should be of the form -"dbname/rsql..._recover_innodb_tmp_table". This renames a table whose -name is "#sql..." */ -static -int -row_mysql_recover_tmp_table( -/*========================*/ - /* out: error code or DB_SUCCESS */ - dict_table_t* table, /* in: table definition */ - trx_t* trx) /* in: transaction handle */ -{ - const char* ptr = strstr(table->name, "/rsql"); - - if (!ptr) { - /* table name does not begin with "/rsql" */ - dict_mem_table_free(table); - trx_commit_for_mysql(trx); - - return(DB_ERROR); - } - else { - int status; - int namelen = (int) strlen(table->name); - char* old_name = mem_strdupl(table->name, namelen); - /* replace "rsql" with "#sql" */ - old_name[ptr - table->name + 1] = '#'; - /* remove "_recover_innodb_tmp_table" suffix */ - ut_ad(namelen > (int) sizeof S_recover_innodb_tmp_table); - ut_ad(!strcmp(old_name + namelen + 1 - - sizeof S_recover_innodb_tmp_table, - S_recover_innodb_tmp_table)); - old_name[namelen + 1 - sizeof S_recover_innodb_tmp_table] = 0; - status = row_rename_table_for_mysql(old_name, - table->name, trx); - mem_free(old_name); - return(status); - } -} - /************************************************************************* Locks the data dictionary in shared mode from modifications, for performing foreign key check, rollback, or other operation invisible to MySQL. */ @@ -1845,18 +1782,6 @@ row_create_table_for_mysql( trx_start_if_not_started(trx); - if (row_mysql_is_recovered_tmp_table(table->name)) { - - /* MySQL prevents accessing of tables whose name begins - with #sql, that is temporary tables. If mysqld crashes in - the middle of an ALTER TABLE, we may get an orphaned - #sql-table in the tablespace. We have here a special - mechanism to recover such tables by renaming them to - rsql... */ - - return(row_mysql_recover_tmp_table(table, trx)); - } - /* The table name is prefixed with the database name and a '/'. Certain table names starting with 'innodb_' have their special meaning regardless of the database name. Thus, we need to @@ -1968,8 +1893,8 @@ row_create_table_for_mysql( "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n" "InnoDB: succeed.\n" "InnoDB: You can look for further help from\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/" - "InnoDB_troubleshooting_datadict.html\n", stderr); +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", + stderr); } /* We may also get err == DB_ERROR if the .ibd file for the @@ -2063,11 +1988,6 @@ row_create_index_for_mysql( } } - if (row_mysql_is_recovered_tmp_table(index->table_name)) { - - return(DB_SUCCESS); - } - heap = mem_heap_create(512); trx->dict_operation = TRUE; @@ -2142,11 +2062,6 @@ row_table_add_foreign_constraints( trx_start_if_not_started(trx); - if (row_mysql_is_recovered_tmp_table(name)) { - - return(DB_SUCCESS); - } - trx->dict_operation = TRUE; err = dict_create_foreign_constraints(trx, sql_string, name, @@ -3054,8 +2969,8 @@ row_drop_table_for_mysql( "InnoDB: Have you copied the .frm file of the table to the\n" "InnoDB: MySQL database directory from another database?\n" "InnoDB: You can look for further help from\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/" - "InnoDB_troubleshooting_datadict.html\n", stderr); +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", + stderr); goto funct_exit; } @@ -3495,7 +3410,6 @@ row_rename_table_for_mysql( mem_heap_t* heap = NULL; const char** constraints_to_drop = NULL; ulint n_constraints_to_drop = 0; - ibool recovering_temp_table = FALSE; ibool old_is_tmp, new_is_tmp; pars_info_t* info = NULL; @@ -3533,15 +3447,10 @@ row_rename_table_for_mysql( old_is_tmp = row_is_mysql_tmp_table_name(old_name); new_is_tmp = row_is_mysql_tmp_table_name(new_name); - if (row_mysql_is_recovered_tmp_table(new_name)) { + /* Serialize data dictionary operations with dictionary mutex: + no deadlocks can occur then in these operations */ - recovering_temp_table = TRUE; - } else { - /* Serialize data dictionary operations with dictionary mutex: - no deadlocks can occur then in these operations */ - - row_mysql_lock_data_dictionary(trx); - } + row_mysql_lock_data_dictionary(trx); table = dict_table_get_low(old_name); @@ -3556,8 +3465,8 @@ row_rename_table_for_mysql( "InnoDB: Have you copied the .frm file of the table to the\n" "InnoDB: MySQL database directory from another database?\n" "InnoDB: You can look for further help from\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/" - "InnoDB_troubleshooting_datadict.html\n", stderr); +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", + stderr); goto funct_exit; } @@ -3570,8 +3479,8 @@ row_rename_table_for_mysql( fputs( " does not have an .ibd file in the database directory.\n" "InnoDB: You can look for further help from\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/" - "InnoDB_troubleshooting_datadict.html\n", stderr); +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n", + stderr); goto funct_exit; } @@ -3719,8 +3628,7 @@ end: fputs(" to it.\n" "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n" "InnoDB: You can look for further help from\n" - "InnoDB: http://dev.mysql.com/doc/mysql/en/" - "InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: If table ", stderr); ut_print_name(stderr, trx, TRUE, new_name); fputs( @@ -3748,8 +3656,8 @@ end: trx_general_rollback_for_mysql(trx, FALSE, NULL); trx->error_state = DB_SUCCESS; ut_print_timestamp(stderr); - fputs(" InnoDB: Error in table rename, cannot rename ", - stderr); + fputs( +" InnoDB: Error in table rename, cannot rename ", stderr); ut_print_name(stderr, trx, TRUE, old_name); fputs(" to ", stderr); ut_print_name(stderr, trx, TRUE, new_name); @@ -3797,10 +3705,7 @@ end: funct_exit: trx_commit_for_mysql(trx); - - if (!recovering_temp_table) { - row_mysql_unlock_data_dictionary(trx); - } + row_mysql_unlock_data_dictionary(trx); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); @@ -3968,7 +3873,7 @@ row_check_table_for_mysql( "InnoDB: Have you deleted the .ibd file from the database directory under\n" "InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n" "InnoDB: Look from\n" -"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: how you can resolve the problem.\n", prebuilt->table->name); return(DB_ERROR); diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index f79bda5d6d8..251ee95886f 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3245,7 +3245,7 @@ row_search_for_mysql( "InnoDB: Have you deleted the .ibd file from the database directory under\n" "InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n" "InnoDB: Look from\n" -"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" "InnoDB: how you can resolve the problem.\n", prebuilt->table->name); diff --git a/storage/innobase/row/row0vers.c b/storage/innobase/row/row0vers.c index ab3b6385146..07b75a34347 100644 --- a/storage/innobase/row/row0vers.c +++ b/storage/innobase/row/row0vers.c @@ -553,7 +553,7 @@ row_vers_build_for_semi_consistent_read( mem_heap_t* heap = NULL; byte* buf; ulint err; - dulint rec_trx_id; + dulint rec_trx_id = ut_dulint_create(0, 0); ut_ad(index->type & DICT_CLUSTERED); ut_ad(mtr_memo_contains(mtr, buf_block_align(rec), MTR_MEMO_PAGE_X_FIX) diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 205b54004ce..8346203f3f7 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1691,7 +1691,7 @@ NetWare. */ "InnoDB: You have now successfully upgraded to the multiple tablespaces\n" "InnoDB: format. You should NOT DOWNGRADE to an earlier version of\n" "InnoDB: InnoDB! But if you absolutely need to downgrade, see\n" -"InnoDB: http://dev.mysql.com/doc/mysql/en/Multiple_tablespaces.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/multiple-tablespaces.html\n" "InnoDB: for instructions.\n"); } diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c index a9391cd3adc..87960b98556 100644 --- a/storage/innobase/ut/ut0dbg.c +++ b/storage/innobase/ut/ut0dbg.c @@ -42,7 +42,7 @@ ut_dbg_assertion_failed( { ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Assertion failure in thread %lu" + " InnoDB: Assertion failure in thread %lu" " in file %s line %lu\n", os_thread_pf(os_thread_get_curr_id()), file, line); if (expr) { @@ -56,7 +56,7 @@ ut_dbg_assertion_failed( "InnoDB: If you get repeated assertion failures or crashes, even\n" "InnoDB: immediately after the mysqld startup, there may be\n" "InnoDB: corruption in the InnoDB tablespace. Please refer to\n" -"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n" +"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); #if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) ut_dbg_stop_threads = TRUE; From e0bffad3e8c121d81e1e64682d7fc8bc5aad8fcf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Aug 2006 18:41:21 +0200 Subject: [PATCH 05/52] Bug #20908: Crash if select @@"" Zero-length variables caused failures when using the length to look up the name in a hash. Instead, signal that no zero-length name can ever be found and that to encounter one is a syntax error. mysql-test/r/variables.result: Results for test. mysql-test/t/variables.test: Insert tests to prove that zero-length variable names do not cause faults. sql/gen_lex_hash.cc: If the length is zero, then there is nothing to look-up in the hash. sql/sql_lex.cc: Names of variables must not be empty. Signal an error of that happens. --- mysql-test/r/variables.result | 6 ++++++ mysql-test/t/variables.test | 11 +++++++++++ sql/gen_lex_hash.cc | 13 +++++++++++-- sql/sql_lex.cc | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index a0e516d2397..cd834a789bd 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes; show variables like 'log_queries_not_using_indexes'; Variable_name Value log_queries_not_using_indexes OFF +select @@""; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1 +select @@&; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1 +select @@@; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1 End of 5.0 tests set global binlog_cache_size =@my_binlog_cache_size; set global connect_timeout =@my_connect_timeout; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 68efcafd1e0..d855b4d8266 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -585,6 +585,16 @@ show variables like 'ssl%'; select @@log_queries_not_using_indexes; show variables like 'log_queries_not_using_indexes'; +# +# Bug#20908: Crash if select @@"" +# +--error ER_PARSE_ERROR +select @@""; +--error ER_PARSE_ERROR +select @@&; +--error ER_PARSE_ERROR +select @@@; + --echo End of 5.0 tests # This is at the very after the versioned tests, since it involves doing @@ -620,3 +630,4 @@ set global server_id =@my_server_id; set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; + diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7e0b178f7af..e59986092e4 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -442,13 +442,16 @@ int main(int argc,char **argv) if (get_options(argc,(char **) argv)) exit(1); + /* Broken up to indicate that it's not advice to you, gentle reader. */ + printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); + printf("/* Copyright (C) 2001-2004 MySQL AB\n\ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ and you are welcome to modify and redistribute it under the GPL license\n\ \n*/\n\n"); - printf("/* This code is generated by gen_lex_hash.cc that seeks for\ - a perfect\nhash function */\n\n"); + printf("/* Do " "not " "edit " "this " "file! This is generated by " + "gen_lex_hash.cc\nthat seeks for a perfect hash function */\n\n"); printf("#include \"lex.h\"\n\n"); calc_length(); @@ -468,6 +471,12 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\ {\n\ register uchar *hash_map;\n\ register const char *cur_str= s;\n\ +\n\ + if (len == 0) {\n\ + DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\ + return(NULL);\n\ + }\ +\n\ if (function){\n\ if (len>sql_functions_max_len) return 0;\n\ hash_map= sql_functions_map;\n\ diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7d4dca15608..479db7b5b99 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1042,6 +1042,8 @@ int MYSQLlex(void *arg, void *yythd) if (c == '.') lex->next_state=MY_LEX_IDENT_SEP; length= (uint) (lex->ptr - lex->tok_start)-1; + if (length == 0) + return(ABORT_SYM); // Names must be nonempty. if ((tokval= find_keyword(lex,length,0))) { yyUnget(); // Put back 'c' From 60f1320e1ba8e731ffb61bd9c7c26920aee144fc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Aug 2006 10:30:22 +0200 Subject: [PATCH 06/52] Move initializations of environment variables that are constant during the whole testrun to 'environment_setup' Split out functions that detects if we need master or slave restarts mysql-test/lib/mtr_process.pl: Fix spelling error mysql-test/mysql-test-run.pl: Move initializations of environment variables that are constant during the whole testrun to 'environment_setup' Split out functions 'run_testcase_need_master_restart' and 'run_testcase_need_slave_restart' --- mysql-test/lib/mtr_process.pl | 5 +- mysql-test/mysql-test-run.pl | 531 ++++++++++++++++++++-------------- 2 files changed, 311 insertions(+), 225 deletions(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index e47b0e4287c..a71a1e7d2e4 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -633,7 +633,7 @@ sub mtr_check_stop_servers ($) { } else { - mtr_verbose("All ports where free, continuing"); + mtr_verbose("All ports were free, continuing"); } } } @@ -896,6 +896,7 @@ sub check_expected_crash_and_restart($) sub mtr_record_dead_children () { + my $process_died= 0; my $ret_pid; # Wait without blockinng to see if any processes had died @@ -904,7 +905,9 @@ sub mtr_record_dead_children () { { mtr_warning("mtr_record_dead_children: $ret_pid"); mark_process_dead($ret_pid); + $process_died= 1; } + return $process_died; } sub start_reap_all { diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 5d6f39bc882..be1c72e9582 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -357,7 +357,7 @@ sub initialize_servers (); sub mysql_install_db (); sub install_db ($$); sub run_testcase ($); -sub run_testcase_stop_servers ($); +sub run_testcase_stop_servers ($$$); sub run_testcase_start_servers ($); sub report_failure_and_restart ($); sub do_before_start_master ($$); @@ -1296,9 +1296,19 @@ sub executable_setup () { } +sub generate_cmdline_mysqldump ($) { + my($mysqld) = @_; + return + "$exe_mysqldump --no-defaults -uroot " . + "--port=$mysqld->{'port'} " . + "--socket=$mysqld->{'path_sock'} --password="; +} + + ############################################################################## # -# Set environment to be used by childs of this process +# Set environment to be used by childs of this process for +# things that are constant duting the whole lifetime of mysql-test-run.pl # ############################################################################## @@ -1323,18 +1333,11 @@ sub environment_setup () { ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : ""); } - # -------------------------------------------------------------------------- - # Add the path where mysqld will find udf_example.so - # -------------------------------------------------------------------------- - $ENV{'LD_LIBRARY_PATH'}= - ($lib_udf_example ? dirname($lib_udf_example) : "") . - ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); - - # -------------------------------------------------------------------------- # Also command lines in .opt files may contain env vars # -------------------------------------------------------------------------- + $ENV{'CHARSETSDIR'}= $path_charsetsdir; $ENV{'UMASK'}= "0660"; # The octal *string* $ENV{'UMASK_DIR'}= "0770"; # The octal *string* $ENV{'LC_COLLATE'}= "C"; @@ -1352,10 +1355,30 @@ sub environment_setup () { # $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME $ENV{'MYSQL_TCP_PORT'}= 3306; - $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; - $ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave; - $ENV{'NDB_STATUS_OK'}= "YES"; + $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set + # ---------------------------------------------------- + # Setup env for NDB + # ---------------------------------------------------- + $ENV{'NDB_MGM'}= $exe_ndb_mgm; + + $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; + $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave; + + $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'}; + $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[0]->{'installed_ok'};; + $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; + + $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; + $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'}; + $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; + $ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log; + $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring; + + + # ---------------------------------------------------- + # Setup env for IM + # ---------------------------------------------------- $ENV{'IM_EXE'}= $exe_im; $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid}; @@ -1370,9 +1393,168 @@ sub environment_setup () { $ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port}; $ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid}; - $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set + # ---------------------------------------------------- + # Setup env so childs can execute mysqlcheck + # ---------------------------------------------------- + my $cmdline_mysqlcheck= + "$exe_mysqlcheck --no-defaults -uroot " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password="; + if ( $opt_debug ) + { + $cmdline_mysqlcheck .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace"; + } + $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; + + # ---------------------------------------------------- + # Setup env to childs can execute myqldump + # ---------------------------------------------------- + my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]); + my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]); + + if ( $opt_debug ) + { + $cmdline_mysqldump .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace"; + $cmdline_mysqldumpslave .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace"; + } + $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; + $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave; + + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlslap + # ---------------------------------------------------- + unless ( $glob_win32 ) + { + my $cmdline_mysqlslap= + "$exe_mysqlslap -uroot " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password= " . + "--lock-directory=$opt_tmpdir"; + + if ( $opt_debug ) + { + $cmdline_mysqlslap .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace"; + } + $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap; + } + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlimport + # ---------------------------------------------------- + my $cmdline_mysqlimport= + "$exe_mysqlimport -uroot " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password="; + + if ( $opt_debug ) + { + $cmdline_mysqlimport .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace"; + } + $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport; + + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlshow + # ---------------------------------------------------- + my $cmdline_mysqlshow= + "$exe_mysqlshow -uroot " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password="; + + if ( $opt_debug ) + { + $cmdline_mysqlshow .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace"; + } + $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlbinlog + # ---------------------------------------------------- + my $cmdline_mysqlbinlog= + "$exe_mysqlbinlog" . + " --no-defaults --local-load=$opt_tmpdir" . + " --character-sets-dir=$path_charsetsdir"; + + if ( $opt_debug ) + { + $cmdline_mysqlbinlog .= + " --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace"; + } + $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; + + # ---------------------------------------------------- + # Setup env so childs can execute mysql + # ---------------------------------------------------- + my $cmdline_mysql= + "$exe_mysql --no-defaults --host=localhost --user=root --password= " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'}"; + + $ENV{'MYSQL'}= $cmdline_mysql; + + # ---------------------------------------------------- + # Setup env so childs can execute mysql_client_test + # ---------------------------------------------------- + my $cmdline_mysql_client_test= + "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " . + "--port=$master->[0]->{'port'} " . + "--vardir=$opt_vardir " . + "--socket=$master->[0]->{'path_sock'}"; + + if ( $opt_debug ) + { + $cmdline_mysql_client_test .= + " --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace"; + } + + if ( $glob_use_embedded_server ) + { + $cmdline_mysql_client_test.= + " -A --language=$path_language" . + " -A --datadir=$slave->[0]->{'path_myddir'}" . + " -A --character-sets-dir=$path_charsetsdir"; + } + $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test; + + + # ---------------------------------------------------- + # Setup env so childs can execute mysql_fix_system_tables + # ---------------------------------------------------- + my $cmdline_mysql_fix_system_tables= + "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " . + "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'}"; + + $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; + + # ---------------------------------------------------- + # Setup env so childs can execute my_print_defaults + # ---------------------------------------------------- + $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults; + + # ---------------------------------------------------- + # Add the path where mysqld will find udf_example.so + # ---------------------------------------------------- + $ENV{'UDF_EXAMPLE_LIB'}= + ($lib_udf_example ? basename($lib_udf_example) : ""); + + $ENV{'LD_LIBRARY_PATH'}= + ($lib_udf_example ? dirname($lib_udf_example) : "") . + ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); + + + # ---------------------------------------------------- # We are nice and report a bit about our settings + # ---------------------------------------------------- if (!$opt_extern) { print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; @@ -2284,15 +2466,19 @@ sub run_testcase ($) { return; } - run_testcase_stop_servers($tinfo); + my $master_restart= run_testcase_need_master_restart($tinfo); + my $slave_restart= run_testcase_need_slave_restart($tinfo); + + if ($master_restart or $slave_restart) + { + run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); + } # ---------------------------------------------------------------------- # Prepare to start masters. Even if we use embedded, we want to run # the preparation. # ---------------------------------------------------------------------- - $ENV{'TZ'}= $tinfo->{'timezone'}; - mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); if ( $master->[1]->{'pid'} ) { @@ -2303,12 +2489,15 @@ sub run_testcase ($) { # If any mysqld servers running died, we have to know # ---------------------------------------------------------------------- - mtr_record_dead_children(); + my $died= mtr_record_dead_children(); # ---------------------------------------------------------------------- # Start masters needed by the testcase # ---------------------------------------------------------------------- - run_testcase_start_servers($tinfo); + if ($died or $master_restart or $slave_restart) + { + run_testcase_start_servers($tinfo); + } # ---------------------------------------------------------------------- # If --start-and-exit or --start-dirty given, stop here to let user manually @@ -2325,8 +2514,6 @@ sub run_testcase ($) { # Run the test case # ---------------------------------------------------------------------- - mtr_report_test_name($tinfo); - { # remove the old reject file if ( $opt_suite eq "main" ) @@ -2340,6 +2527,7 @@ sub run_testcase ($) { unlink($path_timefile); my $res= run_mysqltest($tinfo); + mtr_report_test_name($tinfo); if ( $res == 0 ) { mtr_report_test_passed($tinfo); @@ -2993,24 +3181,9 @@ sub stop_all_servers () { } -# ---------------------------------------------------------------------- -# If not using a running servers we may need to stop and restart. -# We restart in the case we have initiation scripts, server options -# etc to run. But we also restart again after the test first restart -# and test is run, to get back to normal server settings. -# -# To make the code a bit more clean, we actually only stop servers -# here, and mark this to be done. Then a generic "start" part will -# start up the needed servers again. -# ---------------------------------------------------------------------- - -sub run_testcase_stop_servers($) { - my $tinfo= shift; - - if ( $glob_use_running_server || $glob_use_embedded_server ) - { - return; - } +sub run_testcase_need_master_restart($) +{ + my ($tinfo)= @_; # We try to find out if we are to restart the master(s) my $do_restart= 0; # Assumes we don't have to @@ -3067,6 +3240,91 @@ sub run_testcase_stop_servers($) { join(" ", @{$master->[0]->{'start_opts'}}) . "'" ); } + return $do_restart; +} + +sub run_testcase_need_slave_restart($) +{ + my ($tinfo)= @_; + + # We try to find out if we are to restart the slaves + my $do_slave_restart= 0; # Assumes we don't have to + + # FIXME only restart slave when necessary + $do_slave_restart= 1; + +# if ( ! $slave->[0]->{'pid'} ) +# { +# # mtr_verbose("Slave not started, no need to check slave restart"); +# } +# elsif ( $do_restart ) +# { +# $do_slave_restart= 1; # Always restart if master restart +# mtr_verbose("Restart slave because: Master restart"); +# } +# elsif ( $tinfo->{'slave_sh'} ) +# { +# $do_slave_restart= 1; # Always restart if script to run +# mtr_verbose("Restart slave because: Always restart if script to run"); +# } +# elsif ( ! $opt_skip_ndbcluster_slave and +# $tinfo->{'ndb_test'} == 0 and +# $clusters->[1]->{'pid'} != 0 ) +# { +# $do_slave_restart= 1; # Restart without slave cluster +# mtr_verbose("Restart slave because: Test does not need slave cluster"); +# } +# elsif ( ! $opt_with_ndbcluster_slave and +# $tinfo->{'ndb_test'} == 1 and +# $clusters->[1]->{'pid'} == 0 ) +# { +# $do_slave_restart= 1; # Restart with slave cluster +# mtr_verbose("Restart slave because: Test need slave cluster"); +# } +# elsif ( $tinfo->{'slave_restart'} ) +# { +# $do_slave_restart= 1; +# mtr_verbose("Restart slave because: slave_restart"); +# } +# elsif ( $slave->[0]->{'running_slave_is_special'} ) +# { +# $do_slave_restart= 1; +# mtr_verbose("Restart slave because: running_slave_is_special"); +# } +# # Check that running slave was started with same options +# # as the current test requires +# elsif (! mtr_same_opts($slave->[0]->{'start_opts'}, +# $tinfo->{'slave_opt'}) ) +# { +# $do_slave_restart= 1; +# mtr_verbose("Restart slave because: running with different options '" . +# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" . +# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" ); +# } + + return $do_slave_restart; + +} + +# ---------------------------------------------------------------------- +# If not using a running servers we may need to stop and restart. +# We restart in the case we have initiation scripts, server options +# etc to run. But we also restart again after the test first restart +# and test is run, to get back to normal server settings. +# +# To make the code a bit more clean, we actually only stop servers +# here, and mark this to be done. Then a generic "start" part will +# start up the needed servers again. +# ---------------------------------------------------------------------- + +sub run_testcase_stop_servers($$$) { + my ($tinfo, $do_restart, $do_slave_restart)= @_; + + if ( $glob_use_running_server || $glob_use_embedded_server ) + { + return; + } + my $pid; my %admin_pids; # hash of admin processes that requests shutdown my @kill_pids; # list of processes to shutdown/kill @@ -3124,62 +3382,7 @@ sub run_testcase_stop_servers($) { } } - # We try to find out if we are to restart the slaves - my $do_slave_restart= 0; # Assumes we don't have to - - # FIXME only restaret when necessary - $do_slave_restart= 1; - -# if ( ! $slave->[0]->{'pid'} ) -# { -# # mtr_verbose("Slave not started, no need to check slave restart"); -# } -# elsif ( $do_restart ) -# { -# $do_slave_restart= 1; # Always restart if master restart -# mtr_verbose("Restart slave because: Master restart"); -# } -# elsif ( $tinfo->{'slave_sh'} ) -# { -# $do_slave_restart= 1; # Always restart if script to run -# mtr_verbose("Restart slave because: Always restart if script to run"); -# } -# elsif ( ! $opt_skip_ndbcluster_slave and -# $tinfo->{'ndb_test'} == 0 and -# $clusters->[1]->{'pid'} != 0 ) -# { -# $do_slave_restart= 1; # Restart without slave cluster -# mtr_verbose("Restart slave because: Test does not need slave cluster"); -# } -# elsif ( ! $opt_with_ndbcluster_slave and -# $tinfo->{'ndb_test'} == 1 and -# $clusters->[1]->{'pid'} == 0 ) -# { -# $do_slave_restart= 1; # Restart with slave cluster -# mtr_verbose("Restart slave because: Test need slave cluster"); -# } -# elsif ( $tinfo->{'slave_restart'} ) -# { -# $do_slave_restart= 1; -# mtr_verbose("Restart slave because: slave_restart"); -# } -# elsif ( $slave->[0]->{'running_slave_is_special'} ) -# { -# $do_slave_restart= 1; -# mtr_verbose("Restart slave because: running_slave_is_special"); -# } -# # Check that running slave was started with same options -# # as the current test requires -# elsif (! mtr_same_opts($slave->[0]->{'start_opts'}, -# $tinfo->{'slave_opt'}) ) -# { -# $do_slave_restart= 1; -# mtr_verbose("Restart slave because: running with different options '" . -# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" . -# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" ); -# } - - if ( $do_slave_restart ) + if ( $do_restart || $do_slave_restart ) { delete $slave->[0]->{'running_slave_is_special'}; # Forget history @@ -3627,135 +3830,9 @@ sub run_check_testcase ($$) { } -sub generate_cmdline_mysqldump ($) { - my($info) = @_; - return - "$exe_mysqldump --no-defaults -uroot " . - "--port=$info->[0]->{'port'} " . - "--socket=$info->[0]->{'path_sock'} --password="; -} sub run_mysqltest ($) { - my $tinfo= shift; - my $cmdline_mysqlcheck= "$exe_mysqlcheck --no-defaults -uroot " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password="; - if ( $opt_debug ) - { - $cmdline_mysqlcheck .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace"; - } - - my $cmdline_mysqldump= generate_cmdline_mysqldump $master; - my $cmdline_mysqldumpslave= generate_cmdline_mysqldump $slave; - - if ( $opt_debug ) - { - $cmdline_mysqldump .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace"; - $cmdline_mysqldumpslave .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace"; - } - - my $cmdline_mysqlslap; - - unless ( $glob_win32 ) - { - $cmdline_mysqlslap= "$exe_mysqlslap -uroot " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password= " . - "--lock-directory=$opt_tmpdir"; - if ( $opt_debug ) - { - $cmdline_mysqlslap .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace"; - } - } - - my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password="; - if ( $opt_debug ) - { - $cmdline_mysqlimport .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace"; - } - - my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password="; - if ( $opt_debug ) - { - $cmdline_mysqlshow .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace"; - } - - my $cmdline_mysqlbinlog= - "$exe_mysqlbinlog" . - " --no-defaults --local-load=$opt_tmpdir" . - " --character-sets-dir=$path_charsetsdir"; - - if ( $opt_debug ) - { - $cmdline_mysqlbinlog .= - " --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace"; - } - - my $cmdline_mysql= - "$exe_mysql --no-defaults --host=localhost --user=root --password= " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'}"; - - my $cmdline_mysql_client_test= - "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " . - "--port=$master->[0]->{'port'} " . - "--vardir=$opt_vardir " . - "--socket=$master->[0]->{'path_sock'}"; - - if ( $opt_debug ) - { - $cmdline_mysql_client_test .= - " --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace"; - } - - if ( $glob_use_embedded_server ) - { - $cmdline_mysql_client_test.= - " -A --language=$path_language" . - " -A --datadir=$slave->[0]->{'path_myddir'}" . - " -A --character-sets-dir=$path_charsetsdir"; - } - - my $cmdline_mysql_fix_system_tables= - "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " . - "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'}"; - - $ENV{'MYSQL'}= $cmdline_mysql; - $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; - $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; - $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap unless $glob_win32; - $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport; - $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave; - $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; - $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; - $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; - $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'}= $clusters->[0]->{'installed_ok'}; - $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[0]->{'installed_ok'};; - $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; - $ENV{'NDB_MGM'}= $exe_ndb_mgm; - $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; - $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'}; - $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; - $ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log; - $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring; + my ($tinfo)= @_; my $exe= $exe_mysqltest; my $args; @@ -3834,7 +3911,8 @@ sub run_mysqltest ($) { if ( $opt_debug ) { - mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace); + mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", + $opt_vardir_trace); } if ( $opt_ssl_supported ) @@ -3847,9 +3925,9 @@ sub run_mysqltest ($) { $glob_mysql_test_dir); } - # Turn on SSL for all test cases if ( $opt_ssl ) { + # Turn on SSL for _all_ test cases if option --ssl was used mtr_add_arg($args, "--ssl", $glob_mysql_test_dir); } @@ -3931,6 +4009,11 @@ sub run_mysqltest ($) { } } + # ------------------------------------------------------- + # Init variables that change for each testcase + # ------------------------------------------------------- + $ENV{'TZ'}= $tinfo->{'timezone'}; + my $res = mtr_run_test($exe,$args,"","",$path_timefile,""); if ( $opt_check_testcases ) From b67ff5b8f71ef42d2edfbae91997303ee8e20682 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Aug 2006 13:47:01 +0200 Subject: [PATCH 07/52] Fix indentation --- mysql-test/mysql-test-run.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 890ac3fe407..afac82a2213 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2557,7 +2557,8 @@ sub run_testcase ($) { # 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) "; + $tinfo->{'comment'}= + defined $reason ? $reason : "Detected by testcase(reason unknown) "; mtr_report_test_skipped($tinfo); } elsif ( $res == 63 ) From 5297d9c1d7419673f3cdaebcc62ced61925e31a1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Aug 2006 23:45:01 +0200 Subject: [PATCH 08/52] manual merge --- mysql-test/r/partition.result | 8 ++++---- mysql-test/r/partition_mgm.result | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index e95489864f7..25dc4295d87 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1083,12 +1083,12 @@ partition by range (a) subpartition by hash (a) (partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx' (SUBPARTITION subpart00, SUBPARTITION subpart01)); +hello/master-data/test/t1.frm +hello/master-data/test/t1.par hello/master-data/test/t1#P#p0#SP#subpart00.MYD hello/master-data/test/t1#P#p0#SP#subpart00.MYI hello/master-data/test/t1#P#p0#SP#subpart01.MYD hello/master-data/test/t1#P#p0#SP#subpart01.MYI -hello/master-data/test/t1.frm -hello/master-data/test/t1.par hello/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD hello/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD hello/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI @@ -1098,6 +1098,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (SUBPARTITION subpart10, SUBPARTITION subpart11), partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx' (SUBPARTITION subpart20, SUBPARTITION subpart21)); +hello/master-data/test/t1.frm +hello/master-data/test/t1.par hello/master-data/test/t1#P#p1#SP#subpart10.MYD hello/master-data/test/t1#P#p1#SP#subpart10.MYI hello/master-data/test/t1#P#p1#SP#subpart11.MYD @@ -1106,8 +1108,6 @@ hello/master-data/test/t1#P#p2#SP#subpart20.MYD hello/master-data/test/t1#P#p2#SP#subpart20.MYI hello/master-data/test/t1#P#p2#SP#subpart21.MYD hello/master-data/test/t1#P#p2#SP#subpart21.MYI -hello/master-data/test/t1.frm -hello/master-data/test/t1.par hello/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD hello/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD hello/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result index f64ffaff495..5ee12259312 100644 --- a/mysql-test/r/partition_mgm.result +++ b/mysql-test/r/partition_mgm.result @@ -7,12 +7,12 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2 */ +hello/master-data/test/t1.frm +hello/master-data/test/t1.par hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1#P#p1.MYD hello/master-data/test/t1#P#p1.MYI -hello/master-data/test/t1.frm -hello/master-data/test/t1.par ALTER TABLE t1 COALESCE PARTITION 1; SHOW CREATE TABLE t1; Table Create Table @@ -20,10 +20,10 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1 */ -hello/master-data/test/t1#P#p0.MYD -hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1.frm hello/master-data/test/t1.par +hello/master-data/test/t1#P#p0.MYD +hello/master-data/test/t1#P#p0.MYI drop table t1; create table t1 (a int) partition by list (a) From 358e684e608b2d8a1506e77bdbe17e965412bddc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Aug 2006 16:01:33 +0200 Subject: [PATCH 09/52] temporarily disabled partition test, fails w/ PS protocol, filed as Bug#21658 --- mysql-test/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 359092b43b3..efbe1f5b32d 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -45,3 +45,4 @@ rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson crash_commit_before : 2006-08-02 msvensson rpl_ndb_dd_advance : BUG#18679 2006-07-28 jimw (Test fails randomly) federated_transactions : Need to be re-enabled once Patrick's merge is complete +partition : BUG#21658 2006-08-17 azundris fails w/ --ps-protocol From 8d8fa0e312bd5e0fcb807fd757414d7d9eb4db32 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Aug 2006 14:09:24 -0700 Subject: [PATCH 10/52] Bug #21288: mysqldump segmentation fault when using --where The problem was that the error handling was using a too-small buffer to print the error message generated. We fix this by not using a buffer at all, but by using fprintf() directly. There were also some problems with the error handling in table dumping that was exposed by this fix that were also corrected. client/mysqldump.c: Use fprintf() instead of my_printf_error() to avoid buffer overflow issues. Since ME_BELL wasn't specified, calling my_printf_error() offered no advantage except for adding my_progname, which we just go ahead and do manually. Also, fix the error handling in dumpTable() when queries to get data fail and --force was specified. mysql-test/r/mysqldump.result: Add new results mysql-test/t/mysqldump.test: Add new regression test --- client/mysqldump.c | 16 +++++++++++----- mysql-test/r/mysqldump.result | 27 +++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 8 ++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 58e51b9b955..7f495ccdafb 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -783,8 +783,8 @@ static int get_options(int *argc, char ***argv) static void DBerror(MYSQL *mysql, const char *when) { DBUG_ENTER("DBerror"); - my_printf_error(0,"Got error: %d: %s %s", MYF(0), - mysql_errno(mysql), mysql_error(mysql), when); + fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname, + mysql_errno(mysql), mysql_error(mysql), when); safe_exit(EX_MYSQLERR); DBUG_VOID_RETURN; } /* DBerror */ @@ -811,9 +811,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, if (mysql_query(mysql_con, query) || (res && !((*res)= mysql_store_result(mysql_con)))) { - my_printf_error(0, "%s: Couldn't execute '%s': %s (%d)", - MYF(0), my_progname, query, - mysql_error(mysql_con), mysql_errno(mysql_con)); + fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n", + my_progname, query, + mysql_error(mysql_con), mysql_errno(mysql_con)); return 1; } return 0; @@ -1705,13 +1705,19 @@ static void dumpTable(uint numFields, char *table) check_io(md_result_file); } if (mysql_query_with_error_report(sock, 0, query)) + { DBerror(sock, "when retrieving data from server"); + goto err; + } if (quick) res=mysql_use_result(sock); else res=mysql_store_result(sock); if (!res) + { DBerror(sock, "when retrieving data from server"); + goto err; + } if (verbose) fprintf(stderr, "-- Retrieving rows...\n"); if (mysql_num_fields(res) != numFields) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 6c5c757061d..721982e11e3 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1557,4 +1557,31 @@ CREATE TABLE `t2` ( /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1, t2, t3; +create table t1 (a int); +mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) +mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; End of 4.1 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index e86635e24d0..b0df2bb9db2 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -694,4 +694,12 @@ create table t3(a int); --exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 drop table t1, t2, t3; +# +# Bug #21288: mysqldump segmentation fault when using --where +# +create table t1 (a int); +--error 2 +--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 +drop table t1; + --echo End of 4.1 tests From f177075e03d49ae60a1211ab7fb34466dee5e5bd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Aug 2006 19:29:54 +0200 Subject: [PATCH 11/52] 17926 duplicates Bug#1989 in bug db on up-merging 17926 from 5.0 tree it collides with near-identical fix 1989 in 5.1 tree. backing 17926 out of 5.1 tree. client/mysql.cc: Bug#17926 duplicates Bug#1989 in bug db back 17926 out of 5.1 tree --- client/mysql.cc | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 3872968ca3f..2f1efc3b02a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff); static void mysql_end_timer(ulong start_time,char *buff); static void nice_time(double sec,char *buff,bool part_second); static sig_handler mysql_end(int sig); -static sig_handler mysql_sigint(int sig); +static sig_handler handle_sigint(int sig); int main(int argc,char *argv[]) { @@ -421,7 +421,6 @@ int main(int argc,char *argv[]) signal(SIGINT, SIG_IGN); else signal(SIGINT, handle_sigint); // Catch SIGINT to clean up - signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up /* @@ -489,28 +488,6 @@ int main(int argc,char *argv[]) #endif } -sig_handler mysql_sigint(int sig) -{ - char kill_buffer[40]; - MYSQL *kill_mysql= NULL; - - signal(SIGINT, mysql_sigint); - - /* terminate if no query being executed, or we already tried interrupting */ - if (!executing_query || interrupted_query++) - mysql_end(sig); - - kill_mysql= mysql_init(kill_mysql); - if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password, - "", opt_mysql_port, opt_mysql_unix_port,0)) - mysql_end(sig); - /* kill_buffer is always big enough because max length of %lu is 15 */ - sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); - mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer)); - mysql_close(kill_mysql); - tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); -} - sig_handler mysql_end(int sig) { mysql_close(&mysql); @@ -1058,8 +1035,6 @@ static int read_and_execute(bool interactive) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); - interrupted_query= 0; - #if defined( __WIN__) || defined(__NETWARE__) tee_fputs(prompt, stdout); #if defined(__NETWARE__) @@ -2041,9 +2016,7 @@ com_go(String *buffer,char *line __attribute__((unused))) } timer=start_timer(); - executing_query= 1; - error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length()); #ifdef HAVE_READLINE @@ -2059,7 +2032,6 @@ com_go(String *buffer,char *line __attribute__((unused))) { executing_query= 0; buffer->length(0); // Remove query on error - executing_query= 0; return error; } error=0; @@ -2143,9 +2115,6 @@ com_go(String *buffer,char *line __attribute__((unused))) fflush(stdout); mysql_free_result(result); } while (!(err= mysql_next_result(&mysql))); - - executing_query= 0; - if (err >= 1) error= put_error(&mysql); From ae705221dd91c390e917fdf590932ac59b521ea4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 20 Aug 2006 20:46:50 +0200 Subject: [PATCH 12/52] Move the initialisation of "NDB_STATUS_OK" env variable to after cluster has been intalled --- mysql-test/mysql-test-run.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 9907bb3a181..af59c39cda7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1392,8 +1392,6 @@ sub environment_setup () { $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave; - $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'}; - $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[0]->{'installed_ok'};; $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; @@ -2260,6 +2258,9 @@ sub mysql_install_db () { } } + $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'}; + $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[1]->{'installed_ok'};; + if ( ! $cluster_started_ok ) { if ( $opt_force) From b6707f8c7f39878c86347acff495337eb9bdef22 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 09:53:04 +0200 Subject: [PATCH 13/52] Break out and create new function 'run_testcase_check_skip_test' --- mysql-test/mysql-test-run.pl | 73 +++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index af59c39cda7..507258c5d65 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -360,6 +360,7 @@ sub install_db ($$); sub run_testcase ($); sub run_testcase_stop_servers ($$$); sub run_testcase_start_servers ($); +sub run_testcase_check_skip_test($); sub report_failure_and_restart ($); sub do_before_start_master ($$); sub do_before_start_slave ($$); @@ -2156,6 +2157,8 @@ sub run_suite () { foreach my $tinfo ( @$tests ) { + next if run_testcase_check_skip_test($tinfo); + mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout); run_testcase($tinfo); mtr_timer_stop($glob_timers,"testcase"); @@ -2440,6 +2443,45 @@ sub im_prepare_data_dir($) { } } +sub run_testcase_check_skip_test($) +{ + my ($tinfo)= @_; + + # ---------------------------------------------------------------------- + # If marked to skip, just print out and return. + # Note that a test case not marked as 'skip' can still be + # skipped later, because of the test case itself in cooperation + # with the mysqltest program tells us so. + # ---------------------------------------------------------------------- + + if ( $tinfo->{'skip'} ) + { + mtr_report_test_name($tinfo); + mtr_report_test_skipped($tinfo); + return 1; + } + + # If test needs cluster, check that master installed ok + if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" ) + { + mtr_report_test_name($tinfo); + mtr_report_test_failed($tinfo); + return 1; + } + + # If test needs slave cluster, check that it installed ok + if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and + $clusters->[1]->{'installed_ok'} eq "NO" ) + { + mtr_report_test_name($tinfo); + mtr_report_test_failed($tinfo); + return 1; + } + + return 0; +} + + ############################################################################## # @@ -2467,37 +2509,6 @@ sub run_testcase ($) { # output current test to ndbcluster log file to enable diagnostics mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); - # ---------------------------------------------------------------------- - # If marked to skip, just print out and return. - # Note that a test case not marked as 'skip' can still be - # skipped later, because of the test case itself in cooperation - # with the mysqltest program tells us so. - # ---------------------------------------------------------------------- - - if ( $tinfo->{'skip'} ) - { - mtr_report_test_name($tinfo); - mtr_report_test_skipped($tinfo); - return; - } - - # If test needs cluster, check that master installed ok - if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" ) - { - mtr_report_test_name($tinfo); - mtr_report_test_failed($tinfo); - return; - } - - # If test needs slave cluster, check that it installed ok - if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and - $clusters->[1]->{'installed_ok'} eq "NO" ) - { - mtr_report_test_name($tinfo); - mtr_report_test_failed($tinfo); - return; - } - my $master_restart= run_testcase_need_master_restart($tinfo); my $slave_restart= run_testcase_need_slave_restart($tinfo); From f76c1536008bee12a46eb6fb65c3065936181240 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 09:53:49 +0200 Subject: [PATCH 14/52] Turn on reorder by default --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 507258c5d65..26f9bcda889 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -216,7 +216,7 @@ our $opt_embedded_server; our $opt_extern; our $opt_fast; our $opt_force; -our $opt_reorder; +our $opt_reorder= 1; our $opt_enable_disabled; our $opt_gcov; From 7fd770423a3b5c4fcfa62209235901de78d123c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 14:51:59 +0200 Subject: [PATCH 15/52] Bug#19810 Bundled YASSL in libmysqlclient conflicts with OpenSSL - Rename yaSSL version of 'SSL_peek' to 'yaSSL_peek' by using a macro extra/yassl/include/openssl/prefix_ssl.h: Rename yaSSL version of SSL_peek to yaSSL_peek --- extra/yassl/include/openssl/prefix_ssl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h index 7f815156f47..0d740b6b97e 100644 --- a/extra/yassl/include/openssl/prefix_ssl.h +++ b/extra/yassl/include/openssl/prefix_ssl.h @@ -150,3 +150,4 @@ #define MD5_Init yaMD5_Init #define MD5_Update yaMD5_Update #define MD5_Final yaMD5_Final +#define SSL_peek yaSSL_peek From 3d847396a29cd5c31820700d36f70e52961e1c37 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Aug 2006 08:30:33 +0200 Subject: [PATCH 16/52] Remove debug printout from mysql_client_test tests/mysql_client_test.c: Remove debug printout --- tests/mysql_client_test.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 88c1a5737d3..f8c091e37f7 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14975,8 +14975,6 @@ static void test_bug17667() DIE("Read error"); } } - /* Print the line */ - printf("%s", line_buffer); } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2, statement_cursor->buffer, statement_cursor->length) == NULL); From c9327bd970e1c21ec160ec4cba8f3cc843ce8246 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Aug 2006 11:48:58 +0200 Subject: [PATCH 17/52] mysql.spec.sh: Added ndb_size.{pl,tmpl} to the RPM install (bug#20426) support-files/mysql.spec.sh: Added ndb_size.{pl,tmpl} to the RPM install (bug#20426) --- support-files/mysql.spec.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 454ec522f0e..befd9f48fed 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -647,6 +647,8 @@ fi %attr(755, root, root) %{_bindir}/ndb_show_tables %attr(755, root, root) %{_bindir}/ndb_test_platform %attr(755, root, root) %{_bindir}/ndb_config +%attr(755, root, root) %{_bindir}/ndb_size.pl +%attr(-, root, root) %{_datadir}/mysql/ndb_size.tmpl %files ndb-extra %defattr(-,root,root,0755) From 446bb66928f65171d8ded894dbc71dfa48a1d4dd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Aug 2006 11:55:08 +0200 Subject: [PATCH 18/52] mysql.spec.sh: Added ndb_error_reporter to the RPM install (bug#20426) support-files/mysql.spec.sh: Added ndb_error_reporter to the RPM install (bug#20426) --- support-files/mysql.spec.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 89cf998f8fd..f5db4e8ae18 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -675,6 +675,7 @@ fi %attr(755, root, root) %{_bindir}/ndb_show_tables %attr(755, root, root) %{_bindir}/ndb_test_platform %attr(755, root, root) %{_bindir}/ndb_config +%attr(755, root, root) %{_bindir}/ndb_error_reporter %attr(755, root, root) %{_bindir}/ndb_size.pl %attr(-, root, root) %{_datadir}/mysql/ndb_size.tmpl From c3867a251b4881f5a04ee76b67a8771041bdf024 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 15:35:24 +0200 Subject: [PATCH 19/52] Break out functions do_before_run_mysqltest and do_after_run_mysqltest --- mysql-test/mysql-test-run.pl | 94 ++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 26f9bcda889..6865cd55398 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2157,7 +2157,10 @@ sub run_suite () { foreach my $tinfo ( @$tests ) { - next if run_testcase_check_skip_test($tinfo); + if (run_testcase_check_skip_test($tinfo)) + { + next; + } mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout); run_testcase($tinfo); @@ -2482,6 +2485,47 @@ sub run_testcase_check_skip_test($) } +sub do_before_run_mysqltest($) +{ + my $tinfo= shift; + my $tname= $tinfo->{'name'}; + + # Remove old reject file + if ( $opt_suite eq "main" ) + { + unlink("r/$tname.reject"); + } + else + { + unlink("suite/$opt_suite/r/$tname.reject"); + } + + +# MASV cleanup... + 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"); + + mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); + if ( $master->[1]->{'pid'} ) + { + mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); + } +} + +sub do_after_run_mysqltest($) +{ + my $tinfo= shift; + my $tname= $tinfo->{'name'}; + + #MASV cleanup + # Save info from this testcase run to mysqltest.log + my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile; + mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); + mtr_tofile($path_mysqltest_log, $testcase_log); + } + ############################################################################## # @@ -2502,13 +2546,6 @@ sub run_testcase_check_skip_test($) sub run_testcase ($) { my $tinfo= shift; - my $tname= $tinfo->{'name'}; - - 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"); - my $master_restart= run_testcase_need_master_restart($tinfo); my $slave_restart= run_testcase_need_slave_restart($tinfo); @@ -2517,26 +2554,7 @@ sub run_testcase ($) { run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); } - # ---------------------------------------------------------------------- - # Prepare to start masters. Even if we use embedded, we want to run - # the preparation. - # ---------------------------------------------------------------------- - - mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - if ( $master->[1]->{'pid'} ) - { - mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - } - - # ---------------------------------------------------------------------- - # If any mysqld servers running died, we have to know - # ---------------------------------------------------------------------- - my $died= mtr_record_dead_children(); - - # ---------------------------------------------------------------------- - # Start masters needed by the testcase - # ---------------------------------------------------------------------- if ($died or $master_restart or $slave_restart) { run_testcase_start_servers($tinfo); @@ -2546,28 +2564,14 @@ sub run_testcase ($) { # If --start-and-exit or --start-dirty given, stop here to let user manually # run tests # ---------------------------------------------------------------------- - if ( $opt_start_and_exit or $opt_start_dirty ) { mtr_report("\nServers started, exiting"); exit(0); } - # ---------------------------------------------------------------------- - # Run the test case - # ---------------------------------------------------------------------- - { - # remove the old reject file - if ( $opt_suite eq "main" ) - { - unlink("r/$tname.reject"); - } - else - { - unlink("suite/$opt_suite/r/$tname.reject"); - } - unlink($path_timefile); + do_before_run_mysqltest($tinfo); my $res= run_mysqltest($tinfo); mtr_report_test_name($tinfo); @@ -2603,10 +2607,8 @@ sub run_testcase ($) { report_failure_and_restart($tinfo); } - # Save info from this testcase run to mysqltest.log - my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile; - mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); - mtr_tofile($path_mysqltest_log, $testcase_log); + + do_after_run_mysqltest($tinfo); } # ---------------------------------------------------------------------- From 97fb42a06e7ca419bb4b3ce5ab725afa26516f3b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 15:41:52 +0200 Subject: [PATCH 20/52] Fix VC 2005 compile problem sql/handler.cc: Cast to "byte*" on both sides of equal sign Fix spelling error --- sql/handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/handler.cc b/sql/handler.cc index d67acf69d14..c92f7dcb16d 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3513,10 +3513,10 @@ int handler::ha_external_lock(THD *thd, int lock_type) int handler::ha_reset() { DBUG_ENTER("ha_reset"); - /* Check that we have called all proper delallocation functions */ + /* Check that we have called all proper deallocation functions */ DBUG_ASSERT((byte*) table->def_read_set.bitmap + table->s->column_bitmap_size == - (char*) table->def_write_set.bitmap); + (byte*) table->def_write_set.bitmap); DBUG_ASSERT(bitmap_is_set_all(&table->s->all_set)); DBUG_ASSERT(table->key_read == 0); /* ensure that ha_index_end / ha_rnd_end has been called */ From f9832bf116b2525afa79267cfea6cd8360e418f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 19:14:58 +0200 Subject: [PATCH 21/52] Bug #20908: Crash if select @@"" Zero-length variables caused failures when using the length to look up the name in a hash. Instead, signal that no zero-length name can ever be found and that to encounter one is a syntax error. mysql-test/r/variables.result: Results for test. mysql-test/t/variables.test: Insert tests to prove that zero-length variable names do not cause faults. sql/gen_lex_hash.cc: If the length is zero, then there is nothing to look-up in the hash. sql/sql_lex.cc: Names of variables must not be empty. Signal an error of that happens. --- mysql-test/r/variables.result | 6 ++++++ mysql-test/t/variables.test | 11 +++++++++++ sql/gen_lex_hash.cc | 11 +++++++++-- sql/sql_lex.cc | 2 ++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index a0e516d2397..cd834a789bd 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes; show variables like 'log_queries_not_using_indexes'; Variable_name Value log_queries_not_using_indexes OFF +select @@""; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1 +select @@&; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1 +select @@@; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1 End of 5.0 tests set global binlog_cache_size =@my_binlog_cache_size; set global connect_timeout =@my_connect_timeout; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 68efcafd1e0..d855b4d8266 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -585,6 +585,16 @@ show variables like 'ssl%'; select @@log_queries_not_using_indexes; show variables like 'log_queries_not_using_indexes'; +# +# Bug#20908: Crash if select @@"" +# +--error ER_PARSE_ERROR +select @@""; +--error ER_PARSE_ERROR +select @@&; +--error ER_PARSE_ERROR +select @@@; + --echo End of 5.0 tests # This is at the very after the versioned tests, since it involves doing @@ -620,3 +630,4 @@ set global server_id =@my_server_id; set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; + diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7e0b178f7af..89af0d30076 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -447,8 +447,9 @@ int main(int argc,char **argv) and you are welcome to modify and redistribute it under the GPL license\n\ \n*/\n\n"); - printf("/* This code is generated by gen_lex_hash.cc that seeks for\ - a perfect\nhash function */\n\n"); + /* Broken up to indicate that it's not advice to you, gentle reader. */ + printf("/* Do " "not " "edit " "this " "file! This is generated by " + "gen_lex_hash.cc\nthat seeks for a perfect hash function */\n\n"); printf("#include \"lex.h\"\n\n"); calc_length(); @@ -468,6 +469,12 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\ {\n\ register uchar *hash_map;\n\ register const char *cur_str= s;\n\ +\n\ + if (len == 0) {\n\ + DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\ + return(NULL);\n\ + }\ +\n\ if (function){\n\ if (len>sql_functions_max_len) return 0;\n\ hash_map= sql_functions_map;\n\ diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7d4dca15608..479db7b5b99 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1042,6 +1042,8 @@ int MYSQLlex(void *arg, void *yythd) if (c == '.') lex->next_state=MY_LEX_IDENT_SEP; length= (uint) (lex->ptr - lex->tok_start)-1; + if (length == 0) + return(ABORT_SYM); // Names must be nonempty. if ((tokval= find_keyword(lex,length,0))) { yyUnget(); // Put back 'c' From 216f20ad0067a2f3f8349cff3f10355f7ea7677e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 15:37:54 -0600 Subject: [PATCH 22/52] Bug #20402: DROP USER failure logged as ERROR rather than WARNING Remove some sql_print_error() calls which were triggered by user error (i.e., not server-level events at all). Also, convert an sql_print_error -> sql_print_information for a non-error server event. sql/slave.cc: Change sql_print_error to sql_print_information for non-error status message. sql/sql_acl.cc: Remove sql_print_error calls for events which are not server errors --- sql/slave.cc | 2 +- sql/sql_acl.cc | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index b2862a437bb..bceeca1055c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2946,7 +2946,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) rli->is_until_satisfied()) { char buf[22]; - sql_print_error("Slave SQL thread stopped because it reached its" + sql_print_information("Slave SQL thread stopped because it reached its" " UNTIL position %s", llstr(rli->until_pos(), buf)); /* Setting abort_slave flag because we do not want additional message about diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 204a38dfb64..5b3e2619d21 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3669,17 +3669,11 @@ int mysql_drop_user(THD *thd, List &list) { if (!(acl_user= check_acl_user(user_name, &counter))) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; No such user", - user_name->user.str, - user_name->host.str); result= -1; continue; } if ((acl_user->access & ~0)) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Global privileges exists", - user_name->user.str, - user_name->host.str); result= -1; continue; } @@ -3700,9 +3694,6 @@ int mysql_drop_user(THD *thd, List &list) } if (counter != acl_dbs.elements) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Database privileges exists", - user_name->user.str, - user_name->host.str); result= -1; continue; } @@ -3723,9 +3714,6 @@ int mysql_drop_user(THD *thd, List &list) } if (counter != column_priv_hash.records) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Table privileges exists", - user_name->user.str, - user_name->host.str); result= -1; continue; } @@ -3791,9 +3779,6 @@ int mysql_revoke_all(THD *thd, List &list) { if (!check_acl_user(lex_user, &counter)) { - sql_print_error("REVOKE ALL PRIVILEGES, GRANT: User '%s'@'%s' not exists", - lex_user->user.str, - lex_user->host.str); result= -1; continue; } From 336250e60d57c9eba11ce141f3dc02f5e916ec50 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 18:29:05 -0400 Subject: [PATCH 23/52] String broken up to avoid silly MICROS~1 string-size limit. BitKeeper/etc/ignore: Added sql/f.c to the ignore list --- .bzrignore | 1 + sql/gen_lex_hash.cc | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.bzrignore b/.bzrignore index 68e8120fae0..68365ad40c2 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1296,3 +1296,4 @@ vio/viotest-sslconnect.cpp vio/viotest.cpp zlib/*.ds? zlib/*.vcproj +sql/f.c diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 89af0d30076..1a7710dba0d 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -473,8 +473,10 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\ if (len == 0) {\n\ DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\ return(NULL);\n\ - }\ -\n\ + }\n" +); + + printf("\ if (function){\n\ if (len>sql_functions_max_len) return 0;\n\ hash_map= sql_functions_map;\n\ @@ -505,7 +507,10 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\ cur_struct= uint4korr(hash_map+\n\ (((uint16)cur_struct + cur_char - first_char)*4));\n\ cur_str++;\n\ - }\n\ + }\n" +); + + printf("\ }else{\n\ if (len>symbols_max_len) return 0;\n\ hash_map= symbols_map;\n\ From b2a0d025e3f3dc2a8e9ab83634f542d50c4f99a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 18:02:31 -0600 Subject: [PATCH 24/52] Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets - Fix typo in Item_func_export_set::fix_length_and_dec() which caused character set aggregation to fail - Remove default argument from last arg of agg_arg_charsets() function, to reduce potential errors mysql-test/r/func_misc.result: Test EXPORT_SET() with charset coersion (bug #21531) mysql-test/t/func_misc.test: Test EXPORT_SET() with charset coersion (bug #21531) sql/item_func.h: Remove default argument from last arg of agg_arg_charsets() function, to reduce potential errors. sql/item_strfunc.cc: Fix typo in Item_func_export_set::fix_length_and_dec() which caused character set aggregation to fail. --- mysql-test/r/func_misc.result | 4 ++++ mysql-test/t/func_misc.test | 7 ++++++- sql/item_func.h | 3 +-- sql/item_strfunc.cc | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 8bcdd8b7cbc..adf2035173f 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -93,3 +93,7 @@ SELECT IS_USED_LOCK('bug16501'); IS_USED_LOCK('bug16501') NULL DROP TABLE t1; +select export_set(3, _latin1'foo', _utf8'bar', ',', 4); +export_set(3, _latin1'foo', _utf8'bar', ',', 4) +foo,foo,bar,bar +End of 4.1 tests diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index e2641f8d6cd..a7dc9e7c966 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -83,4 +83,9 @@ connection default; DROP TABLE t1; -# End of 4.1 tests +# +# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets +# +select export_set(3, _latin1'foo', _utf8'bar', ',', 4); + +--echo End of 4.1 tests diff --git a/sql/item_func.h b/sql/item_func.h index 51f9d3fb36f..aaf74e4f7af 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -156,8 +156,7 @@ public: return agg_item_collations_for_comparison(c, func_name(), items, nitems, flags); } - bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, - uint flags= 0) + bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, uint flags) { return agg_item_charsets(c, func_name(), items, nitems, flags); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 56a31d074ac..a43f8b5a22a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2624,8 +2624,8 @@ void Item_func_export_set::fix_length_and_dec() uint sep_length=(arg_count > 3 ? args[3]->max_length : 1); max_length=length*64+sep_length*63; - if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1), - MY_COLL_ALLOW_CONV) + if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1, + MY_COLL_ALLOW_CONV)) return; } From 91bdf2952d0f78a514d03235754ee54813f9ae6c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Aug 2006 11:39:52 +0200 Subject: [PATCH 25/52] Cset exclude: msvensson@neptunus.(none)|ChangeSet|20060612110740|13873 configure.in: Exclude dbug/dbug.c: Exclude --- configure.in | 15 ++++++--------- dbug/dbug.c | 5 +---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/configure.in b/configure.in index 3430bd8a5b5..b49dffcb59f 100644 --- a/configure.in +++ b/configure.in @@ -1655,20 +1655,17 @@ AC_ARG_WITH(debug, if test "$with_debug" = "yes" then # Medium debug. - AC_DEFINE([DBUG_ON], [1], [Use libdbug]) - CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS" + CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS" + CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS" elif test "$with_debug" = "full" then # Full debug. Very slow in some cases - AC_DEFINE([DBUG_ON], [1], [Use libdbug]) - CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" + CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" + CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" else # Optimized version. No debug - AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) - CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS" - CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS" + CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS" + CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS" fi # Force static compilation to avoid linking problems/get more speed diff --git a/dbug/dbug.c b/dbug/dbug.c index 575481305e7..c991daf3617 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -66,13 +66,10 @@ * Check of malloc on entry/exit (option "S") */ -#include - -/* This file won't compile unless DBUG_OFF is undefined locally */ #ifdef DBUG_OFF #undef DBUG_OFF #endif - +#include #include #include #if defined(MSDOS) || defined(__WIN__) From 78eb30e89d967830b61d3a17d45ac646be33d33a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Aug 2006 14:27:57 +0200 Subject: [PATCH 26/52] Bug#20841 mysqldump fails to store right info with --compatible=mysql40 option - Add "not in version before" commensta around new syntax "WITH PARSER" and "TABLESPACE xxx STORAGE DISK" mysql-test/r/ndb_dd_advance.result: Update result file mysql-test/r/ndb_dd_advance2.result: Update result file mysql-test/r/ndb_dd_backuprestore.result: Update result file mysql-test/r/ndb_dd_basic.result: Update result file mysql-test/r/ndb_dd_disk2memory.result: Update result file sql/sql_show.cc: Add "not in version before" comments around "WITH PARSER xxx" and "TABLESPACE xxx STORAGE DISK" Use STRING_WITH_LEN when adding fixed string AUTO_INCREMENT= to output from SHOW TABLE --- mysql-test/r/ndb_dd_advance.result | 14 +++++++------- mysql-test/r/ndb_dd_advance2.result | 8 ++++---- mysql-test/r/ndb_dd_backuprestore.result | 12 ++++++------ mysql-test/r/ndb_dd_basic.result | 2 +- mysql-test/r/ndb_dd_disk2memory.result | 4 ++-- sql/sql_show.cc | 9 +++++---- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/ndb_dd_advance.result b/mysql-test/r/ndb_dd_advance.result index 09fe75805d5..64c30aab9ab 100644 --- a/mysql-test/r/ndb_dd_advance.result +++ b/mysql-test/r/ndb_dd_advance.result @@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`pk1`) -) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; SHOW CREATE TABLE test.t2; @@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` ( `b2` int(11) NOT NULL, `c2` int(11) NOT NULL, PRIMARY KEY (`pk2`) -) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t1 ENGINE=NDBCLUSTER; SHOW CREATE TABLE test.t1; Table Create Table @@ -331,7 +331,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) -) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -931,7 +931,7 @@ t1 CREATE TABLE `t1` ( `a1` int(11) DEFAULT NULL, `a2` blob, `a3` text -) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 DROP TABLE test.t1; CREATE TABLE test.t1 (a1 INT, a2 BLOB, a3 TEXT) ENGINE=MyISAM; SHOW CREATE TABLE test.t1; @@ -950,7 +950,7 @@ t1 CREATE TABLE `t1` ( `a1` int(11) DEFAULT NULL, `a2` blob, `a3` text -) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 DROP TABLE test.t1; CREATE TABLE test.t1 (a1 INT PRIMARY KEY, a2 BLOB, a3 TEXT) TABLESPACE ts STORAGE DISK ENGINE=NDB; SHOW CREATE TABLE test.t1; @@ -960,7 +960,7 @@ t1 CREATE TABLE `t1` ( `a2` blob, `a3` text, PRIMARY KEY (`a1`) -) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t1 ENGINE=InnoDB; SHOW CREATE TABLE test.t1; Table Create Table @@ -980,7 +980,7 @@ t1 CREATE TABLE `t1` ( `a1` int(11) DEFAULT NULL, `a2` blob, `a3` text -) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t1 ENGINE=MyISAM; SHOW CREATE TABLE test.t1; Table Create Table diff --git a/mysql-test/r/ndb_dd_advance2.result b/mysql-test/r/ndb_dd_advance2.result index c7fcda650e6..86dc8df3b15 100644 --- a/mysql-test/r/ndb_dd_advance2.result +++ b/mysql-test/r/ndb_dd_advance2.result @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( `a2` varchar(256) DEFAULT NULL, `a3` blob, PRIMARY KEY (`a1`) -) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 SHOW CREATE TABLE test.t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -38,7 +38,7 @@ t2 CREATE TABLE `t2` ( `a2` varchar(256) DEFAULT NULL, `a3` blob, PRIMARY KEY (`a1`) -) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa'); INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb'); SELECT * FROM test.t1 ORDER BY a1; @@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` ( `a2` varchar(5000) DEFAULT NULL, `a3` blob, PRIMARY KEY (`a1`) -) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 SHOW CREATE TABLE test.t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -101,7 +101,7 @@ t2 CREATE TABLE `t2` ( `a2` varchar(5000) DEFAULT NULL, `a3` blob, PRIMARY KEY (`a1`) -) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 INSERT INTO test.t1 VALUES (1,@vc1,@d1); INSERT INTO test.t1 VALUES (2,@vc2,@b1); INSERT INTO test.t1 VALUES (3,@vc3,@d2); diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result index cb6c62b16da..1e03172b255 100644 --- a/mysql-test/r/ndb_dd_backuprestore.result +++ b/mysql-test/r/ndb_dd_backuprestore.result @@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` ( `c3` int(11) NOT NULL, `c4` bit(1) NOT NULL, PRIMARY KEY (`pk1`,`c3`) -) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */ +) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */ SHOW CREATE TABLE test.t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` ( `c3` int(11) NOT NULL, `c4` bit(1) NOT NULL, PRIMARY KEY (`pk1`,`c3`) -) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */ +) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */ SHOW CREATE TABLE test.t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -193,7 +193,7 @@ t3 CREATE TABLE `t3` ( `c3` int(11) NOT NULL, `c4` bit(1) NOT NULL, PRIMARY KEY (`pk1`,`c3`) -) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */ +) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */ SHOW CREATE TABLE test.t4; Table Create Table t4 CREATE TABLE `t4` ( @@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` ( `c3` int(11) NOT NULL, `c4` bit(1) NOT NULL, PRIMARY KEY (`pk1`,`c3`) -) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */ +) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */ SHOW CREATE TABLE test.t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -350,7 +350,7 @@ t2 CREATE TABLE `t2` ( `c3` int(11) NOT NULL, `c4` bit(1) NOT NULL, PRIMARY KEY (`pk1`,`c3`) -) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */ +) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */ SHOW CREATE TABLE test.t3; Table Create Table t3 CREATE TABLE `t3` ( @@ -359,7 +359,7 @@ t3 CREATE TABLE `t3` ( `c3` int(11) NOT NULL, `c4` bit(1) NOT NULL, PRIMARY KEY (`pk1`,`c3`) -) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */ +) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */ SHOW CREATE TABLE test.t4; Table Create Table t4 CREATE TABLE `t4` ( diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result index 6c10fbe63b3..5a7e70e796d 100644 --- a/mysql-test/r/ndb_dd_basic.result +++ b/mysql-test/r/ndb_dd_basic.result @@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`pk1`) -) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 0, 0); SELECT * FROM t1; pk1 b c diff --git a/mysql-test/r/ndb_dd_disk2memory.result b/mysql-test/r/ndb_dd_disk2memory.result index bd5bbda42f3..9084ddc3e16 100644 --- a/mysql-test/r/ndb_dd_disk2memory.result +++ b/mysql-test/r/ndb_dd_disk2memory.result @@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`pk1`) -) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; SHOW CREATE TABLE test.t2; @@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` ( `b2` int(11) NOT NULL, `c2` int(11) NOT NULL, PRIMARY KEY (`pk2`) -) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 +) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 ALTER TABLE test.t1 ENGINE=NDBCLUSTER; SHOW CREATE TABLE test.t1; Table Create Table diff --git a/sql/sql_show.cc b/sql/sql_show.cc index cb3027e32fa..8d4a2c6c4b4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1215,9 +1215,10 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, store_key_options(thd, packet, table, key_info); if (key_info->parser) { - packet->append(" WITH PARSER ", 13); + packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER ")); append_identifier(thd, packet, key_info->parser->name.str, key_info->parser->name.length); + packet->append(STRING_WITH_LEN(" */ ")); } } @@ -1243,9 +1244,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, if ((for_str= file->get_tablespace_name(thd))) { - packet->append(" TABLESPACE "); + packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE ")); packet->append(for_str, strlen(for_str)); - packet->append(" STORAGE DISK"); + packet->append(STRING_WITH_LEN(" STORAGE DISK */")); my_free(for_str, MYF(0)); } @@ -1284,7 +1285,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, if(create_info.auto_increment_value > 1) { - packet->append(" AUTO_INCREMENT=", 16); + packet->append(STRING_WITH_LEN(" AUTO_INCREMENT=")); end= longlong10_to_str(create_info.auto_increment_value, buff,10); packet->append(buff, (uint) (end - buff)); } From 689fae640659759d9ea8c48793c39214c3751efc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Aug 2006 11:15:08 -0400 Subject: [PATCH 27/52] Bug #11972: client uses wrong character set after reconnect. The mysql client uses the default character set on reconnect. The default character set is now controled by the client charset command while the client is running. The charset command now also issues a SET NAMES command to the server to make sure that the client's charset settings are in sync with the server's. client/mysql.cc: Client charset command now changes the default character set and issues a SET NAMES command to the server. mysql-test/r/mysql.result: Corrected results for new behaviour. mysql-test/t/mysql.test: Removed redundant commands from test. --- client/mysql.cc | 3 +++ mysql-test/r/mysql.result | 14 +++++++------- mysql-test/t/mysql.test | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 6af9be965bb..b39a05bc61c 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1974,6 +1974,9 @@ com_charset(String *buffer __attribute__((unused)), char *line) if (new_cs) { charset_info= new_cs; + mysql_set_character_set(&mysql, charset_info->csname); + default_charset= (char *)charset_info->csname; + default_charset_used= 1; put_info("Charset changed", INFO_INFO); } else put_info("Charset is not found", INFO_INFO); diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index ba4e9daf7cb..99633f5e12a 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -59,16 +59,16 @@ database() test unlock tables; drop table t1; -ソ -ソ +ƒ\ +ƒ\ c_cp932 +ƒ\ +ƒ\ +ƒ\ ソ ソ -ソ -ソ -ソ -ソ -ソ +ƒ\ +ƒ\ +----------------------+------------+--------+ | concat('>',col1,'<') | col2 | col3 | +----------------------+------------+--------+ diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 385c59d1503..cf4e6f4047c 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -52,8 +52,8 @@ drop table t1; --exec $MYSQL --default-character-set=cp932 test -e "charset utf8;" # its usage to switch internally in mysql to requested charset ---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set @@session.character_set_client= cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;" ---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set character_set_client= cp932; select 'ƒ\'" +--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;" +--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'" --exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'" --exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'" From ed6b3e6b041102261deea538dec16e2c37869971 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 Aug 2006 17:59:47 +0400 Subject: [PATCH 28/52] Added stacktrace dumps for x86_64 (bug #21250) Fixed stacktrace dumps for i386/NPTL --- sql/stacktrace.c | 51 ++++++++++++++++++++++++++++++++++-------------- sql/stacktrace.h | 8 ++++++-- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/sql/stacktrace.c b/sql/stacktrace.c index 838f547dc02..d82c7c2a384 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -21,6 +21,7 @@ #ifdef HAVE_STACKTRACE #include +#include #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) @@ -44,7 +45,25 @@ void safe_print_str(const char* name, const char* val, int max_len) } #ifdef TARGET_OS_LINUX -#define SIGRETURN_FRAME_COUNT 2 + +#ifdef __i386__ +#define SIGRETURN_FRAME_OFFSET 17 +#endif + +#ifdef __x86_64__ +#define SIGRETURN_FRAME_OFFSET 23 +#endif + +static my_bool is_nptl; + +/* Check if we are using NPTL or LinuxThreads on Linux */ +void check_thread_lib(void) +{ + char buf[5]; + + confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf)); + is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf)); +} #if defined(__alpha__) && defined(__GNUC__) /* @@ -90,7 +109,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp) void print_stacktrace(gptr stack_bottom, ulong thread_stack) { uchar** fp; - uint frame_count = 0; + uint frame_count = 0, sigreturn_frame_count; #if defined(__alpha__) && defined(__GNUC__) uint32* pc; #endif @@ -100,28 +119,27 @@ void print_stacktrace(gptr stack_bottom, ulong thread_stack) Attempting backtrace. You can use the following information to find out\n\ where mysqld died. If you see no messages after this, something went\n\ terribly wrong...\n"); -#ifdef __i386__ +#ifdef __i386__ __asm __volatile__ ("movl %%ebp,%0" :"=r"(fp) :"r"(fp)); - if (!fp) - { - fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with\n\ --fomit-frame-pointer? Aborting backtrace!\n"); - return; - } +#endif +#ifdef __x86_64__ + __asm __volatile__ ("movq %%rbp,%0" + :"=r"(fp) + :"r"(fp)); #endif #if defined(__alpha__) && defined(__GNUC__) __asm __volatile__ ("mov $30,%0" :"=r"(fp) :"r"(fp)); +#endif if (!fp) { - fprintf(stderr, "frame pointer (fp) is NULL, did you compile with\n\ + fprintf(stderr, "frame pointer is NULL, did you compile with\n\ -fomit-frame-pointer? Aborting backtrace!\n"); return; } -#endif /* __alpha__ */ if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp) { @@ -151,13 +169,16 @@ terribly wrong...\n"); :"r"(pc)); #endif /* __alpha__ */ + /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */ + sigreturn_frame_count = is_nptl ? 1 : 2; + while (fp < (uchar**) stack_bottom) { -#ifdef __i386__ +#if defined(__i386__) || defined(__x86_64__) uchar** new_fp = (uchar**)*fp; - fprintf(stderr, "%p\n", frame_count == SIGRETURN_FRAME_COUNT ? - *(fp+17) : *(fp+1)); -#endif /* __386__ */ + fprintf(stderr, "%p\n", frame_count == sigreturn_frame_count ? + *(fp + SIGRETURN_FRAME_OFFSET) : *(fp + 1)); +#endif /* defined(__386__) || defined(__x86_64__) */ #if defined(__alpha__) && defined(__GNUC__) uchar** new_fp = find_prev_fp(pc, fp); diff --git a/sql/stacktrace.h b/sql/stacktrace.h index d5d1e05ef0e..527d10d70a2 100644 --- a/sql/stacktrace.h +++ b/sql/stacktrace.h @@ -19,16 +19,20 @@ extern "C" { #endif #ifdef TARGET_OS_LINUX -#if defined(HAVE_STACKTRACE) || (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) +#if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) #undef HAVE_STACKTRACE #define HAVE_STACKTRACE extern char* __bss_start; extern char* heap_start; -#define init_stacktrace() { heap_start = (char*) &__bss_start; } +#define init_stacktrace() do { \ + heap_start = (char*) &__bss_start; \ + check_thread_lib(); \ + } while(0); void print_stacktrace(gptr stack_bottom, ulong thread_stack); void safe_print_str(const char* name, const char* val, int max_len); +void check_thread_lib(void); #endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */ #endif /* TARGET_OS_LINUX */ From 0c1ccbf014e9d58752a710067b0245b968ace45f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 Aug 2006 11:54:33 -0400 Subject: [PATCH 29/52] Bug#21543: 5.0.24 breaks ABI compatibility for python bindings: \ InterfaceError on connect Removed the bool flag from the st_mysql_options struct, since it adds another word in size to the memory size and shifts member memory locations down, both of which break binary-interface compatibility. Instead, use a flag, 2**30, in the client_options bit-field to represent that the client should check the SSL certificate of the server. include/mysql.h: Do not change the struct size. include/mysql_com.h: Add a new bit-flag for client verifying server SSL certificate. Emphasize that we're not stepping on anyone else's bit/toes. sql-common/client.c: Set and read the bit-field for client-side SSL-cert checking of the server. --- include/mysql.h | 1 - include/mysql_com.h | 6 ++++-- sql-common/client.c | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index 3a71e47f414..b2efa2ffd3b 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -165,7 +165,6 @@ struct st_mysql_options { char *ssl_ca; /* PEM CA file */ char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_cipher; /* cipher to use */ - my_bool ssl_verify_server_cert; /* if to verify server cert */ char *shared_memory_base_name; unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ diff --git a/include/mysql_com.h b/include/mysql_com.h index ec1c133799f..d60cfd8d8d8 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -134,8 +134,10 @@ enum enum_server_command #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ #define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ -#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */ -#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */ +#define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */ +#define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */ + +#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30) #define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31) #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ diff --git a/sql-common/client.c b/sql-common/client.c index 31e85475f08..a8e87ff4d2e 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1502,7 +1502,6 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_cipher= strdup_if_not_null(cipher); - mysql->options.ssl_verify_server_cert= FALSE; /* Off by default */ #endif /* HAVE_OPENSSL */ DBUG_RETURN(0); } @@ -2162,7 +2161,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, DBUG_PRINT("info", ("IO layer change done!")); /* Verify server cert */ - if (mysql->options.ssl_verify_server_cert && + if ((client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) && ssl_verify_server_cert(mysql->net.vio, mysql->host)) { set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate); @@ -2909,7 +2908,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) mysql->reconnect= *(my_bool *) arg; break; case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: - mysql->options.ssl_verify_server_cert= *(my_bool *) arg; + if (!arg || test(*(uint*) arg)) + mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT; + else + mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT; break; default: DBUG_RETURN(1); From 1d47ef8439cb4575484873150b229deaffdfd05f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 26 Aug 2006 10:21:26 +0400 Subject: [PATCH 30/52] Post-review fix (bug #21250) --- sql/stacktrace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/stacktrace.c b/sql/stacktrace.c index d82c7c2a384..43f35c452f7 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -61,8 +61,12 @@ void check_thread_lib(void) { char buf[5]; +#ifdef _CS_GNU_LIBPTHREAD_VERSION confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf)); is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf)); +#else + is_nptl = 0; +#endif } #if defined(__alpha__) && defined(__GNUC__) From e88121ea7ab3f2e303a89531d725b2f9988355ac Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Aug 2006 17:48:06 -0400 Subject: [PATCH 31/52] Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the information_schema database. init_dumping now accepts a function pointer to the table or view specific init_dumping function. This allows both tables and views to use the init_dumping function. client/mysqldump.c: Added functions for table and view specific dumping initalization. mysql-test/r/mysqldump.result: Added Result. mysql-test/t/mysqldump.test: Added test case. --- client/mysqldump.c | 130 ++++++++++++++++++++-------------- mysql-test/r/mysqldump.result | 14 ++++ mysql-test/t/mysqldump.test | 30 ++++++++ 3 files changed, 122 insertions(+), 52 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 5ecf334c9f7..45aa2146d0f 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -417,7 +417,9 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, int string_value); static int dump_selected_tables(char *db, char **table_names, int tables); static int dump_all_tables_in_db(char *db); -static int init_dumping(char *); +static int init_dumping_views(char *); +static int init_dumping_tables(char *); +static int init_dumping(char *, int init_func(char*)); static int dump_databases(char **); static int dump_all_databases(); static char *quote_name(const char *name, char *buff, my_bool force); @@ -2635,7 +2637,76 @@ static int dump_databases(char **db_names) } /* dump_databases */ -static int init_dumping(char *database) +/* +View Specific database initalization. + +SYNOPSIS + init_dumping_views + qdatabase quoted name of the database + +RETURN VALUES + 0 Success. + 1 Failure. +*/ +int init_dumping_views(char *qdatabase) +{ + return 0; +} /* init_dumping_views */ + + +/* +Table Specific database initalization. + +SYNOPSIS + init_dumping_tables + qdatabase quoted name of the database + +RETURN VALUES + 0 Success. + 1 Failure. +*/ +int init_dumping_tables(char *qdatabase) +{ + if (!opt_create_db) + { + char qbuf[256]; + MYSQL_ROW row; + MYSQL_RES *dbinfo; + + my_snprintf(qbuf, sizeof(qbuf), + "SHOW CREATE DATABASE IF NOT EXISTS %s", + qdatabase); + + if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql))) + { + /* Old server version, dump generic CREATE DATABASE */ + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n", + qdatabase); + fprintf(md_result_file, + "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", + qdatabase); + } + else + { + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n", + qdatabase); + row = mysql_fetch_row(dbinfo); + if (row[1]) + { + fprintf(md_result_file,"\n%s;\n",row[1]); + } + } + } + + return 0; +} /* init_dumping_tables */ + + +static int init_dumping(char *database, int init_func(char*)) { if (mysql_get_server_version(mysql) >= 50003 && !my_strcasecmp(&my_charset_latin1, database, "information_schema")) @@ -2660,40 +2731,10 @@ static int init_dumping(char *database) fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase); check_io(md_result_file); } - if (!opt_create_db) - { - char qbuf[256]; - MYSQL_ROW row; - MYSQL_RES *dbinfo; - my_snprintf(qbuf, sizeof(qbuf), - "SHOW CREATE DATABASE IF NOT EXISTS %s", - qdatabase); + /* Call the view or table specific function */ + init_func(qdatabase); - if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql))) - { - /* Old server version, dump generic CREATE DATABASE */ - if (opt_drop_database) - fprintf(md_result_file, - "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n", - qdatabase); - fprintf(md_result_file, - "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", - qdatabase); - } - else - { - if (opt_drop_database) - fprintf(md_result_file, - "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n", - qdatabase); - row = mysql_fetch_row(dbinfo); - if (row[1]) - { - fprintf(md_result_file,"\n%s;\n",row[1]); - } - } - } fprintf(md_result_file,"\nUSE %s;\n", qdatabase); check_io(md_result_file); } @@ -2725,7 +2766,7 @@ static int dump_all_tables_in_db(char *database) afterdot= strmov(hash_key, database); *afterdot++= '.'; - if (init_dumping(database)) + if (init_dumping(database, init_dumping_tables)) return 1; if (opt_xml) print_xml_tag1(md_result_file, "", "database name=", database, "\n"); @@ -2797,23 +2838,8 @@ static my_bool dump_all_views_in_db(char *database) uint numrows; char table_buff[NAME_LEN*2+3]; - if (mysql_select_db(mysql, database)) - { - DB_error(mysql, "when selecting the database"); + if (init_dumping(database, init_dumping_views)) return 1; - } - if (opt_databases || opt_alldbs) - { - char quoted_database_buf[NAME_LEN*2+3]; - char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted); - if (opt_comments) - { - fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase); - check_io(md_result_file); - } - fprintf(md_result_file,"\nUSE %s;\n", qdatabase); - check_io(md_result_file); - } if (opt_xml) print_xml_tag1(md_result_file, "", "database name=", database, "\n"); if (lock_tables) @@ -2908,7 +2934,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) char **dump_tables, **pos, **end; DBUG_ENTER("dump_selected_tables"); - if (init_dumping(db)) + if (init_dumping(db, init_dumping_tables)) return 1; init_alloc_root(&root, 8192, 0); diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 6669b33e1bb..d62d780d3dd 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2892,3 +2892,17 @@ CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1; drop table t1; drop user mysqltest_1@localhost; +create database mysqldump_myDB; +use mysqldump_myDB; +create user myDB_User; +grant create view, select on mysqldump_myDB.* to myDB_User@localhost; +create table t1 (c1 int); +insert into t1 values (3); +use mysqldump_myDB; +create view v1 (c1) as select * from t1; +use mysqldump_myDB; +drop view v1; +drop table t1; +revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; +drop user myDB_User; +drop database mysqldump_myDB; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 848c5360db7..2c3bc2a157b 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1309,3 +1309,33 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; # Clean up drop table t1; drop user mysqltest_1@localhost; + +# +# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the +# information_schema database. +# +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); +connection root; +create database mysqldump_myDB; +use mysqldump_myDB; +create user myDB_User; +grant create view, select on mysqldump_myDB.* to myDB_User@localhost; +create table t1 (c1 int); +insert into t1 values (3); + +connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK); +connection user1; +use mysqldump_myDB; +create view v1 (c1) as select * from t1; + +# Backup should not fail. +--exec $MYSQL_DUMP --all-databases --add-drop-table > $MYSQLTEST_VARDIR/tmp/bug21527.sql + +# Clean up +connection root; +use mysqldump_myDB; +drop view v1; +drop table t1; +revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; +drop user myDB_User; +drop database mysqldump_myDB; From 06707e20bc63698e6b97bc91fe7b644f65271e72 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Aug 2006 01:13:06 +0200 Subject: [PATCH 32/52] minor portability fix in SETUP.sh --- BUILD/SETUP.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 150f9e28b41..2b47f0daacd 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -1,4 +1,4 @@ -if ! test -f sql/mysqld.cc +if test ! -f sql/mysqld.cc then echo "You must run this script from the MySQL top-level directory" exit 1 @@ -81,12 +81,6 @@ fi # (returns 0 if finds lines) if ccache -V > /dev/null 2>&1 then - if ! (echo "$CC" | grep "ccache" > /dev/null) - then - CC="ccache $CC" - fi - if ! (echo "$CXX" | grep "ccache" > /dev/null) - then - CXX="ccache $CXX" - fi + echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" + echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX" fi From a9a675a8e562419824597cdf393bb9e2a8a33bd6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Aug 2006 21:13:55 -0400 Subject: [PATCH 33/52] Post merge changes. mysql-test/r/mysqldump.result: post-merge fix. mysql-test/t/mysqldump.test: post-merge fix. --- mysql-test/r/mysqldump.result | 10 +++++----- mysql-test/t/mysqldump.test | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index d5f243905c4..eb26b0324e7 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -434,7 +434,7 @@ USE `mysqldump_test_db`; drop database mysqldump_test_db; CREATE TABLE t1 (a CHAR(10)); -INSERT INTO t1 VALUES (_latin1 'ÄÖÜß'); +INSERT INTO t1 VALUES (_latin1 'ÄÖÜß'); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -479,7 +479,7 @@ CREATE TABLE `t1` ( LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES ('Ž™šá'); +INSERT INTO `t1` VALUES ('Ž™šá'); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -502,7 +502,7 @@ CREATE TABLE `t1` ( LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES ('Ž™šá'); +INSERT INTO `t1` VALUES ('Ž™šá'); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -1676,11 +1676,11 @@ create table t1 (a text character set utf8, b text character set latin1); insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); select * from t1; a b -Osnabrück Köln +Osnabrück Köln test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 select * from t1; a b -Osnabrück Köln +Osnabrück Köln drop table t1; create table `t1` ( t1_name varchar(255) default null, diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 9f22ad0b23d..545edcac315 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -153,7 +153,7 @@ drop database mysqldump_test_db; # if it is explicitely set. CREATE TABLE t1 (a CHAR(10)); -INSERT INTO t1 VALUES (_latin1 'ÄÖÜß'); +INSERT INTO t1 VALUES (_latin1 'ÄÖÜß'); --exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1 # # Bug#8063: make test mysqldump [ fail ] From a2c533ce68a96338fce5f48030441f850fb32a1e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Aug 2006 09:30:58 -0400 Subject: [PATCH 34/52] Correcting bad merge. --- mysql-test/r/partition_mgm.result | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result index 5ee12259312..f64ffaff495 100644 --- a/mysql-test/r/partition_mgm.result +++ b/mysql-test/r/partition_mgm.result @@ -7,12 +7,12 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2 */ -hello/master-data/test/t1.frm -hello/master-data/test/t1.par hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1#P#p1.MYD hello/master-data/test/t1#P#p1.MYI +hello/master-data/test/t1.frm +hello/master-data/test/t1.par ALTER TABLE t1 COALESCE PARTITION 1; SHOW CREATE TABLE t1; Table Create Table @@ -20,10 +20,10 @@ t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1 */ -hello/master-data/test/t1.frm -hello/master-data/test/t1.par hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYI +hello/master-data/test/t1.frm +hello/master-data/test/t1.par drop table t1; create table t1 (a int) partition by list (a) From 4eb10f0bab00b7a76aa573125c11afc28683ffd5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Aug 2006 17:37:48 +0200 Subject: [PATCH 35/52] Fix for BUG#20866 "show table status on innodb raises assertion" and its duplicate BUG#19057 "Test 'rpl_row_func003' fails on SuSE SLES9 x86". It was an assertion failure, only in debug builds, not present in released versions (nothing to document). It happened when doing SHOW TABLE STATUS on an InnoDB table having an auto_increment column, right after creating the table. The test which would have caught this problem was disabled in mid-April for another reason (how much I like tests disabled for months...). mysql-test/t/disabled.def: test now passes (and serves as the test for this bugfix) sql/ha_innodb.cc: Before a val_() calls on a Field object, if that field was not marked for read, we need to mark it. This is explained here: ChangeSet 1.2119.601.1 2006/06/04 18:52:22 monty@mysql.com quoting the changeset's comment: - If a handler needs to call Field->val() or Field->store() on columns that are not used in the query, one should install a temporary all-columns-used map while doing so. For this, we provide the following functions: my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); field->val(); dbug_tmp_restore_column_map(table->read_set, old_map); and similar for the write map: my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set); field->val(); dbug_tmp_restore_column_map(table->write_set, old_map); If this is not done, you will sooner or later hit a DBUG_ASSERT in the field store() / val() functions. (For not DBUG binaries, the dbug_tmp_restore_column_map() and dbug_tmp_restore_column_map() are inline dummy functions and should be optimized away be the compiler). Note that I verified that the bug didn't exist in non-debug builds. --- mysql-test/t/disabled.def | 1 - sql/ha_innodb.cc | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 644c379d746..9e6c3e3d5cc 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -34,7 +34,6 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa #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 #19710 Cluster replication to partition table fails on DELETE FROM statement 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_sp : BUG#16456 2006-02-16 jmiller rpl_sp_effects : BUG#19862 2006-06-15 mkindahl diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index fc7dff3a41e..6145b6518a8 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -7067,10 +7067,16 @@ ha_innobase::innobase_read_and_init_auto_inc( 'found_next_number_field' below because MySQL in SHOW TABLE STATUS does not seem to set 'next_number_field'. The comment in table.h says that 'next_number_field' is set when it is - 'active'. */ + 'active'. + Since 5.1 MySQL enforces that we announce fields which we will + read; as we only do a val_*() call, dbug_tmp_use_all_columns() + with read_set is sufficient. */ + my_bitmap_map *old_map; + old_map= dbug_tmp_use_all_columns(table, table->read_set); auto_inc = (longlong) table->found_next_number_field-> val_int_offset(table->s->rec_buff_length) + 1; + dbug_tmp_restore_column_map(table->read_set, old_map); } dict_table_autoinc_initialize(prebuilt->table, auto_inc); From d4075f6659caf5f0941dda36773c86a82468cec9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Aug 2006 17:11:00 +0200 Subject: [PATCH 36/52] Bug#21813 An attacker has the opportunity to bypass query logging, part2 - Use the "%.*b" format when printing prepared and exeuted prepared statements to the log. - Add test case to check that also prepared statements end up in the query log Bug#14346 Prepared statements corrupting general log/server memory - Use "stmt->query" when logging the newly prepared query instead of "packet" sql/sql_prepare.cc: mysql_stmt_prepare - Use "%.*b" format when printing to log - Print the query from stmt instead of "packet", packet points at the net in/out buffer and has most likely been overwritten when result for prepare was written to client. mysql_stmt_execute - Use "%.*b" format when printing to log - Print the query from thd as the expanded query has been specifially set to be valid also after restore from backup statement tests/mysql_client_test.c: Add tests for bug#21813 to already existing test for bug#17667. Add functionality for also executing prepared statements and making sure they end up in the log as well. --- sql/sql_prepare.cc | 6 ++- tests/mysql_client_test.c | 91 ++++++++++++++++++++++++++++----------- 2 files changed, 71 insertions(+), 26 deletions(-) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 6d35c441368..32f0ca6859d 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1877,7 +1877,8 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length) thd->stmt_map.erase(stmt); } else - mysql_log.write(thd, COM_STMT_PREPARE, "[%lu] %s", stmt->id, packet); + mysql_log.write(thd, COM_STMT_PREPARE, "[%lu] %.*b", stmt->id, + stmt->query_length, stmt->query); /* check_prepared_statemnt sends the metadata packet in case of success */ DBUG_VOID_RETURN; @@ -2252,7 +2253,8 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length) if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(), WAIT_PRIOR); if (error == 0) - mysql_log.write(thd, COM_STMT_EXECUTE, "[%lu] %s", stmt->id, thd->query); + mysql_log.write(thd, COM_STMT_EXECUTE, "[%lu] %.*b", stmt->id, + thd->query_length, thd->query); DBUG_VOID_RETURN; diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 427994f832f..8377c757138 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14912,22 +14912,31 @@ static void test_bug15613() /* Bug#17667: An attacker has the opportunity to bypass query logging. + + Note! Also tests Bug#21813, where prepared statements are used to + run queries */ static void test_bug17667() { int rc; + MYSQL_STMT *stmt; + enum query_type { QT_NORMAL, QT_PREPARED}; struct buffer_and_length { + enum query_type qt; const char *buffer; const uint length; } statements[]= { - { "drop table if exists bug17667", 29 }, - { "create table bug17667 (c varchar(20))", 37 }, - { "insert into bug17667 (c) values ('regular') /* NUL=\0 with comment */", 68 }, - { "insert into bug17667 (c) values ('NUL=\0 in value')", 50 }, - { "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 }, - { "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 }, - { "drop table bug17667", 19 }, - { NULL, 0 } }; + { QT_NORMAL, "drop table if exists bug17667", 29 }, + { QT_NORMAL, "create table bug17667 (c varchar(20))", 37 }, + { QT_NORMAL, "insert into bug17667 (c) values ('regular') /* NUL=\0 with comment */", 68 }, + { QT_PREPARED, + "insert into bug17667 (c) values ('prepared') /* NUL=\0 with comment */", 69, }, + { QT_NORMAL, "insert into bug17667 (c) values ('NUL=\0 in value')", 50 }, + { QT_NORMAL, "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 }, + { QT_PREPARED, "insert into bug17667 (c) values ('6 NULs=\0\0\0\0\0\0')", 50 }, + { QT_NORMAL, "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 }, + { QT_NORMAL, "drop table bug17667", 19 }, + { QT_NORMAL, NULL, 0 } }; struct buffer_and_length *statement_cursor; FILE *log_file; @@ -14937,9 +14946,36 @@ static void test_bug17667() for (statement_cursor= statements; statement_cursor->buffer != NULL; statement_cursor++) { - rc= mysql_real_query(mysql, statement_cursor->buffer, - statement_cursor->length); - myquery(rc); + if (statement_cursor->qt == QT_NORMAL) + { + /* Run statement as normal query */ + rc= mysql_real_query(mysql, statement_cursor->buffer, + statement_cursor->length); + myquery(rc); + } + else if (statement_cursor->qt == QT_PREPARED) + { + /* + Run as prepared statement + + NOTE! All these queries should be in the log twice, + one time for prepare and one time for execute + */ + stmt= mysql_stmt_init(mysql); + + rc= mysql_stmt_prepare(stmt, statement_cursor->buffer, + statement_cursor->length); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + mysql_stmt_close(stmt); + } + else + { + assert(0==1); + } } /* Make sure the server has written the logs to disk before reading it */ @@ -14957,29 +14993,36 @@ static void test_bug17667() for (statement_cursor= statements; statement_cursor->buffer != NULL; statement_cursor++) { + int expected_hits= 1, hits= 0; char line_buffer[MAX_TEST_QUERY_LENGTH*2]; /* more than enough room for the query and some marginalia. */ - do { - memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2); + /* Prepared statments always occurs twice in log */ + if (statement_cursor->qt == QT_PREPARED) + expected_hits++; - if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL) - { - /* If fgets returned NULL, it indicates either error or EOF */ - if (feof(log_file)) - DIE("Found EOF before all statements where found"); - else + /* Loop until we found expected number of log entries */ + do { + /* Loop until statement is found in log */ + do { + memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2); + + if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL) { + /* If fgets returned NULL, it indicates either error or EOF */ + if (feof(log_file)) + DIE("Found EOF before all statements where found"); + fprintf(stderr, "Got error %d while reading from file\n", ferror(log_file)); DIE("Read error"); } - } - /* Print the line */ - printf("%s", line_buffer); - } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2, - statement_cursor->buffer, statement_cursor->length) == NULL); + } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2, + statement_cursor->buffer, + statement_cursor->length) == NULL); + hits++; + } while (hits < expected_hits); printf("Found statement starting with \"%s\"\n", statement_cursor->buffer); From 71583c893afba17533d59ed8863674ade47ede5f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Aug 2006 21:24:09 +0200 Subject: [PATCH 37/52] portability fix in BUILD/* for solaris --- BUILD/check-cpu | 363 ++++++++++++++++++++++++------------------------ 1 file changed, 183 insertions(+), 180 deletions(-) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index b970a4b9a5b..e207d12d972 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -3,203 +3,206 @@ # Check cpu of current machine and find the # best compiler optimization flags for gcc # -# -if test -r /proc/cpuinfo ; then - # on Linux (and others?) we can get detailed CPU information out of /proc - cpuinfo="cat /proc/cpuinfo" +check_cpu () { + if test -r /proc/cpuinfo ; then + # on Linux (and others?) we can get detailed CPU information out of /proc + cpuinfo="cat /proc/cpuinfo" - # detect CPU family - cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` - if test -z "$cpu_family" ; then - cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + # detect CPU family + cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + if test -z "$cpu_family" ; then + cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + fi + + # detect CPU vendor and model + cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` + if test -z "$model_name" ; then + model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1` + fi + + # fallback: get CPU model from uname output + if test -z "$model_name" ; then + model_name=`uname -m` + fi + + # parse CPU flags + for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do + eval cpu_flag_$flag=yes + done + else + # Fallback when there is no /proc/cpuinfo + case "`uname -s`" in + FreeBSD|OpenBSD) + cpu_family=`uname -m`; + model_name=`sysctl -n hw.model` + ;; + Darwin) + cpu_family=`uname -p` + model_name=`machine` + ;; + *) + cpu_family=`uname -m`; + model_name=`uname -p`; + ;; + esac fi - # detect CPU vendor and model - cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` - model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` - if test -z "$model_name" ; then - model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1` - fi - - # fallback: get CPU model from uname output - if test -z "$model_name" ; then - model_name=`uname -m` - fi - - # parse CPU flags - for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do - eval cpu_flag_$flag=yes - done -else - # Fallback when there is no /proc/cpuinfo - case "`uname -s`" in - FreeBSD|OpenBSD) - cpu_family=`uname -m`; - model_name=`sysctl -n hw.model` + # detect CPU shortname as used by gcc options + # this list is not complete, feel free to add further entries + cpu_arg="" + case "$cpu_family--$model_name" in + # DEC Alpha + Alpha*EV6*) + cpu_arg="ev6"; ;; - Darwin) - cpu_family=`uname -p` - model_name=`machine` + + # Intel ia32 + *Xeon*) + # a Xeon is just another pentium4 ... + # ... unless it has the "lm" (long-mode) flag set, + # in that case it's a Xeon with EM64T support + if [ -z "$cpu_flag_lm" ]; then + cpu_arg="pentium4"; + else + cpu_arg="nocona"; + fi ;; + *Pentium*4*Mobile*) + cpu_arg="pentium4m"; + ;; + *Pentium*4*) + cpu_arg="pentium4"; + ;; + *Pentium*III*Mobile*) + cpu_arg="pentium3m"; + ;; + *Pentium*III*) + cpu_arg="pentium3"; + ;; + *Pentium*M*pro*) + cpu_arg="pentium-m"; + ;; + *Athlon*64*) + cpu_arg="athlon64"; + ;; + *Athlon*) + cpu_arg="athlon"; + ;; + + # Intel ia64 + *Itanium*) + # Don't need to set any flags for itanium(at the moment) + cpu_arg=""; + ;; + + # + *ppc*) + cpu_arg='powerpc' + ;; + + *powerpc*) + cpu_arg='powerpc' + ;; + + # unknown *) - cpu_family=`uname -m`; - model_name=`uname -p`; + cpu_arg=""; ;; esac -fi - -# detect CPU shortname as used by gcc options -# this list is not complete, feel free to add further entries -cpu_arg="" -case "$cpu_family--$model_name" in - # DEC Alpha - Alpha*EV6*) - cpu_arg="ev6"; - ;; - - # Intel ia32 - *Xeon*) - # a Xeon is just another pentium4 ... - # ... unless it has the "lm" (long-mode) flag set, - # in that case it's a Xeon with EM64T support - if [ -z "$cpu_flag_lm" ]; then - cpu_arg="pentium4"; - else - cpu_arg="nocona"; - fi - ;; - *Pentium*4*Mobile*) - cpu_arg="pentium4m"; - ;; - *Pentium*4*) - cpu_arg="pentium4"; - ;; - *Pentium*III*Mobile*) - cpu_arg="pentium3m"; - ;; - *Pentium*III*) - cpu_arg="pentium3"; - ;; - *Pentium*M*pro*) - cpu_arg="pentium-m"; - ;; - *Athlon*64*) - cpu_arg="athlon64"; - ;; - *Athlon*) - cpu_arg="athlon"; - ;; - - # Intel ia64 - *Itanium*) - # Don't need to set any flags for itanium(at the moment) - cpu_arg=""; - ;; - - # - *ppc*) - cpu_arg='powerpc' - ;; - - *powerpc*) - cpu_arg='powerpc' - ;; - - # unknown - *) - cpu_arg=""; - ;; -esac -if test -z "$cpu_arg"; then - echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." - check_cpu_cflags="" - return -fi - -# different compiler versions have different option names -# for CPU specific command line options -if test -z "$CC" ; then - cc="gcc"; -else - cc=$CC -fi - -cc_ver=`$cc --version | sed 1q` -cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'` - -case "$cc_ver--$cc_verno" in - *GCC*) - # different gcc backends (and versions) have different CPU flags - case `gcc -dumpmachine` in - i?86-*) - case "$cc_verno" in - 3.4*|3.5*|4.*) - check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg' - ;; - *) - check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg' - ;; - esac - ;; - ppc-*) - check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg' - ;; - *) - check_cpu_cflags="" - return - ;; - esac - ;; - 2.95.*) - # GCC 2.95 doesn't expose its name in --version output - check_cpu_args='-m$cpu_arg' - ;; - *) + if test -z "$cpu_arg"; then + echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2 check_cpu_cflags="" return - ;; -esac - -# now we check whether the compiler really understands the cpu type -touch __test.c - -while [ "$cpu_arg" ] ; do - echo -n testing $cpu_arg "... " - - # compile check - check_cpu_cflags=`eval echo $check_cpu_args` - if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then - echo ok - break; fi - echo failed - check_cpu_cflags="" + # different compiler versions have different option names + # for CPU specific command line options + if test -z "$CC" ; then + cc="gcc"; + else + cc=$CC + fi - # if compile failed: check whether it supports a predecessor of this CPU - # this list is not complete, feel free to add further entries - case "$cpu_arg" in - # Intel ia32 - nocona) cpu_arg=pentium4 ;; - prescott) cpu_arg=pentium4 ;; - pentium4m) cpu_arg=pentium4 ;; - pentium4) cpu_arg=pentium3 ;; - pentium3m) cpu_arg=pentium3 ;; - pentium3) cpu_arg=pentium2 ;; - pentium2) cpu_arg=pentiumpro ;; - pentiumpro) cpu_arg=pentium ;; - pentium) cpu_arg=i486 ;; - i486) cpu_arg=i386 ;; + cc_ver=`$cc --version | sed 1q` + cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'` - # power / powerPC - 7450) cpu_arg=7400 ;; - - *) cpu_arg="" ;; + case "$cc_ver--$cc_verno" in + *GCC*) + # different gcc backends (and versions) have different CPU flags + case `gcc -dumpmachine` in + i?86-*) + case "$cc_verno" in + 3.4*|3.5*|4.*) + check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg' + ;; + *) + check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg' + ;; + esac + ;; + ppc-*) + check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg' + ;; + *) + check_cpu_cflags="" + return + ;; + esac + ;; + 2.95.*) + # GCC 2.95 doesn't expose its name in --version output + check_cpu_args='-m$cpu_arg' + ;; + *) + check_cpu_cflags="" + return + ;; esac -done -rm __test.* + # now we check whether the compiler really understands the cpu type + touch __test.c + while [ "$cpu_arg" ] ; do + # FIXME: echo -n isn't portable - see contortions autoconf goes through + echo -n testing $cpu_arg "... " >&2 + + # compile check + check_cpu_cflags=`eval echo $check_cpu_args` + if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then + echo ok >&2 + break; + fi + + echo failed >&2 + check_cpu_cflags="" + + # if compile failed: check whether it supports a predecessor of this CPU + # this list is not complete, feel free to add further entries + case "$cpu_arg" in + # Intel ia32 + nocona) cpu_arg=pentium4 ;; + prescott) cpu_arg=pentium4 ;; + pentium4m) cpu_arg=pentium4 ;; + pentium4) cpu_arg=pentium3 ;; + pentium3m) cpu_arg=pentium3 ;; + pentium3) cpu_arg=pentium2 ;; + pentium2) cpu_arg=pentiumpro ;; + pentiumpro) cpu_arg=pentium ;; + pentium) cpu_arg=i486 ;; + i486) cpu_arg=i386 ;; + + # power / powerPC + 7450) cpu_arg=7400 ;; + + *) cpu_arg="" ;; + esac + done + + rm __test.* +} + +check_cpu From 077b649aef8c7432e8b08606465d5954d07289ed Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Aug 2006 22:39:23 +0200 Subject: [PATCH 38/52] Remove ^Z from ctype_ucs.test data, to avoid problems testing on Windows --- mysql-test/r/ctype_ucs.result | 14 +++++++------- mysql-test/t/ctype_ucs.test | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 3a65287ffc5..05866ea4966 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -726,26 +726,26 @@ drop table if exists bug20536; set names latin1; create table bug20536 (id bigint not null auto_increment primary key, name varchar(255) character set ucs2 not null); -insert into `bug20536` (`id`,`name`) values (1, _latin1 x'74657374311a'), (2, "'test\\_2'"); +insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'"); select md5(name) from bug20536; md5(name) -3417d830fe24ffb2f81a28e54df2d1b3 +f4b7ce8b45a20e3c4e84bef515d1525c 48d95db0d8305c2fe11548a3635c9385 select sha1(name) from bug20536; sha1(name) -72228a6d56efb7a89a09543068d5d8fa4c330881 +e0b52f38deddb9f9e8d5336b153592794cb49baf 677d4d505355eb5b0549b865fcae4b7f0c28aef5 select make_set(3, name, upper(name)) from bug20536; make_set(3, name, upper(name)) -test1,TEST1 +test1,TEST1 'test\_2','TEST\_2' select export_set(5, name, upper(name)) from bug20536; export_set(5, name, upper(name)) -test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1 +test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1 'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2' select export_set(5, name, upper(name), ",", 5) from bug20536; export_set(5, name, upper(name), ",", 5) -test1,TEST1,test1,TEST1,TEST1 +test1,TEST1,test1,TEST1,TEST1 'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2' select password(name) from bug20536; password(name) @@ -761,7 +761,7 @@ SA5pDi1UPZdys SA5pDi1UPZdys select quote(name) from bug20536; quote(name) -?????????? +???????? ???????????????? drop table bug20536; End of 4.1 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 0ad38d98403..62244b3d8f5 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -475,7 +475,7 @@ drop table if exists bug20536; set names latin1; create table bug20536 (id bigint not null auto_increment primary key, name varchar(255) character set ucs2 not null); -insert into `bug20536` (`id`,`name`) values (1, _latin1 x'74657374311a'), (2, "'test\\_2'"); +insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'"); select md5(name) from bug20536; select sha1(name) from bug20536; select make_set(3, name, upper(name)) from bug20536; From 626abc5205745ff002be2c4910460999df294439 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Aug 2006 17:28:34 -0400 Subject: [PATCH 39/52] Bug#4053: too many of "error 1236: 'binlog truncated in the middle of \ event' from master" Since there is no repeatable test case, and this is obviously wrong, this is the most conservative change that might possibly work. The syscall read() wasn't checked for a negative return value for an interrupted read. The kernel sys_read() returns -EINTR, and the "library" layer maps that to return value of -1 and sets errno to EINTR. It's impossible (on Linux) for read() to set errno EINTR without the return value being -1 . So, if we're checking for EINTR behavior, we should not require that the return value be zero. mysys/my_read.c: The read() syscall should check for negative one, since that (usually) signals errors (like being interrupted) and zero (usually) signals end-of-file . --- mysys/my_read.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/mysys/my_read.c b/mysys/my_read.c index b7621ac99eb..bca28694295 100644 --- a/mysys/my_read.c +++ b/mysys/my_read.c @@ -36,48 +36,51 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags) { - uint readbytes,save_count; + uint readbytes, save_count; DBUG_ENTER("my_read"); DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %u MyFlags: %d", - Filedes, Buffer, Count, MyFlags)); - save_count=Count; + Filedes, Buffer, Count, MyFlags)); + save_count= Count; for (;;) { - errno=0; /* Linux doesn't reset this */ - if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count) + errno= 0; /* Linux doesn't reset this */ + if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count) { - my_errno=errno ? errno : -1; + my_errno= errno ? errno : -1; DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d", - readbytes,Count,Filedes,my_errno)); + readbytes, Count, Filedes, my_errno)); #ifdef THREAD - if (readbytes == 0 && errno == EINTR) - continue; /* Interrupted */ + if ((int) readbytes <= 0 && errno == EINTR) + { + DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes)); + continue; /* Interrupted */ + } #endif if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { - if ((int) readbytes == -1) - my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), - my_filename(Filedes),my_errno); - else if (MyFlags & (MY_NABP | MY_FNABP)) - my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), - my_filename(Filedes),my_errno); + if ((int) readbytes == -1) + my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); + else if (MyFlags & (MY_NABP | MY_FNABP)) + my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); } if ((int) readbytes == -1 || - ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO))) - DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ + ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO))) + DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ if (readbytes > 0 && (MyFlags & MY_FULL_IO)) { - Buffer+=readbytes; - Count-=readbytes; - continue; + Buffer+= readbytes; + Count-= readbytes; + continue; } } if (MyFlags & (MY_NABP | MY_FNABP)) - readbytes=0; /* Ok on read */ + readbytes= 0; /* Ok on read */ else if (MyFlags & MY_FULL_IO) - readbytes=save_count; + readbytes= save_count; break; } DBUG_RETURN(readbytes); From 5ba4f53c64b5e7dbfb4205cc13b16e20ef35f3c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:18:55 +0200 Subject: [PATCH 40/52] Add check in 'spawn_impl' that we are not trying to span when the path to the executable is empty or undefined --- mysql-test/lib/mtr_process.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index a71a1e7d2e4..f74665d1646 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -94,6 +94,8 @@ sub spawn_impl ($$$$$$$$) { my $pid_file= shift; # FIXME my $spawn_opts= shift; + mtr_error("Can't spawn with empty \"path\"") unless defined $path; + if ( $::opt_script_debug ) { print STDERR "\n"; From abc4c3dc1d77cb801d9a13c9feb33bf970eeba3f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:28:48 +0200 Subject: [PATCH 41/52] Bug#21721 Test suite does not start with NDB, hangs forever; problem around "ndb_mgmd" - Wait for ndb_mgmd with timeout mysql-test/mysql-test-run.pl: Add new function 'ndb_mgmd_wait_started' that will wait with timeout until ndb_mgmd has been started Don't bother to save the return value from 'ndb_mgmd_start' in local var as it's not used. --- mysql-test/mysql-test-run.pl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6865cd55398..c949c2e1966 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1955,6 +1955,23 @@ sub mysqld_wait_started($){ } +sub ndb_mgmd_wait_started($) { + my ($cluster)= @_; + + my $retries= 100; + while (ndbcluster_wait_started($cluster, "--no-contact") and + $retries) + { + # Millisceond sleep emulated with select + select(undef, undef, undef, (0.1)); + + $retries--; + } + + return $retries == 0; + +} + sub ndb_mgmd_start ($) { my $cluster= shift; @@ -1975,13 +1992,12 @@ sub ndb_mgmd_start ($) { "", { append_log_file => 1 }); - # FIXME Should not be needed # Unfortunately the cluster nodes will fail to start # if ndb_mgmd has not started properly - while (ndbcluster_wait_started($cluster, "--no-contact")) + if (ndb_mgmd_wait_started($cluster)) { - select(undef, undef, undef, 0.1); + mtr_error("Failed to wait for start of ndb_mgmd"); } # Remember pid of ndb_mgmd @@ -2046,7 +2062,7 @@ sub ndbcluster_start ($$) { mtr_error("Cluster '$cluster->{'name'}' already started"); } - my $pid= ndb_mgmd_start($cluster); + ndb_mgmd_start($cluster); for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) { From 22da915b62dce66f87bb7e29898d99265b31cfa2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 11:14:04 -0400 Subject: [PATCH 42/52] Bitkeeper's Tk interface uses UTF8 by default, so mixing charsets in a single file is a bad practice. tests/mysql_client_test.c: Replace literal characters which don't make sense in UTF8 with ubiquitously- understood numbers. --- tests/mysql_client_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 94034141d81..bb4fb649a44 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -9952,8 +9952,9 @@ static void test_ps_i18n() const char *stmt_text; MYSQL_BIND bind_array[2]; - const char *koi8= "îÕ, ÚÁ ÒÙÂÁÌËÕ"; - const char *cp1251= "Íó, çà ðûáàëêó"; + /* Represented as numbers to keep UTF8 tools from clobbering them. */ + const char *koi8= "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5"; + const char *cp1251= "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3"; char buf1[16], buf2[16]; ulong buf1_len, buf2_len; From c0966c4fccd74ea5ef60e81026b3d3088335ad93 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 20:58:00 +0200 Subject: [PATCH 43/52] Only install the first masters db and copy it for the other Gives slightly faster startup mysql-test/lib/mtr_misc.pl: Add verbose message --- mysql-test/lib/mtr_misc.pl | 2 ++ mysql-test/mysql-test-run.pl | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 0ab09a40b37..dd9d24ebc8e 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -139,6 +139,8 @@ sub mtr_copy_dir($$) { my $from_dir= shift; my $to_dir= shift; +# mtr_verbose("Copying from $from_dir to $to_dir"); + mkpath("$to_dir"); opendir(DIR, "$from_dir") or mtr_error("Can't find $from_dir$!"); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 3c4e10c9363..b3dd5a26085 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -357,6 +357,7 @@ sub run_benchmarks ($); sub initialize_servers (); sub mysql_install_db (); sub install_db ($$); +sub copy_install_db ($$); sub run_testcase ($); sub run_testcase_stop_servers ($$$); sub run_testcase_start_servers ($); @@ -2237,7 +2238,7 @@ 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'}); + copy_install_db('master', $master->[1]->{'path_myddir'}); if ( $use_slaves ) { @@ -2302,6 +2303,18 @@ sub mysql_install_db () { } +sub copy_install_db ($$) { + my $type= shift; + my $data_dir= shift; + + mtr_report("Installing \u$type Database"); + + # Just copy the installed db from first master + mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir); + +} + + sub install_db ($$) { my $type= shift; my $data_dir= shift; @@ -2456,7 +2469,7 @@ sub im_prepare_data_dir($) { foreach my $instance (@{$instance_manager->{'instances'}}) { - install_db( + copy_install_db( 'im_mysqld_' . $instance->{'server_id'}, $instance->{'path_datadir'}); } From 55c61a6ea6a26ba736d2d85d76871ae40043deba Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 20:53:34 -0700 Subject: [PATCH 44/52] Restore bug fix lost in merge of client/mysqldump.c, and clean up mysqldump.test so that 4.1 and 5.0 tests are all in the right place and no tests are duplicated. client/mysqldump.c: Restore fix for bug 21215 accidently removed during merge mysql-test/r/mysqldump.result: Update results mysql-test/t/mysqldump.test: Fix order of tests so that all the tests new to the 5.0 tree come after "End of 4.1 tests", and so that each leaves things in the state it found them (particularly by returning to the 'test' database. Also remove some tests that were duplicated. --- client/mysqldump.c | 1 + mysql-test/r/mysqldump.result | 574 ++++++++++------------------------ mysql-test/t/mysqldump.test | 219 ++++++------- 3 files changed, 249 insertions(+), 545 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 990253aa48c..d6f89022e32 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -882,6 +882,7 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n", my_progname, query, mysql_error(mysql_con), mysql_errno(mysql_con)); + safe_exit(EX_MYSQLERR); return 1; } return 0; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index bdbaa870a42..1d131c67c73 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -640,298 +640,6 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -drop table t1; -CREATE TABLE t1 (a int); -INSERT INTO t1 VALUES (1),(2),(3); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - -/*!40000 DROP DATABASE IF EXISTS `test`*/; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `test`; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t1` WRITE; -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES (1),(2),(3); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -UNLOCK TABLES; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -DROP TABLE t1; -CREATE DATABASE mysqldump_test_db; -USE mysqldump_test_db; -CREATE TABLE t1 ( a INT ); -CREATE TABLE t2 ( a INT ); -INSERT INTO t1 VALUES (1), (2); -INSERT INTO t2 VALUES (1), (2); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `t2`; -CREATE TABLE `t2` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `t2`; -CREATE TABLE `t2` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -DROP TABLE t1, t2; -DROP DATABASE mysqldump_test_db; -create database mysqldump_test_db; -use mysqldump_test_db; -create table t1(a varchar(30) primary key, b int not null); -create table t2(a varchar(30) primary key, b int not null); -create table t3(a varchar(30) primary key, b int not null); -test_sequence ------- Testing with illegal table names ------ -mysqldump: Couldn't find table: "\d-2-1.sql" - -mysqldump: Couldn't find table: "\t1" - -mysqldump: Couldn't find table: "\t1" - -mysqldump: Couldn't find table: "\\t1" - -mysqldump: Couldn't find table: "t\1" - -mysqldump: Couldn't find table: "t\1" - -mysqldump: Couldn't find table: "t/1" - -test_sequence ------- Testing with illegal database names ------ -mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database -mysqldump: Got error: 1102: Incorrect database name 'mysqld\ump_test_db' when selecting the database -drop table t1, t2, t3; -drop database mysqldump_test_db; -use test; -create table t1 (a int(10)); -create table t2 (pk int primary key auto_increment, -a int(10), b varchar(30), c datetime, d blob, e text); -insert into t1 values (NULL), (10), (20); -insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty"); - - - - - - - - - 10 - - - 20 - - - - - 1 - - - - - - - - 2 - 10 - - - - - - - 3 - - twenty - - - - - - 4 - 30 - thirty - - - - - - - -drop table t1, t2; -create table t1 (a text character set utf8, b text character set latin1); -insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); -select * from t1; -a b -Osnabrück Köln -test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 -select * from t1; -a b -Osnabrück Köln -drop table t1; ---fields-optionally-enclosed-by=" -create table `t1` ( -t1_name varchar(255) default null, -t1_id int(10) unsigned not null auto_increment, -key (t1_name), -primary key (t1_id) -) auto_increment = 1000 default charset=latin1; -insert into t1 (t1_name) values('bla'); -insert into t1 (t1_name) values('bla'); -insert into t1 (t1_name) values('bla'); -select * from t1; -t1_name t1_id -bla 1000 -bla 1001 -bla 1002 -show create table `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `t1_name` varchar(255) default NULL, - `t1_id` int(10) unsigned NOT NULL auto_increment, - PRIMARY KEY (`t1_id`), - KEY `t1_name` (`t1_name`) -) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 -DROP TABLE `t1`; -select * from t1; -t1_name t1_id -bla 1000 -bla 1001 -bla 1002 -show create table `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `t1_name` varchar(255) default NULL, - `t1_id` int(10) unsigned NOT NULL auto_increment, - PRIMARY KEY (`t1_id`), - KEY `t1_name` (`t1_name`) -) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 -drop table `t1`; -create table t1(a int); -create table t2(a int); -create table t3(a int); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t3`; -CREATE TABLE `t3` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `t2`; -CREATE TABLE `t2` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -drop table t1, t2, t3; -create table t1 (a int); -mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) -mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -drop table t1; -End of 4.1 tests /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1695,92 +1403,6 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; -create database db1; -use db1; -CREATE TABLE t2 ( -a varchar(30) default NULL, -KEY a (a(5)) -); -INSERT INTO t2 VALUES ('alfred'); -INSERT INTO t2 VALUES ('angie'); -INSERT INTO t2 VALUES ('bingo'); -INSERT INTO t2 VALUES ('waffle'); -INSERT INTO t2 VALUES ('lemon'); -create view v2 as select * from t2 where a like 'a%' with check option; - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t2`; -CREATE TABLE `t2` ( - `a` varchar(30) default NULL, - KEY `a` (`a`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t2` WRITE; -/*!40000 ALTER TABLE `t2` DISABLE KEYS */; -INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon'); -/*!40000 ALTER TABLE `t2` ENABLE KEYS */; -UNLOCK TABLES; -DROP TABLE IF EXISTS `v2`; -/*!50001 DROP VIEW IF EXISTS `v2`*/; -/*!50001 CREATE TABLE `v2` ( - `a` varchar(30) -) */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; -/*!50001 DROP VIEW IF EXISTS `v2`*/; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ -/*!50002 WITH CASCADED CHECK OPTION */; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -drop table t2; -drop view v2; -drop database db1; -create database db2; -use db2; -create table t1 (a int); -create table t2 (a int, b varchar(10), primary key(a)); -insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); -insert into t1 values (289), (298), (234), (456), (789); -create view v1 as select * from t2; -create view v2 as select * from t1; -drop table t1, t2; -drop view v1, v2; -drop database db2; -create database db1; -use db1; -show tables; -Tables_in_db1 -t1 -t2 -v1 -v2 -select * from t2 order by a; -a b -1 on -2 off -10 pol -12 meg -drop table t1, t2; -drop database db1; ---fields-optionally-enclosed-by=" CREATE DATABASE mysqldump_test_db; USE mysqldump_test_db; CREATE TABLE t1 ( a INT ); @@ -1973,6 +1595,7 @@ select * from t1; a b Osnabrück Köln drop table t1; +--fields-optionally-enclosed-by=" create table `t1` ( t1_name varchar(255) default null, t1_id int(10) unsigned not null auto_increment, @@ -2010,7 +1633,162 @@ t1 CREATE TABLE `t1` ( KEY `t1_name` (`t1_name`) ) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 drop table `t1`; +create table t1(a int); +create table t2(a int); +create table t3(a int); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t3`; +CREATE TABLE `t3` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS `t2`; +CREATE TABLE `t2` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1, t2, t3; +create table t1 (a int); +mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) +mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; End of 4.1 tests +create database db1; +use db1; +CREATE TABLE t2 ( +a varchar(30) default NULL, +KEY a (a(5)) +); +INSERT INTO t2 VALUES ('alfred'); +INSERT INTO t2 VALUES ('angie'); +INSERT INTO t2 VALUES ('bingo'); +INSERT INTO t2 VALUES ('waffle'); +INSERT INTO t2 VALUES ('lemon'); +create view v2 as select * from t2 where a like 'a%' with check option; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t2`; +CREATE TABLE `t2` ( + `a` varchar(30) default NULL, + KEY `a` (`a`(5)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon'); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE TABLE `v2` ( + `a` varchar(30) +) */; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t2; +drop view v2; +drop database db1; +use test; +create database db2; +use db2; +create table t1 (a int); +create table t2 (a int, b varchar(10), primary key(a)); +insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); +insert into t1 values (289), (298), (234), (456), (789); +create view v1 as select * from t2; +create view v2 as select * from t1; +drop table t1, t2; +drop view v1, v2; +drop database db2; +use test; +create database db1; +use db1; +show tables; +Tables_in_db1 +t1 +t2 +v1 +v2 +select * from t2 order by a; +a b +1 on +2 off +10 pol +12 meg +drop table t1, t2; +drop database db1; +use test; create table t1(a int); create view v1 as select * from t1; @@ -2915,44 +2693,6 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; -create table t1(a int); -create table t2(a int); -create table t3(a int); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t3`; -CREATE TABLE `t3` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `t2`; -CREATE TABLE `t2` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -drop table t1, t2, t3; -End of 4.1 tests create table t1 (a int); insert into t1 values (289), (298), (234), (456), (789); create definer = CURRENT_USER view v1 as select * from t1; @@ -3198,3 +2938,5 @@ drop table t1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; drop user myDB_User; drop database mysqldump_myDB; +use test; +End of 5.0 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index a8521b7e1eb..9766ee8d9c8 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -548,121 +548,6 @@ INSERT INTO t1 VALUES (1),(2),(3); --exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test DROP TABLE t1; - -# -# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) -# - -create database db1; -use db1; - -CREATE TABLE t2 ( - a varchar(30) default NULL, - KEY a (a(5)) -); - -INSERT INTO t2 VALUES ('alfred'); -INSERT INTO t2 VALUES ('angie'); -INSERT INTO t2 VALUES ('bingo'); -INSERT INTO t2 VALUES ('waffle'); -INSERT INTO t2 VALUES ('lemon'); -create view v2 as select * from t2 where a like 'a%' with check option; ---exec $MYSQL_DUMP --skip-comments db1 -drop table t2; -drop view v2; -drop database db1; - -# -# Bug 10713 mysqldump includes database in create view and referenced tables -# - -# create table and views in db2 -create database db2; -use db2; -create table t1 (a int); -create table t2 (a int, b varchar(10), primary key(a)); -insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); -insert into t1 values (289), (298), (234), (456), (789); -create view v1 as select * from t2; -create view v2 as select * from t1; - -# dump tables and view from db2 ---exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql - -# drop the db, tables and views -drop table t1, t2; -drop view v1, v2; -drop database db2; - -# create db1 and reload dump -create database db1; -use db1; ---exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql - -# check that all tables and views could be created -show tables; -select * from t2 order by a; - -drop table t1, t2; -drop database db1; - -# -# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence -# - ---exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump - - -# -# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]" -# -create table `t1` ( - t1_name varchar(255) default null, - t1_id int(10) unsigned not null auto_increment, - key (t1_name), - primary key (t1_id) -) auto_increment = 1000 default charset=latin1; - -insert into t1 (t1_name) values('bla'); -insert into t1 (t1_name) values('bla'); -insert into t1 (t1_name) values('bla'); - -select * from t1; - -show create table `t1`; - ---exec $MYSQL_DUMP --skip-comments test t1 > $MYSQLTEST_VARDIR/tmp/bug19025.sql -DROP TABLE `t1`; - ---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug19025.sql - -select * from t1; - -show create table `t1`; - -drop table `t1`; - -# -# Bug #18536: wrong table order -# - -create table t1(a int); -create table t2(a int); -create table t3(a int); ---error 6 ---exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 -drop table t1, t2, t3; - -# -# Bug #21288: mysqldump segmentation fault when using --where -# -create table t1 (a int); ---error 2 ---exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 -drop table t1; - ---echo End of 4.1 tests - # # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data # @@ -769,6 +654,12 @@ select * from t1; drop table t1; +# +# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence +# + +--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump + # # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]" # @@ -798,8 +689,87 @@ show create table `t1`; drop table `t1`; +# +# Bug #18536: wrong table order +# + +create table t1(a int); +create table t2(a int); +create table t3(a int); +--error 6 +--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 +drop table t1, t2, t3; + +# +# Bug #21288: mysqldump segmentation fault when using --where +# +create table t1 (a int); +--error 2 +--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 +drop table t1; + --echo End of 4.1 tests +# +# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) +# + +create database db1; +use db1; + +CREATE TABLE t2 ( + a varchar(30) default NULL, + KEY a (a(5)) +); + +INSERT INTO t2 VALUES ('alfred'); +INSERT INTO t2 VALUES ('angie'); +INSERT INTO t2 VALUES ('bingo'); +INSERT INTO t2 VALUES ('waffle'); +INSERT INTO t2 VALUES ('lemon'); +create view v2 as select * from t2 where a like 'a%' with check option; +--exec $MYSQL_DUMP --skip-comments db1 +drop table t2; +drop view v2; +drop database db1; +use test; + +# +# Bug 10713 mysqldump includes database in create view and referenced tables +# + +# create table and views in db2 +create database db2; +use db2; +create table t1 (a int); +create table t2 (a int, b varchar(10), primary key(a)); +insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); +insert into t1 values (289), (298), (234), (456), (789); +create view v1 as select * from t2; +create view v2 as select * from t1; + +# dump tables and view from db2 +--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql + +# drop the db, tables and views +drop table t1, t2; +drop view v1, v2; +drop database db2; +use test; + +# create db1 and reload dump +create database db1; +use db1; +--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql + +# check that all tables and views could be created +show tables; +select * from t2 order by a; + +drop table t1, t2; +drop database db1; +use test; + # # dump of view # @@ -863,6 +833,7 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; drop view v1, v2, v3; drop table t1; + # # Test for dumping triggers # @@ -1122,19 +1093,6 @@ insert into t1 values ('',''); --exec $MYSQL_DUMP --skip-comments --hex-blob test t1 drop table t1; -# -# Bug #18536: wrong table order -# - -create table t1(a int); -create table t2(a int); -create table t3(a int); ---error 6 ---exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 -drop table t1, t2, t3; - ---echo End of 4.1 tests - # # Bug 14871 Invalid view dump output # @@ -1316,11 +1274,11 @@ use mysqldump_dbb; drop view v1; drop table t1; drop database mysqldump_dbb; +use test; # # Bug#21215 mysqldump creating incomplete backups without warning # -use test; # Create user without sufficient privs to perform the requested operation create user mysqltest_1@localhost; @@ -1389,3 +1347,6 @@ drop table t1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; drop user myDB_User; drop database mysqldump_myDB; +use test; + +--echo End of 5.0 tests From adb650b23634a6b3f3e78be5adc2174a81923693 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 21:21:23 -0700 Subject: [PATCH 45/52] Fix results of mysqldump test after messy merge mysql-test/r/mysqldump.result: Fix results --- mysql-test/r/mysqldump.result | 366 ++++++++++++++++++---------------- 1 file changed, 199 insertions(+), 167 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 07f3ffa89e4..1e1456bd81a 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1404,92 +1404,6 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; -create database db1; -use db1; -CREATE TABLE t2 ( -a varchar(30) default NULL, -KEY a (a(5)) -); -INSERT INTO t2 VALUES ('alfred'); -INSERT INTO t2 VALUES ('angie'); -INSERT INTO t2 VALUES ('bingo'); -INSERT INTO t2 VALUES ('waffle'); -INSERT INTO t2 VALUES ('lemon'); -create view v2 as select * from t2 where a like 'a%' with check option; - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t2`; -CREATE TABLE `t2` ( - `a` varchar(30) DEFAULT NULL, - KEY `a` (`a`(5)) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t2` WRITE; -/*!40000 ALTER TABLE `t2` DISABLE KEYS */; -INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon'); -/*!40000 ALTER TABLE `t2` ENABLE KEYS */; -UNLOCK TABLES; -DROP TABLE IF EXISTS `v2`; -/*!50001 DROP VIEW IF EXISTS `v2`*/; -/*!50001 CREATE TABLE `v2` ( - `a` varchar(30) -) */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; -/*!50001 DROP VIEW IF EXISTS `v2`*/; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ -/*!50002 WITH CASCADED CHECK OPTION */; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -drop table t2; -drop view v2; -drop database db1; -create database db2; -use db2; -create table t1 (a int); -create table t2 (a int, b varchar(10), primary key(a)); -insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); -insert into t1 values (289), (298), (234), (456), (789); -create view v1 as select * from t2; -create view v2 as select * from t1; -drop table t1, t2; -drop view v1, v2; -drop database db2; -create database db1; -use db1; -show tables; -Tables_in_db1 -t1 -t2 -v1 -v2 -select * from t2 order by a; -a b -1 on -2 off -10 pol -12 meg -drop table t1, t2; -drop database db1; ---fields-optionally-enclosed-by=" CREATE DATABASE mysqldump_test_db; USE mysqldump_test_db; CREATE TABLE t1 ( a INT ); @@ -1757,8 +1671,9 @@ CREATE TABLE `t2` ( /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1, t2, t3; -create table t1 (a binary(1), b blob); -insert into t1 values ('',''); +create table t1 (a int); +mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) +mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1772,47 +1687,9 @@ insert into t1 values ('',''); /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( - `a` binary(1) DEFAULT NULL, - `b` blob + `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -LOCK TABLES `t1` WRITE; -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES (0x00,''); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` binary(1) DEFAULT NULL, - `b` blob -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t1` WRITE; -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES (0x00,''); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1824,6 +1701,95 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; +End of 4.1 tests +create database db1; +use db1; +CREATE TABLE t2 ( +a varchar(30) default NULL, +KEY a (a(5)) +); +INSERT INTO t2 VALUES ('alfred'); +INSERT INTO t2 VALUES ('angie'); +INSERT INTO t2 VALUES ('bingo'); +INSERT INTO t2 VALUES ('waffle'); +INSERT INTO t2 VALUES ('lemon'); +create view v2 as select * from t2 where a like 'a%' with check option; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t2`; +CREATE TABLE `t2` ( + `a` varchar(30) DEFAULT NULL, + KEY `a` (`a`(5)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon'); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE TABLE `v2` ( + `a` varchar(30) +) */; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t2; +drop view v2; +drop database db1; +use test; +create database db2; +use db2; +create table t1 (a int); +create table t2 (a int, b varchar(10), primary key(a)); +insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); +insert into t1 values (289), (298), (234), (456), (789); +create view v1 as select * from t2; +create view v2 as select * from t1; +drop table t1, t2; +drop view v1, v2; +drop database db2; +use test; +create database db1; +use db1; +show tables; +Tables_in_db1 +t1 +t2 +v1 +v2 +select * from t2 order by a; +a b +1 on +2 off +10 pol +12 meg +drop table t1, t2; +drop database db1; +use test; create table t1(a int); create view v1 as select * from t1; @@ -2606,44 +2572,6 @@ drop view v2; drop view v0; drop view v1; drop table t1; -drop table if exists t1; -CREATE TABLE t1(a int, b int); -INSERT INTO t1 VALUES (1,1); -INSERT INTO t1 VALUES (2,3); -INSERT INTO t1 VALUES (3,4), (4,5); - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t1` WRITE; -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -DROP TABLE t1; SET @old_sql_mode = @@SQL_MODE; SET SQL_MODE = IGNORE_SPACE; CREATE TABLE t1 (a INT); @@ -2699,7 +2627,73 @@ DELIMITER ; DROP TRIGGER tr1; DROP TABLE t1; -End of 4.1 tests +create table t1 (a binary(1), b blob); +insert into t1 values ('',''); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` binary(1) DEFAULT NULL, + `b` blob +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (0x00,''); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` binary(1) DEFAULT NULL, + `b` blob +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (0x00,''); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; create table t1 (a int); insert into t1 values (289), (298), (234), (456), (789); create definer = CURRENT_USER view v1 as select * from t1; @@ -2940,8 +2934,46 @@ drop table t1; revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; drop user myDB_User; drop database mysqldump_myDB; -End of 5.0 tests use test; +End of 5.0 tests +drop table if exists t1; +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,3); +INSERT INTO t1 VALUES (3,4), (4,5); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; create table t1 (a text , b text); create table t2 (a text , b text); insert t1 values ("Duck, Duck", "goose"); From edc0e9fba8e721f6e04cf1051a4413b1b885d18c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Sep 2006 10:01:47 +0200 Subject: [PATCH 46/52] Use "--skip-innodb" if running with testcases that does not need innodb Decreases test time when running a selected number of tests mysql-test/lib/mtr_cases.pl: Remove fixme, it's fiexd now mysql-test/mysql-test-run.pl: Use "--skip-innodb" if running with testcases that does not need innodb --- mysql-test/lib/mtr_cases.pl | 8 -------- mysql-test/mysql-test-run.pl | 10 +++++----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index b0ba27e6736..daed111dfce 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -469,14 +469,6 @@ sub collect_one_test_case($$$$$$$) { { mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); - if ( ! $tinfo->{'innodb_test'} ) - { - # mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}"); - # FIXME activate the --skip-innodb only when running with - # selected test cases - # push(@{$tinfo->{'master_opt'}}, "--skip-innodb"); - } - if ( $tinfo->{'big_test'} and ! $::opt_big_test ) { $tinfo->{'skip'}= 1; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b3dd5a26085..cb7d8a16b90 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -258,6 +258,7 @@ our $opt_result_ext; our $opt_skip; our $opt_skip_rpl; our $use_slaves; +our $use_innodb; our $opt_skip_test; our $opt_skip_im; @@ -428,6 +429,7 @@ sub main () { $need_ndbcluster||= $test->{ndb_test}; $need_im||= $test->{component_id} eq 'im'; $use_slaves||= $test->{slave_num}; + $use_innodb||= $test->{'innodb_test'}; } $opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1 unless $need_ndbcluster; @@ -2236,8 +2238,9 @@ sub initialize_servers () { sub mysql_install_db () { - # FIXME not exactly true I think, needs improvements install_db('master', $master->[0]->{'path_myddir'}); + + # FIXME check if testcase really is using second master copy_install_db('master', $master->[1]->{'path_myddir'}); if ( $use_slaves ) @@ -2252,10 +2255,8 @@ sub mysql_install_db () { im_prepare_env($instance_manager); } - my $cluster_started_ok= 1; # Assume it can be started - if (ndbcluster_start_install($clusters->[0]) || $use_slaves && ndbcluster_start_install($clusters->[1])) { @@ -2263,7 +2264,6 @@ sub mysql_install_db () { $cluster_started_ok= 0; } - foreach my $cluster (@{$clusters}) { @@ -2903,7 +2903,7 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--datadir=%s", $prefix, $master->[$idx]->{'path_myddir'}); - if ( $idx > 0 ) + if ( $idx > 0 or !$use_innodb) { mtr_add_arg($args, "%s--skip-innodb", $prefix); } From 1bb1679c19614f3a2883e76fd03b09a216be4892 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Sep 2006 10:21:08 +0200 Subject: [PATCH 47/52] Add target to make "mtr", shortcut for running test suite BitKeeper/etc/ignore: Added mysql-test/mtr to the ignore list --- .bzrignore | 1 + mysql-test/Makefile.am | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index 6dd06504096..4325a9177fa 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1059,3 +1059,4 @@ vio/test-sslserver vio/viotest-ssl libmysql/libmysql.ver libmysqld/sql_locale.cc +mysql-test/mtr diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index cd939417e64..1e6eb12f7b2 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -34,7 +34,7 @@ benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh $(PRESCRIPTS) EXTRA_DIST = $(EXTRA_SCRIPTS) -GENSCRIPTS = mysql-test-run install_test_db +GENSCRIPTS = mysql-test-run install_test_db mtr PRESCRIPTS = mysql-test-run.pl test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \ @@ -105,6 +105,11 @@ std_data/server-cert.pem: std_data/server-key.pem: @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data +# mtr - a shortcut for executing mysql-test-run.pl +mtr: + $(RM) -f mtr + $(LN_S) mysql-test-run.pl mtr + SUFFIXES = .sh .sh: From 2c2f39f7233572b99f81163338022e648716edf1 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Sep 2006 12:27:28 +0200 Subject: [PATCH 48/52] Turn off reorder as default --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index cb7d8a16b90..3d1bb2dce25 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -216,7 +216,7 @@ our $opt_embedded_server; our $opt_extern; our $opt_fast; our $opt_force; -our $opt_reorder= 1; +our $opt_reorder= 0; our $opt_enable_disabled; our $opt_gcov; From 6b71aaa2565962e9c6e0126634bf4eb57aad0672 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Sep 2006 16:51:37 +0200 Subject: [PATCH 49/52] Move test that requires innodb to "mysql_innodb" --- mysql-test/r/auto_increment.result | 46 ------------------------------ mysql-test/r/innodb_mysql.result | 46 ++++++++++++++++++++++++++++++ mysql-test/t/auto_increment.test | 36 ----------------------- mysql-test/t/innodb_mysql.test | 37 ++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 82 deletions(-) diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 1f13264ee55..54c2df34a7f 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -446,52 +446,6 @@ INSERT INTO t1 VALUES(1, 1); ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY' DROP TABLE t1; -CREATE TABLE `t2` ( -`k` int(11) NOT NULL auto_increment, -`a` int(11) default NULL, -`c` int(11) default NULL, -PRIMARY KEY (`k`), -UNIQUE KEY `idx_1` (`a`) -) ENGINE=InnoDB; -insert into t2 ( a ) values ( 6 ) on duplicate key update c = -ifnull( c, -0 ) + 1; -insert into t2 ( a ) values ( 7 ) on duplicate key update c = -ifnull( c, -0 ) + 1; -select last_insert_id(); -last_insert_id() -2 -select * from t2; -k a c -1 6 NULL -2 7 NULL -insert into t2 ( a ) values ( 6 ) on duplicate key update c = -ifnull( c, -0 ) + 1; -select last_insert_id(); -last_insert_id() -1 -select * from t2; -k a c -1 6 1 -2 7 NULL -insert ignore into t2 values (null,6,1),(10,8,1); -select last_insert_id(); -last_insert_id() -1 -insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); -select last_insert_id(); -last_insert_id() -11 -select * from t2; -k a c -1 6 1 -2 7 NULL -10 8 1 -11 15 1 -12 20 1 -drop table t2; create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c)); insert into t1 values(null,1,1,now()); insert into t1 values(null,0,0,null); diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 9f177e99a17..c5f3ed296e2 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -367,3 +367,49 @@ Warnings: Warning 1071 Specified key was too long; max key length is 765 bytes insert into t1 values('aaa'); drop table t1; +CREATE TABLE `t2` ( +`k` int(11) NOT NULL auto_increment, +`a` int(11) default NULL, +`c` int(11) default NULL, +PRIMARY KEY (`k`), +UNIQUE KEY `idx_1` (`a`) +) ENGINE=InnoDB; +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +insert into t2 ( a ) values ( 7 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +2 +select * from t2; +k a c +1 6 NULL +2 7 NULL +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +last_insert_id() +1 +select * from t2; +k a c +1 6 1 +2 7 NULL +insert ignore into t2 values (null,6,1),(10,8,1); +select last_insert_id(); +last_insert_id() +1 +insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); +select last_insert_id(); +last_insert_id() +11 +select * from t2; +k a c +1 6 1 +2 7 NULL +10 8 1 +11 15 1 +12 20 1 +drop table t2; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 7cef1bad784..f869dc06187 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -304,42 +304,6 @@ INSERT INTO t1 VALUES(1, 1); ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; DROP TABLE t1; -# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY -# UPDATE": now LAST_INSERT_ID() will return the id of the updated -# row. -CREATE TABLE `t2` ( - `k` int(11) NOT NULL auto_increment, - `a` int(11) default NULL, - `c` int(11) default NULL, - PRIMARY KEY (`k`), - UNIQUE KEY `idx_1` (`a`) -) ENGINE=InnoDB; - insert into t2 ( a ) values ( 6 ) on duplicate key update c = -ifnull( c, -0 ) + 1; -insert into t2 ( a ) values ( 7 ) on duplicate key update c = -ifnull( c, -0 ) + 1; -select last_insert_id(); -select * from t2; -insert into t2 ( a ) values ( 6 ) on duplicate key update c = -ifnull( c, -0 ) + 1; -select last_insert_id(); -select * from t2; - -# Test of LAST_INSERT_ID() when autogenerated will fail: -# last_insert_id() should not change -insert ignore into t2 values (null,6,1),(10,8,1); -select last_insert_id(); -# First and second autogenerated will fail, last_insert_id() should -# point to third -insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); -select last_insert_id(); -select * from t2; - -drop table t2; - # Test of REPLACE when it does INSERT+DELETE and not UPDATE: # see if it sets LAST_INSERT_ID() ok create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c)); diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 2be53b58a39..4c84dc2faee 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -320,3 +320,40 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb character set utf8 collate utf8_general_ci; insert into t1 values('aaa'); drop table t1; + +# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY +# UPDATE": now LAST_INSERT_ID() will return the id of the updated +# row. +CREATE TABLE `t2` ( + `k` int(11) NOT NULL auto_increment, + `a` int(11) default NULL, + `c` int(11) default NULL, + PRIMARY KEY (`k`), + UNIQUE KEY `idx_1` (`a`) +) ENGINE=InnoDB; + insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +insert into t2 ( a ) values ( 7 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +select * from t2; +insert into t2 ( a ) values ( 6 ) on duplicate key update c = +ifnull( c, +0 ) + 1; +select last_insert_id(); +select * from t2; + +# Test of LAST_INSERT_ID() when autogenerated will fail: +# last_insert_id() should not change +insert ignore into t2 values (null,6,1),(10,8,1); +select last_insert_id(); +# First and second autogenerated will fail, last_insert_id() should +# point to third +insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); +select last_insert_id(); +select * from t2; + +drop table t2; + From 73fe10d53811c21cbf87ff1e337ec749b87d3832 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Sep 2006 16:56:46 +0200 Subject: [PATCH 50/52] Turn on reorder as default. --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 3d1bb2dce25..cb7d8a16b90 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -216,7 +216,7 @@ our $opt_embedded_server; our $opt_extern; our $opt_fast; our $opt_force; -our $opt_reorder= 0; +our $opt_reorder= 1; our $opt_enable_disabled; our $opt_gcov; From 9e145670c41ee58bb4e707988a1b4c6f58dda0b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Sep 2006 21:53:23 +0200 Subject: [PATCH 51/52] mtr_cases.pl: Provide a more extensible, easier-to-change way of reordering test cases. mysql-test/lib/mtr_cases.pl: Provide a more extensible, easier-to-change way of reordering test cases. --- mysql-test/lib/mtr_cases.pl | 58 ++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index ed0395abd9d..009269f382e 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -82,7 +82,7 @@ sub collect_test_cases ($) { if ( $mysqld_test_exists and $im_test_exists ) { - mtr_error("Ambiguos test case name ($tname)"); + mtr_error("Ambiguous test case name ($tname)"); } elsif ( ! $mysqld_test_exists and ! $im_test_exists ) { @@ -154,34 +154,38 @@ sub collect_test_cases ($) { if ( $::opt_reorder ) { - @$cases = sort { - if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} ) - { - return $a->{'name'} cmp $b->{'name'}; - } - if ( $a->{'master_restart'} and $b->{'master_restart'} ) - { - my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'}); - if ( $cmp == 0 ) - { - return $a->{'name'} cmp $b->{'name'}; - } - else - { - return $cmp; - } - } + my %sort_criteria; + my $tinfo; - if ( $a->{'master_restart'} ) - { - return 1; # Is greater - } - else - { - return -1; # Is less - } - } @$cases; + # Make a mapping of test name to a string that represents how that test + # should be sorted among the other tests. Put the most important criterion + # first, then a sub-criterion, then sub-sub-criterion, et c. + foreach $tinfo (@$cases) + { + my @this_criteria = (); + + # Append the criteria for sorting, in order of importance. + push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled + push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0")); + push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0")); + push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0")); + push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME? + push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name + + $sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria); + } + + @$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases; + +### For debugging the sort-order +# foreach $tinfo (@$cases) +# { +# print $sort_criteria{$tinfo->{"name"}}; +# print " -> \t"; +# print $tinfo->{"name"}; +# print "\n"; +# } } return $cases; From 3c4e333d006758162e1912a2f5898640b7772967 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 2 Sep 2006 13:30:37 +0200 Subject: [PATCH 52/52] mysql-test-run.pl: 'reorder' default off until test cases fixed. mysql-test/mysql-test-run.pl: 'reorder' default off until test cases fixed. --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index cb7d8a16b90..3d1bb2dce25 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -216,7 +216,7 @@ our $opt_embedded_server; our $opt_extern; our $opt_fast; our $opt_force; -our $opt_reorder= 1; +our $opt_reorder= 0; our $opt_enable_disabled; our $opt_gcov;