From 4282ad92cb01dc8b4aad8e66829915492007da61 Mon Sep 17 00:00:00 2001 From: "pappa@c-5608e253.1238-1-64736c10.cust.bredbandsbolaget.se" <> Date: Tue, 8 Nov 2005 00:26:37 -0500 Subject: [PATCH 01/54] Bug #12796: Record lost in HEAP table Two handler objects were present, one was used for an insert and the other for a select The state of the statistics was local to the handler object and thus the other handler object didn't notice the insert. Fix included: 1) Add a new variable key_stat_version added to whenever statistics was considered in need of update (previously key_stats_ok= FALSE in those places) 2) Add a new handler variable key_stat_version assigned whenever key_stats_ok= TRUE was set previously 3) Fix records_in_range to return records if records <= 1 4) Fix records_in_range to add 2 to rec_per_key to ensure we don't specify 0 or 1 when it isn't and thus invoking incorrect optimisations. 5) Fix unique key handling for HEAP table in records_in_range --- heap/hp_create.c | 1 + include/heap.h | 1 + mysql-test/r/heap.result | 12 +++++++++++- mysql-test/t/heap.test | 11 +++++++++++ mysql-test/t/test_heap.test | 20 +++++++++++++++++++ sql/ha_heap.cc | 38 ++++++++++++++++++++++++------------- sql/ha_heap.h | 4 ++-- 7 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 mysql-test/t/test_heap.test diff --git a/heap/hp_create.c b/heap/hp_create.c index 2b811dac89b..acd4447fe5c 100644 --- a/heap/hp_create.c +++ b/heap/hp_create.c @@ -104,6 +104,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, DBUG_RETURN(1); } share->keydef= (HP_KEYDEF*) (share + 1); + share->key_stat_version= 1; keyseg= (HA_KEYSEG*) (share->keydef + keys); init_block(&share->block, reclength + 1, min_records, max_records); /* Fix keys */ diff --git a/include/heap.h b/include/heap.h index badec9ce2ef..cfbb6113f86 100644 --- a/include/heap.h +++ b/include/heap.h @@ -136,6 +136,7 @@ typedef struct st_heap_share HP_KEYDEF *keydef; ulong min_records,max_records; /* Params to open */ ulong data_length,index_length,max_table_size; + uint key_stat_version; /* version to indicate insert/delete */ uint records; /* records */ uint blength; /* records rounded up to 2^n */ uint deleted; /* Deleted records in database */ diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 53dec294ef8..e3b9f7db984 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where +1 SIMPLE t1 ref a a 5 const 2 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 @@ -296,3 +296,13 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 drop table t1; +CREATE TABLE t1 (a int, key(a)) engine=heap; +insert delayed into t1 values (0); +delete from t1; +select * from t1; +a +insert delayed into t1 values (0), (1); +select * from t1 where a = 0; +a +0 +drop table t1; diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index 270b8a1df6f..a8128b79e3b 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -234,4 +234,15 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); drop table t1; +# +# Bug 12796: Record doesn't show when selecting through index +# +CREATE TABLE t1 (a int, key(a)) engine=heap; +insert delayed into t1 values (0); +delete from t1; +select * from t1; +insert delayed into t1 values (0), (1); +select * from t1 where a = 0; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/test_heap.test b/mysql-test/t/test_heap.test new file mode 100644 index 00000000000..851c376ba38 --- /dev/null +++ b/mysql-test/t/test_heap.test @@ -0,0 +1,20 @@ +# +# Test of heap tables. +# + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Bug 12796: Record doesn't show when selecting through index +# +CREATE TABLE t1 (a int, key(a)) engine=heap; +insert delayed into t1 values (0); +delete from t1; +select * from t1; +insert delayed into t1 values (0), (1); +select * from t1 where a = 0; +drop table t1; + +# End of 4.1 tests diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index f8c2e6cc338..61e5ce89693 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -68,7 +68,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) ha_heap::info(), which is always called before key statistics are used. */ - key_stats_ok= FALSE; + key_stat_version= file->s->key_stat_version-1; } return (file ? 0 : 1); } @@ -114,14 +114,21 @@ void ha_heap::update_key_stats() continue; if (key->algorithm != HA_KEY_ALG_BTREE) { - ha_rows hash_buckets= file->s->keydef[i].hash_buckets; - key->rec_per_key[key->key_parts-1]= - hash_buckets ? file->s->records/hash_buckets : 0; + if (key->flags & HA_NOSAME) + key->rec_per_key[key->key_parts-1]= 1; + else + { + ha_rows hash_buckets= file->s->keydef[i].hash_buckets; + uint no_records= hash_buckets ? file->s->records/hash_buckets : 2; + if (no_records < 2) + no_records= 2; + key->rec_per_key[key->key_parts-1]= no_records; + } } } records_changed= 0; /* At the end of update_key_stats() we can proudly claim they are OK. */ - key_stats_ok= TRUE; + key_stat_version= file->s->key_stat_version; } int ha_heap::write_row(byte * buf) @@ -135,7 +142,7 @@ int ha_heap::write_row(byte * buf) res= heap_write(file,buf); if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) - key_stats_ok= FALSE; + file->s->key_stat_version++; return res; } @@ -148,7 +155,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data) res= heap_update(file,old_data,new_data); if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) - key_stats_ok= FALSE; + file->s->key_stat_version++; return res; } @@ -159,7 +166,7 @@ int ha_heap::delete_row(const byte * buf) res= heap_delete(file,buf); if (!res && table->tmp_table == NO_TMP_TABLE && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) - key_stats_ok= FALSE; + file->s->key_stat_version++; return res; } @@ -277,7 +284,7 @@ void ha_heap::info(uint flag) have to update the key statistics. Hoping that a table lock is now in place. */ - if (! key_stats_ok) + if (key_stat_version != file->s->key_stat_version) update_key_stats(); } @@ -290,7 +297,7 @@ int ha_heap::delete_all_rows() { heap_clear(file); if (table->tmp_table == NO_TMP_TABLE) - key_stats_ok= FALSE; + file->s->key_stat_version++; return 0; } @@ -451,9 +458,14 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key, return HA_POS_ERROR; // Can only use exact keys else { - /* Assert that info() did run. We need current statistics here. */ - DBUG_ASSERT(key_stats_ok); - return key->rec_per_key[key->key_parts-1]; + if (records <= 1) + return records; + else + { + /* Assert that info() did run. We need current statistics here. */ + DBUG_ASSERT(key_stat_version == file->s->key_stat_version); + return key->rec_per_key[key->key_parts-1]; + } } } diff --git a/sql/ha_heap.h b/sql/ha_heap.h index cbe2474492d..0a087fde1b0 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -29,10 +29,10 @@ class ha_heap: public handler key_map btree_keys; /* number of records changed since last statistics update */ uint records_changed; - bool key_stats_ok; + uint key_stat_version; public: ha_heap(TABLE *table): handler(table), file(0), records_changed(0), - key_stats_ok(0) {} + key_stat_version(0) {} ~ha_heap() {} const char *table_type() const { return "HEAP"; } const char *index_type(uint inx) From 9cae8626231ccfb2183976e17db4a2caa749844b Mon Sep 17 00:00:00 2001 From: "pappa@c-5608e253.1238-1-64736c10.cust.bredbandsbolaget.se" <> Date: Tue, 22 Nov 2005 12:58:55 -0500 Subject: [PATCH 02/54] Changed report of records to 2 from 1 previously in records_in_range in certain situations causes change of test behaviour --- mysql-test/r/heap_hash.result | 20 ++++++++++---------- mysql-test/r/myisam.result | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index e5098ab8c87..11b280997e5 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where +1 SIMPLE t1 ref a a 5 const 2 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 @@ -220,16 +220,16 @@ insert into t1 values ('aaag', 'prefill-hash=3',0); insert into t1 values ('aaah', 'prefill-hash=6',0); explain select * from t1 where a='aaaa'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where explain select * from t1 where a='aaab'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where explain select * from t1 where a='aaac'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where explain select * from t1 where a='aaad'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where insert into t1 select * from t1; flush tables; explain select * from t1 where a='aaaa'; @@ -291,25 +291,25 @@ insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'), insert into t2 select * from t1; explain select * from t1 where name='matt'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where explain select * from t2 where name='matt'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where explain select * from t1 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where explain select * from t2 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where explain select * from t1 where name='Phil'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where explain select * from t2 where name='Phil'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where explain select * from t1 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where explain select * from t2 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where @@ -364,5 +364,5 @@ a 3 explain select a from t1 where a in (1,3); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where +1 SIMPLE t1 range a a 5 NULL 4 Using where drop table t1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index d2d0417f6e6..c269cbadca3 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -554,7 +554,7 @@ Warnings: Note 1031 Table storage engine for 't1' doesn't have this option show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 a 1 a NULL 1000 NULL NULL YES HASH +t1 1 a 1 a NULL 500 NULL NULL YES HASH drop table t1,t2; create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); insert into t1 values (null,''), (null,''); From ba9c2ccae71885fecaa8fa1faa7cdcf2c14e5f2c Mon Sep 17 00:00:00 2001 From: "pappa@c-5608e253.1238-1-64736c10.cust.bredbandsbolaget.se" <> Date: Tue, 22 Nov 2005 13:04:51 -0500 Subject: [PATCH 03/54] Delete: mysql-test/t/test_heap.test --- mysql-test/t/test_heap.test | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 mysql-test/t/test_heap.test diff --git a/mysql-test/t/test_heap.test b/mysql-test/t/test_heap.test deleted file mode 100644 index 851c376ba38..00000000000 --- a/mysql-test/t/test_heap.test +++ /dev/null @@ -1,20 +0,0 @@ -# -# Test of heap tables. -# - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug 12796: Record doesn't show when selecting through index -# -CREATE TABLE t1 (a int, key(a)) engine=heap; -insert delayed into t1 values (0); -delete from t1; -select * from t1; -insert delayed into t1 values (0), (1); -select * from t1 where a = 0; -drop table t1; - -# End of 4.1 tests From 45db1c24b06517b8ead23af9b455daf9db5ebe44 Mon Sep 17 00:00:00 2001 From: "gvb@phoenix.(none)" <> Date: Fri, 13 Jan 2006 14:42:46 +0100 Subject: [PATCH 04/54] fix for bug#15828 problem was not checking 2nd parameter of str_to_date against NULL --- mysql-test/r/date_formats.result | 6 ++++++ mysql-test/t/date_formats.test | 7 +++++++ sql/item_timefunc.cc | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 34a2dedd976..b2dc1f7a67b 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -464,3 +464,9 @@ d1 d2 02 February 01 January drop table t1; +select str_to_date( 1, NULL ); +str_to_date( 1, NULL ) +NULL +select str_to_date( NULL, 1 ); +str_to_date( NULL, 1 ) +NULL diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index 6d501865d2c..dd31f1509c0 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -268,4 +268,11 @@ insert into t1 (f1) values ("2005-01-01"); insert into t1 (f1) values ("2005-02-01"); select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M"); drop table t1; + +# +# Bug #15828 +# +select str_to_date( 1, NULL ); +select str_to_date( NULL, 1 ); + # End of 4.1 tests diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index eb58b180ed7..d060612c9f6 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2750,7 +2750,7 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; - if ((const_item= args[1]->const_item())) + if ((const_item= args[1]->const_item()) && !args[1]->null_value) { format= args[1]->val_str(&format_str); cached_format_type= get_date_time_result_type(format->ptr(), From 421eededd316ef07b14f06a9bfd36e1f19b35d5b Mon Sep 17 00:00:00 2001 From: "gvb@phoenix.(none)" <> Date: Sat, 14 Jan 2006 09:53:12 +0100 Subject: [PATCH 05/54] item_timefunc.cc: fix for bug#15828 after review --- sql/item_timefunc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index d060612c9f6..be8c5d2ad15 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2750,7 +2750,8 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; - if ((const_item= args[1]->const_item()) && !args[1]->null_value) + if (!args[1]->null_value && (const_item= args[1]->const_item())) + //if ((const_item= args[1]->const_item()) && !args[1]->null_value) { format= args[1]->val_str(&format_str); cached_format_type= get_date_time_result_type(format->ptr(), From 8885c80da2cf5d8ac852ecbc289c62f8a5c3ff69 Mon Sep 17 00:00:00 2001 From: "gvb@phoenix.(none)" <> Date: Sat, 14 Jan 2006 16:06:51 +0100 Subject: [PATCH 06/54] item_timefunc.cc: fix for bug #15828 after review --- sql/item_timefunc.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index be8c5d2ad15..b5a9064c960 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2751,7 +2751,6 @@ void Item_func_str_to_date::fix_length_and_dec() max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; if (!args[1]->null_value && (const_item= args[1]->const_item())) - //if ((const_item= args[1]->const_item()) && !args[1]->null_value) { format= args[1]->val_str(&format_str); cached_format_type= get_date_time_result_type(format->ptr(), From 8c69d6abaf9eaf731e7e589b2c3c498543003101 Mon Sep 17 00:00:00 2001 From: "gvb@phoenix.(none)" <> Date: Mon, 16 Jan 2006 15:46:37 +0100 Subject: [PATCH 07/54] date_formats.test: fix for bug #15828 after review doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values --- mysql-test/r/date_formats.result | 3 +++ mysql-test/t/date_formats.test | 2 +- sql/item_timefunc.cc | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index b2dc1f7a67b..014eeed27e7 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -470,3 +470,6 @@ NULL select str_to_date( NULL, 1 ); str_to_date( NULL, 1 ) NULL +select str_to_date( 1, IF(1=1,NULL,NULL) ); +str_to_date( 1, IF(1=1,NULL,NULL) ) +NULL diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index dd31f1509c0..78b4482a94a 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -274,5 +274,5 @@ drop table t1; # select str_to_date( 1, NULL ); select str_to_date( NULL, 1 ); - +select str_to_date( 1, IF(1=1,NULL,NULL) ); # End of 4.1 tests diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index b5a9064c960..d6b57464d59 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2750,9 +2750,9 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; + format= args[1]->val_str(&format_str); if (!args[1]->null_value && (const_item= args[1]->const_item())) { - format= args[1]->val_str(&format_str); cached_format_type= get_date_time_result_type(format->ptr(), format->length()); switch (cached_format_type) { From 4e931d3c458fa453e9def7ce0190beab305569c7 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Wed, 18 Jan 2006 13:48:57 +0200 Subject: [PATCH 08/54] Excluded posibility of tmp_table_param.copy_field double deletion (BUG#14851). --- mysql-test/r/kill.result | 14 +++++++++++- mysql-test/t/kill.test | 49 +++++++++++++++++++++++++++++++++++++++- sql/sql_class.cc | 3 +++ sql/sql_select.cc | 14 ++++++++++++ sql/sql_select.h | 11 +++++++-- 5 files changed, 87 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index ba9ba2833f6..828c7fcf9b0 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1, t2, t3; create table t1 (kill_id int); insert into t1 values(connection_id()); select ((@id := kill_id) - kill_id) from t1; @@ -17,3 +17,15 @@ select 4; 4 4 drop table t1; +create table t1 (id int primary key); +create table t2 (id int unsigned not null); +insert into t2 select id from t1; +create table t3 (kill_id int); +insert into t3 values(connection_id()); + select id from t1 where id in (select distinct id from t2); +select ((@id := kill_id) - kill_id) from t3; +((@id := kill_id) - kill_id) +0 +kill @id; +ERROR 08S01: Server shutdown in progress +drop table t1, t2, t3; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index aada8dd2ef3..ebe4673beb3 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -12,7 +12,7 @@ connect (con2, localhost, root,,); #remember id of con1 connection con1; --disable_warnings -drop table if exists t1; +drop table if exists t1, t2, t3; --enable_warnings create table t1 (kill_id int); @@ -40,4 +40,51 @@ connection con2; select 4; drop table t1; +disconnect con2; +connection default; +# +# BUG#14851: killing long running subquery processed via a temporary table. +# +create table t1 (id int primary key); +create table t2 (id int unsigned not null); + +connect (conn1, localhost, root,,); +connection conn1; + +-- disable_result_log +-- disable_query_log +let $1 = 4096; +while ($1) +{ + eval insert into t1 values ($1); + dec $1; +} +-- enable_query_log +-- enable_result_log + +insert into t2 select id from t1; + +create table t3 (kill_id int); +insert into t3 values(connection_id()); + +-- disable_result_log +send select id from t1 where id in (select distinct id from t2); +-- enable_result_log + +connect (conn2, localhost, root,,); +connection conn2; +select ((@id := kill_id) - kill_id) from t3; +-- sleep 1 +kill @id; + +connection conn1; +-- error 1053 +reap; + +disconnect conn1; +disconnect conn2; +connection default; + +drop table t1, t2, t3; + # End of 4.1 tests diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 947da6b10d6..cdce9b6c7bc 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1681,7 +1681,10 @@ bool select_dumpvar::send_eof() void TMP_TABLE_PARAM::init() { + DBUG_ENTER("TMP_TABLE_PARAM::init"); + DBUG_PRINT("enter", ("this: 0x%lx", (ulong)this)); field_count= sum_func_count= func_count= hidden_field_count= 0; group_parts= group_length= group_null_parts= 0; quick_group= 1; + DBUG_VOID_RETURN; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5ef3f4d9fda..aca2c72f1ea 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4107,6 +4107,20 @@ JOIN::join_free(bool full) problems in free_elements() as some of the elements are then deleted. */ tmp_table_param.copy_funcs.empty(); + /* + If we have tmp_join and 'this' JOIN is not tmp_join and + tmp_table_param.copy_field's of them are equal then we have to remove + pointer to tmp_table_param.copy_field from tmp_join, because it qill + be removed in tmp_table_param.cleanup(). + */ + if (tmp_join && + tmp_join != this && + tmp_join->tmp_table_param.copy_field == + tmp_table_param.copy_field) + { + tmp_join->tmp_table_param.copy_field= + tmp_join->tmp_table_param.save_copy_field= 0; + } tmp_table_param.cleanup(); } DBUG_VOID_RETURN; diff --git a/sql/sql_select.h b/sql/sql_select.h index 636ee967645..94cc8839466 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -227,7 +227,14 @@ class JOIN :public Sql_alloc { init(thd_arg, fields_arg, select_options_arg, result_arg); } - + + JOIN(JOIN &join) + :fields_list(join.fields_list) + { + init(join.thd, join.fields_list, join.select_options, + join.result); + } + void init(THD *thd_arg, List &fields_arg, ulong select_options_arg, select_result *result_arg) { @@ -272,7 +279,7 @@ class JOIN :public Sql_alloc fields_list= fields_arg; bzero((char*) &keyuse,sizeof(keyuse)); - tmp_table_param.copy_field=0; + tmp_table_param.init(); tmp_table_param.end_write_records= HA_POS_ERROR; rollup.state= ROLLUP::STATE_NONE; } From b1967ad723dd9f213099393aad13f1adec6cdc08 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Mon, 23 Jan 2006 21:51:32 +0300 Subject: [PATCH 09/54] Fixed bug #16510: Updating field named like '*name' caused server crash. When setup_fields() function finds field named '*' it expands it to the list of all table fields. It does so by checking that the first char of field_name is '*', but it doesn't checks that the '* is the only char. Due to this, when updating table with a field named like '*name', such field is wrongly treated as '*' and expanded. This leads to making list of fields to update being longer than list of the new values. Later, the fill_record() function crashes by dereferencing null when there is left fields to update, but no more values. Added check in the setup_fields() function which ensures that the field expanding will be done only when '*' is the only char in the field name. --- mysql-test/r/update.result | 4 ++++ mysql-test/t/update.test | 8 ++++++++ sql/sql_base.cc | 1 + 3 files changed, 13 insertions(+) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 9ca92fe75df..46cf2d161ef 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -216,3 +216,7 @@ select * from t1; a b 0 2 drop table t1; +create table t1(f1 int, `*f2` int); +insert into t1 values (1,1); +update t1 set `*f2`=1; +drop table t1; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 6c7b450f763..fcd17dc75f0 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -174,3 +174,11 @@ insert into t1 values (0, '1'); update t1 set b = b + 1 where a = 0; select * from t1; drop table t1; + +# +# Bug #16510 Updating field named like '*name' caused server crash +# +create table t1(f1 int, `*f2` int); +insert into t1 values (1,1); +update t1 set `*f2`=1; +drop table t1; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 4f52904a61e..42a2e692d21 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1983,6 +1983,7 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List &fields, */ if (item->type() == Item::FIELD_ITEM && ((Item_field*) item)->field_name[0] == '*' && + ((Item_field*) item)->field_name[1] == 0 && !((Item_field*) item)->field) { uint elem=fields.elements; From f60a763208713ce4d7a932d7ca19fee2351aed5c Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Wed, 25 Jan 2006 15:11:49 +0100 Subject: [PATCH 10/54] Fixed BUG#15737: Stored procedure optimizer bug with LEAVE Second version. The problem was that the optimizer didn't work correctly with forwards jumps to "no-op" hpop and cpop instructions. Don't generate "no-op" instructions (hpop 0 and cpop 0), it isn't actually necessary. --- mysql-test/r/sp-code.result | 139 +++++++++++++++++++++++++++++++++++ mysql-test/t/sp-code.test | 143 ++++++++++++++++++++++++++++++++++++ sql/sp_head.cc | 21 +++--- sql/sp_head.h | 40 +++++----- sql/sql_yacc.yy | 17 ++--- 5 files changed, 321 insertions(+), 39 deletions(-) diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index 943471c2261..c9fe170dda6 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -1,3 +1,5 @@ +drop procedure if exists empty; +drop procedure if exists code_sample; create procedure empty() begin end; @@ -60,3 +62,140 @@ Pos Instruction 20 cpop 1 21 stmt 0 "select t.name, t.idx from t2 t order ..." drop procedure code_sample; +drop procedure if exists sudoku_solve; +create procedure sudoku_solve(p_naive boolean, p_all boolean) +deterministic +modifies sql data +begin +drop temporary table if exists sudoku_work, sudoku_schedule; +create temporary table sudoku_work +( +row smallint not null, +col smallint not null, +dig smallint not null, +cnt smallint, +key using btree (cnt), +key using btree (row), +key using btree (col), +unique key using hash (row,col) +); +create temporary table sudoku_schedule +( +idx int not null auto_increment primary key, +row smallint not null, +col smallint not null +); +call sudoku_init(); +if p_naive then +update sudoku_work set cnt = 0 where dig = 0; +else +call sudoku_count(); +end if; +insert into sudoku_schedule (row,col) +select row,col from sudoku_work where cnt is not null order by cnt desc; +begin +declare v_scounter bigint default 0; +declare v_i smallint default 1; +declare v_dig smallint; +declare v_schedmax smallint; +select count(*) into v_schedmax from sudoku_schedule; +more: +loop +begin +declare v_tcounter bigint default 0; +sched: +while v_i <= v_schedmax do +begin +declare v_row, v_col smallint; +select row,col into v_row,v_col from sudoku_schedule where v_i = idx; +select dig into v_dig from sudoku_work +where v_row = row and v_col = col; +case v_dig +when 0 then +set v_dig = 1; +update sudoku_work set dig = 1 +where v_row = row and v_col = col; +when 9 then +if v_i > 0 then +update sudoku_work set dig = 0 +where v_row = row and v_col = col; +set v_i = v_i - 1; +iterate sched; +else +select v_scounter as 'Solutions'; +leave more; +end if; +else +set v_dig = v_dig + 1; +update sudoku_work set dig = v_dig +where v_row = row and v_col = col; +end case; +set v_tcounter = v_tcounter + 1; +if not sudoku_digit_ok(v_row, v_col, v_dig) then +iterate sched; +end if; +set v_i = v_i + 1; +end; +end while sched; +select dig from sudoku_work; +select v_tcounter as 'Tests'; +set v_scounter = v_scounter + 1; +if p_all and v_i > 0 then +set v_i = v_i - 1; +else +leave more; +end if; +end; +end loop more; +end; +drop temporary table sudoku_work, sudoku_schedule; +end// +show procedure code sudoku_solve; +Pos Instruction +0 stmt 9 "drop temporary table if exists sudoku..." +1 stmt 1 "create temporary table sudoku_work ( ..." +2 stmt 1 "create temporary table sudoku_schedul..." +3 stmt 95 "call sudoku_init(" +4 jump_if_not 7(8) p_naive@0 +5 stmt 4 "update sudoku_work set cnt = 0 where ..." +6 jump 8 +7 stmt 95 "call sudoku_count(" +8 stmt 6 "insert into sudoku_schedule (row,col)..." +9 set v_scounter@2 0 +10 set v_i@3 1 +11 set v_dig@4 NULL +12 set v_schedmax@5 NULL +13 stmt 0 "select count(*) into v_schedmax from ..." +14 set v_tcounter@6 0 +15 jump_if_not 39(39) (v_i@3 <= v_schedmax@5) +16 set v_row@7 NULL +17 set v_col@8 NULL +18 stmt 0 "select row,col into v_row,v_col from ..." +19 stmt 0 "select dig into v_dig from sudoku_wor..." +20 set_case_expr 0 v_dig@4 +21 jump_if_not 25(34) (case_expr@0 = 0) +22 set v_dig@4 1 +23 stmt 4 "update sudoku_work set dig = 1 where ..." +24 jump 34 +25 jump_if_not 32(34) (case_expr@0 = 9) +26 jump_if_not 30(34) (v_i@3 > 0) +27 stmt 4 "update sudoku_work set dig = 0 where ..." +28 set v_i@3 (v_i@3 - 1) +29 jump 15 +30 stmt 0 "select v_scounter as 'Solutions'" +31 jump 45 +32 set v_dig@4 (v_dig@4 + 1) +33 stmt 4 "update sudoku_work set dig = v_dig wh..." +34 set v_tcounter@6 (v_tcounter@6 + 1) +35 jump_if_not 37(37) not(`test`.`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)) +36 jump 15 +37 set v_i@3 (v_i@3 + 1) +38 jump 15 +39 stmt 0 "select dig from sudoku_work" +40 stmt 0 "select v_tcounter as 'Tests'" +41 set v_scounter@2 (v_scounter@2 + 1) +42 jump_if_not 45(14) (p_all@1 and (v_i@3 > 0)) +43 set v_i@3 (v_i@3 - 1) +44 jump 14 +45 stmt 9 "drop temporary table sudoku_work, sud..." +drop procedure sudoku_solve; diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index 6644bc3ab43..b7b1fdbbb20 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -4,6 +4,11 @@ -- source include/is_debug_build.inc +--disable_warnings +drop procedure if exists empty; +drop procedure if exists code_sample; +--enable_warnings + create procedure empty() begin end; @@ -47,3 +52,141 @@ end// delimiter ;// show procedure code code_sample; drop procedure code_sample; + + +# +# BUG#15737: Stored procedure optimizer bug with LEAVE +# +# This is a much more extensive test case than is strictly needed, +# but it was kept as is for two reasons: +# - The bug occurs under some quite special circumstances, so it +# wasn't trivial to create a smaller test, +# - There's some value in having another more complex code sample +# in this test file. This might catch future code generation bugs +# that doesn't not show in behaviour in any obvious way. + +--disable_warnings +drop procedure if exists sudoku_solve; +--enable_warnings + +delimiter //; +create procedure sudoku_solve(p_naive boolean, p_all boolean) + deterministic + modifies sql data +begin + drop temporary table if exists sudoku_work, sudoku_schedule; + + create temporary table sudoku_work + ( + row smallint not null, + col smallint not null, + dig smallint not null, + cnt smallint, + key using btree (cnt), + key using btree (row), + key using btree (col), + unique key using hash (row,col) + ); + + create temporary table sudoku_schedule + ( + idx int not null auto_increment primary key, + row smallint not null, + col smallint not null + ); + + call sudoku_init(); + + if p_naive then + update sudoku_work set cnt = 0 where dig = 0; + else + call sudoku_count(); + end if; + insert into sudoku_schedule (row,col) + select row,col from sudoku_work where cnt is not null order by cnt desc; + + begin + declare v_scounter bigint default 0; + declare v_i smallint default 1; + declare v_dig smallint; + declare v_schedmax smallint; + + select count(*) into v_schedmax from sudoku_schedule; + + more: + loop + begin + declare v_tcounter bigint default 0; + + sched: + while v_i <= v_schedmax do + begin + declare v_row, v_col smallint; + + select row,col into v_row,v_col from sudoku_schedule where v_i = idx; + + select dig into v_dig from sudoku_work + where v_row = row and v_col = col; + + case v_dig + when 0 then + set v_dig = 1; + update sudoku_work set dig = 1 + where v_row = row and v_col = col; + when 9 then + if v_i > 0 then + update sudoku_work set dig = 0 + where v_row = row and v_col = col; + set v_i = v_i - 1; + iterate sched; + else + select v_scounter as 'Solutions'; + leave more; + end if; + else + set v_dig = v_dig + 1; + update sudoku_work set dig = v_dig + where v_row = row and v_col = col; + end case; + + set v_tcounter = v_tcounter + 1; + if not sudoku_digit_ok(v_row, v_col, v_dig) then + iterate sched; + end if; + set v_i = v_i + 1; + end; + end while sched; + + select dig from sudoku_work; + select v_tcounter as 'Tests'; + set v_scounter = v_scounter + 1; + + if p_all and v_i > 0 then + set v_i = v_i - 1; + else + leave more; + end if; + end; + end loop more; + end; + + drop temporary table sudoku_work, sudoku_schedule; +end// +delimiter ;// + +# The interestings parts are where the code for the two "leave" are: +# ... +#| 26 | jump_if_not 30 (v_i@3 > 0) | +# ... +#| 30 | stmt 0 "select v_scounter as 'Solutions'" | +#| 31 | jump 45 | +# ... +#| 42 | jump_if_not 45 (p_all@1 and (v_i@3 > 0)) | +#| 43 | set v_i@3 (v_i@3 - 1) | +#| 44 | jump 14 | +#| 45 | stmt 9 "drop temporary table sudoku_work, sud..." | +#+-----+-----------------------------------------------------------------------+ +# The bug appeared at position 42 (with the wrong destination). +show procedure code sudoku_solve; + +drop procedure sudoku_solve; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ae27b910304..173c35328b1 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2011,6 +2011,15 @@ sp_head::show_create_function(THD *thd) 1) Mark used instructions 1.1) While doing this, shortcut jumps to jump instructions 2) Compact the code, removing unused instructions + + This is the main mark and move loop; it relies on the following methods + in sp_instr and its subclasses: + + opt_mark() Mark instruction as reachable (will recurse for jumps) + opt_shortcut_jump() Shortcut jumps to the final destination; + used by opt_mark(). + opt_move() Update moved instruction + set_destination() Set the new destination (jump instructions only) */ void sp_head::optimize() @@ -2703,12 +2712,6 @@ sp_instr_hpop::print(String *str) str->qs_append(m_count); } -void -sp_instr_hpop::backpatch(uint dest, sp_pcontext *dst_ctx) -{ - m_count= m_ctx->diff_handlers(dst_ctx); -} - /* sp_instr_hreturn class functions @@ -2830,12 +2833,6 @@ sp_instr_cpop::print(String *str) str->qs_append(m_count); } -void -sp_instr_cpop::backpatch(uint dest, sp_pcontext *dst_ctx) -{ - m_count= m_ctx->diff_cursors(dst_ctx); -} - /* sp_instr_copen class functions diff --git a/sql/sp_head.h b/sql/sp_head.h index 858bf523a07..89e86badc09 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -461,17 +461,34 @@ public: virtual void backpatch(uint dest, sp_pcontext *dst_ctx) {} + /* + Mark this instruction as reachable during optimization and return the + index to the next instruction. Jump instruction will mark their + destination too recursively. + */ virtual uint opt_mark(sp_head *sp) { marked= 1; return m_ip+1; } + /* + Short-cut jumps to jumps during optimization. This is used by the + jump instructions' opt_mark() methods. 'start' is the starting point, + used to prevent the mark sweep from looping for ever. Return the + end destination. + */ virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) { return m_ip; } + /* + Inform the instruction that it has been moved during optimization. + Most instructions will simply update its index, but jump instructions + must also take care of their destination pointers. Forward jumps get + pushed to the backpatch list 'ibp'. + */ virtual void opt_move(uint dst, List *ibp) { m_ip= dst; @@ -696,6 +713,9 @@ public: m_dest= dest; } + /* + Update the destination; used by the optimizer. + */ virtual void set_destination(uint old_dest, uint new_dest) { if (m_dest == old_dest) @@ -739,6 +759,7 @@ public: virtual uint opt_mark(sp_head *sp); + /* Override sp_instr_jump's shortcut; we stop here */ virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) { return m_ip; @@ -822,6 +843,7 @@ public: virtual uint opt_mark(sp_head *sp); + /* Override sp_instr_jump's shortcut; we stop here. */ virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) { return m_ip; @@ -859,15 +881,6 @@ public: virtual void print(String *str); - virtual void backpatch(uint dest, sp_pcontext *dst_ctx); - - virtual uint opt_mark(sp_head *sp) - { - if (m_count) - marked= 1; - return m_ip+1; - } - private: uint m_count; @@ -953,15 +966,6 @@ public: virtual void print(String *str); - virtual void backpatch(uint dest, sp_pcontext *dst_ctx); - - virtual uint opt_mark(sp_head *sp) - { - if (m_count) - marked= 1; - return m_ip+1; - } - private: uint m_count; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0ef389950fc..f41a8b7e979 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2064,17 +2064,16 @@ sp_proc_stmt: } else { - uint ip= sp->instructions(); sp_instr_jump *i; - sp_instr_hpop *ih; - sp_instr_cpop *ic; + uint ip= sp->instructions(); + uint n; - ih= new sp_instr_hpop(ip++, ctx, 0); - sp->push_backpatch(ih, lab); - sp->add_instr(ih); - ic= new sp_instr_cpop(ip++, ctx, 0); - sp->push_backpatch(ic, lab); - sp->add_instr(ic); + n= ctx->diff_handlers(lab->ctx); + if (n) + sp->add_instr(new sp_instr_hpop(ip++, ctx, n)); + n= ctx->diff_cursors(lab->ctx); + if (n) + sp->add_instr(new sp_instr_cpop(ip++, ctx, n)); i= new sp_instr_jump(ip, ctx); sp->push_backpatch(i, lab); /* Jumping forward */ sp->add_instr(i); From 998f0c0aa32116bf094d4e4ac407ee6c6a3a1629 Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Wed, 25 Jan 2006 17:19:54 +0100 Subject: [PATCH 11/54] Fixed BUGS#15011: error handler for mysql errno in nested block not activated For nested sql errno handlers (unlike sqlexception and other), we didn't stop searching when the innermost handler was found - now make sure we do. --- mysql-test/r/sp.result | 19 +++++++++++++++++++ mysql-test/t/sp.test | 31 +++++++++++++++++++++++++++++++ sql/sp_rcontext.cc | 3 ++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 904cd7d8642..90020573df3 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -4497,4 +4497,23 @@ drop procedure if exists bug15231_1| drop procedure if exists bug15231_2| drop procedure if exists bug15231_3| drop procedure if exists bug15231_4| +drop procedure if exists bug15011| +create table t3 (c1 int primary key)| +insert into t3 values (1)| +create procedure bug15011() +deterministic +begin +declare continue handler for 1062 +select 'Outer' as 'Handler'; +begin +declare continue handler for 1062 +select 'Inner' as 'Handler'; +insert into t3 values (1); +end; +end| +call bug15011()| +Handler +Inner +drop procedure bug15011| +drop table t3| drop table t1,t2; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 8235686a74a..32299ad7e0b 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -5283,6 +5283,37 @@ drop procedure if exists bug15231_3| drop procedure if exists bug15231_4| +# +# BUG#15011: error handler in nested block not activated +# +--disable_warnings +drop procedure if exists bug15011| +--enable_warnings + +create table t3 (c1 int primary key)| + +insert into t3 values (1)| + +create procedure bug15011() + deterministic +begin + declare continue handler for 1062 + select 'Outer' as 'Handler'; + + begin + declare continue handler for 1062 + select 'Inner' as 'Handler'; + + insert into t3 values (1); + end; +end| + +call bug15011()| + +drop procedure bug15011| +drop table t3| + + # # BUG#NNNN: New bug synopsis # diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 215de01e657..4818ffbbe31 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -188,7 +188,8 @@ sp_rcontext::find_handler(uint sql_errno, switch (cond->type) { case sp_cond_type_t::number: - if (sql_errno == cond->mysqlerr) + if (sql_errno == cond->mysqlerr && + (found < 0 || m_handler[found].cond->type > sp_cond_type_t::number)) found= i; // Always the most specific break; case sp_cond_type_t::state: From 5d0e8d81ee13ef4474266b74a12f98d18894a7e1 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Wed, 25 Jan 2006 23:25:23 +0300 Subject: [PATCH 12/54] BUG#15935: In mysql_update, don't use full index scan when we could have used quick select scan. --- mysql-test/r/update.result | 15 +++++++++++++++ mysql-test/t/update.test | 12 ++++++++++++ sql/sql_update.cc | 3 +-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 7854fd773a1..995c76615d3 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -358,3 +358,18 @@ update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1; affected rows: 3 info: Rows matched: 3 Changed: 3 Warnings: 0 drop table t1,t2; +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, filler1 char(200), filler2 char(200), key(a)); +insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B; +flush status; +update t2 set a=3 where a=2; +show status like 'handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_next 1 +Handler_read_prev 0 +Handler_read_rnd 1 +Handler_read_rnd_next 0 +drop table t1, t2; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 95adb40962c..55015075db7 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -287,4 +287,16 @@ update t1 set f1=1 where f1=3; update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1; --disable_info drop table t1,t2; + + +# BUG#15935 +create table t1 (a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, filler1 char(200), filler2 char(200), key(a)); +insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B; +flush status; +update t2 set a=3 where a=2; +show status like 'handler_read%'; +drop table t1, t2; + # End of 4.1 tests diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 24c7a278e79..edd16bb4bee 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -212,7 +212,6 @@ int mysql_update(THD *thd, SORT_FIELD *sortorder; ha_rows examined_rows; - used_index= MAX_KEY; // For call to init_read_record() table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), MYF(MY_FAE | MY_ZEROFILL)); if (!(sortorder=make_unireg_sortorder(order, &length)) || @@ -244,7 +243,7 @@ int mysql_update(THD *thd, DISK_BUFFER_SIZE, MYF(MY_WME))) goto err; - if (used_index == MAX_KEY) + if (used_index == MAX_KEY || (select && select->quick)) init_read_record(&info,thd,table,select,0,1); else init_read_record_idx(&info, thd, table, 1, used_index); From 6e984d6ede0a100edc5cf045d5e05e035c6a94e6 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Wed, 25 Jan 2006 23:28:39 +0300 Subject: [PATCH 13/54] sql_base.cc: Small fix after merge of fix for bug#16510 --- sql/sql_base.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9bc4008d86f..ea013bb4e1e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2390,7 +2390,6 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, if (item->type() == Item::FIELD_ITEM && ((Item_field*) item)->field_name && ((Item_field*) item)->field_name[0] == '*' && - ((Item_field*) item)->field_name[1] == 0 && !((Item_field*) item)->field) { uint elem= fields.elements; From 5c3027833b289d1cc222cd1cbae37909de5d7d64 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Thu, 26 Jan 2006 00:09:04 +0300 Subject: [PATCH 14/54] BUG#15935: post-review fixes: added comment --- sql/sql_update.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index edd16bb4bee..48a8cf93917 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -243,6 +243,16 @@ int mysql_update(THD *thd, DISK_BUFFER_SIZE, MYF(MY_WME))) goto err; + /* + When we get here, we have one of the following options: + A. used_index == MAX_KEY + This means we should use full table scan, and start it with + init_read_record call + B. used_index != MAX_KEY + B.1 quick select is used, start the scan with init_read_record + B.2 quick select is not used, this is full index scan (with LIMIT) + Full index scan must be started with init_read_record_idx + */ if (used_index == MAX_KEY || (select && select->quick)) init_read_record(&info,thd,table,select,0,1); else From 1c1b5f1f57fa78c2eea4121841e6de0cb368bfd9 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Thu, 26 Jan 2006 10:16:28 +0100 Subject: [PATCH 15/54] reserved config numbers in ndb --- ndb/include/mgmapi/mgmapi_config_parameters.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h index 2e3b47eb42e..9076f18c5ac 100644 --- a/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -85,6 +85,11 @@ #define CFG_DB_BACKUP_DATADIR 158 #define CFG_DB_MAX_OPEN_FILES 159 +#define CFG_DB_DISK_PAGE_BUFFER_MEMORY 160 /* used from 5.1 */ +#define CFG_DB_STRING_MEMORY 161 /* used from 5.1 */ +#define CFG_DB_INITIAL_OPEN_FILES 162 /* used from 5.1 */ + +#define CFG_DB_DATA_MEM_2 199 /* used in special build in 5.1 */ #define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_DELAY 201 From 2fbdc5483af6294f47e02bb7b722f986e092d381 Mon Sep 17 00:00:00 2001 From: "aelkin@mysql.com" <> Date: Thu, 26 Jan 2006 12:49:55 +0200 Subject: [PATCH 16/54] BUG#15699 importing the fix from 5.0 --- mysql-test/r/rpl_ignore_table.result | 16 +++++++++ mysql-test/r/rpl_multi_update4.result | 25 ++++++++++++++ mysql-test/t/rpl_multi_update4-slave.opt | 1 + mysql-test/t/rpl_multi_update4.test | 44 ++++++++++++++++++++++++ sql/sql_parse.cc | 15 +++++--- 5 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 mysql-test/r/rpl_ignore_table.result create mode 100644 mysql-test/r/rpl_multi_update4.result create mode 100644 mysql-test/t/rpl_multi_update4-slave.opt create mode 100644 mysql-test/t/rpl_multi_update4.test diff --git a/mysql-test/r/rpl_ignore_table.result b/mysql-test/r/rpl_ignore_table.result new file mode 100644 index 00000000000..356a9dcb2f8 --- /dev/null +++ b/mysql-test/r/rpl_ignore_table.result @@ -0,0 +1,16 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +**** Test case for BUG#16487 **** +**** Master **** +CREATE TABLE test.t4 (a int); +CREATE TABLE test.t1 (a int); +UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5; +**** Slave **** +SELECT * FROM t4; +a +DROP TABLE t1; +DROP TABLE t4; diff --git a/mysql-test/r/rpl_multi_update4.result b/mysql-test/r/rpl_multi_update4.result new file mode 100644 index 00000000000..f6dde65a35d --- /dev/null +++ b/mysql-test/r/rpl_multi_update4.result @@ -0,0 +1,25 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +drop database if exists d1; +drop database if exists d2; +drop database if exists d2; +create database d1; +create table d1.t0 (id int); +create database d2; +use d2; +create table t1 (id int); +create table t2 (id int); +insert into t1 values (1), (2), (3), (4), (5); +insert into t2 select id + 3 from t1; +update t1 join t2 using (id) set t1.id = 0; +insert into d1.t0 values (0); +use d1; +select * from t0 where id=0; +id +0 +drop database d1; +drop database d2; diff --git a/mysql-test/t/rpl_multi_update4-slave.opt b/mysql-test/t/rpl_multi_update4-slave.opt new file mode 100644 index 00000000000..fea27db43ee --- /dev/null +++ b/mysql-test/t/rpl_multi_update4-slave.opt @@ -0,0 +1 @@ +--replicate-wild-do-table=d1.% diff --git a/mysql-test/t/rpl_multi_update4.test b/mysql-test/t/rpl_multi_update4.test new file mode 100644 index 00000000000..3d909b8e5cd --- /dev/null +++ b/mysql-test/t/rpl_multi_update4.test @@ -0,0 +1,44 @@ +# Let's verify that multi-update is not always skipped by slave if +# some replicate-* rules exist. +# (BUG#15699) + +source include/master-slave.inc; + +### Clean-up + +connection master; +--disable_warnings +drop database if exists d1; +drop database if exists d2; + +connection slave; +drop database if exists d2; +--enable_warnings + +### Test + +connection master; +create database d1; # accepted by slave +create table d1.t0 (id int); +create database d2; # ignored by slave +use d2; +create table t1 (id int); +create table t2 (id int); +insert into t1 values (1), (2), (3), (4), (5); +insert into t2 select id + 3 from t1; +# a problematic query which must be filter out by slave +update t1 join t2 using (id) set t1.id = 0; +insert into d1.t0 values (0); # replication works + +sync_slave_with_master; +use d1; +#connection slave; +select * from t0 where id=0; # must find + +### Clean-up +connection master; +drop database d1; +drop database d2; + + +# End of test diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 90de630da60..1daa0a5ffec 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2840,21 +2840,26 @@ unsent_create_error: if ((res= multi_update_precheck(thd, tables))) break; - if ((res= mysql_multi_update_lock(thd, tables, &select_lex->item_list, - select_lex))) - break; - + res= mysql_multi_update_lock(thd, tables, &select_lex->item_list, + select_lex); #ifdef HAVE_REPLICATION /* Check slave filtering rules */ if (thd->slave_thread) if (all_tables_not_ok(thd,tables)) { + if (res!= 0) + { + res= 0; /* don't care of prev failure */ + thd->clear_error(); /* filters are of highest prior */ + } /* we warn the slave SQL thread */ my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); break; } #endif /* HAVE_REPLICATION */ - + if (res) + break; + res= mysql_multi_update(thd,tables, &select_lex->item_list, &lex->value_list, From 58346adcc9c6a92790f85e7fd73f3aeee5aa7c72 Mon Sep 17 00:00:00 2001 From: "aelkin@mysql.com" <> Date: Thu, 26 Jan 2006 12:51:34 +0200 Subject: [PATCH 17/54] BUG#16487 importing the test case from 5.0 (the fix is done in BUG#15699) --- mysql-test/t/rpl_ignore_table-slave.opt | 1 + mysql-test/t/rpl_ignore_table.test | 28 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 mysql-test/t/rpl_ignore_table-slave.opt create mode 100644 mysql-test/t/rpl_ignore_table.test diff --git a/mysql-test/t/rpl_ignore_table-slave.opt b/mysql-test/t/rpl_ignore_table-slave.opt new file mode 100644 index 00000000000..cb49119bfcb --- /dev/null +++ b/mysql-test/t/rpl_ignore_table-slave.opt @@ -0,0 +1 @@ +--replicate-ignore-table=test.t1 --replicate-ignore-table=test.t2 --replicate-ignore-table=test.t3 diff --git a/mysql-test/t/rpl_ignore_table.test b/mysql-test/t/rpl_ignore_table.test new file mode 100644 index 00000000000..bc651779208 --- /dev/null +++ b/mysql-test/t/rpl_ignore_table.test @@ -0,0 +1,28 @@ +source include/master-slave.inc; + +# +# BUG#16487 +# +# Requirement: +# Multi-updates on ignored tables should not fail even if the slave does +# not have the ignored tables. +# +# Note table t1, t2, and t3 are ignored in the option file to this test. +# + +--echo **** Test case for BUG#16487 **** +--echo **** Master **** +connection master; +CREATE TABLE test.t4 (a int); +CREATE TABLE test.t1 (a int); + +# Expect: The row must *not* by updated on slave, since t1 is ignored +UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5; + +--echo **** Slave **** +sync_slave_with_master; +SELECT * FROM t4; + +connection master; +DROP TABLE t1; +DROP TABLE t4; From 4ad32690afa89282ddbdbeeaf6510ca5aea1171c Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Fri, 27 Jan 2006 01:38:05 +0100 Subject: [PATCH 18/54] configure.in: Generated "libmysql.ver" will be in \$(top_builddir) --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 24d6900a5f9..d752061e11b 100644 --- a/configure.in +++ b/configure.in @@ -435,7 +435,7 @@ fi # libmysqlclient versioning when linked with GNU ld. if $LD --version 2>/dev/null|grep -q GNU; then - LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver" + LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver" AC_CONFIG_FILES(libmysql/libmysql.ver) fi AC_SUBST(LD_VERSION_SCRIPT) From 1318e790bcc33d578a307d8a0f372d3e369e55f9 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Fri, 27 Jan 2006 12:10:40 +0100 Subject: [PATCH 19/54] configure.in: Cloned off 4.1.18, new release number 4.1.19 --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index d752061e11b..b230b7f042e 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 4.1.18) +AM_INIT_AUTOMAKE(mysql, 4.1.19) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -17,7 +17,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=4 NDB_VERSION_MINOR=1 -NDB_VERSION_BUILD=18 +NDB_VERSION_BUILD=19 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? From 9c255c40257c0cc36688f3b102bb6fd82bba6b9e Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 27 Jan 2006 13:23:10 +0100 Subject: [PATCH 20/54] Enable kill test --- mysql-test/t/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index ddb79205357..3eae8d230d8 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -13,4 +13,3 @@ rpl_relayrotate : Unstable test case, bug#12429 rpl_until : Unstable test case, bug#12429 rpl_deadlock : Unstable test case, bug#12429 -kill : Unstable test case, bug#9712 From 173a8ad4eddff2b082cc096305d5c6c0225337af Mon Sep 17 00:00:00 2001 From: "pappa@c-5c0be253.1238-1-64736c10.cust.bredbandsbolaget.se" <> Date: Fri, 27 Jan 2006 12:44:33 -0500 Subject: [PATCH 21/54] Added comments to specify why no much mutex is needed. --- sql/ha_heap.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 61e5ce89693..ab0ab5d8b64 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -142,7 +142,13 @@ int ha_heap::write_row(byte * buf) res= heap_write(file,buf); if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) + { + /* + We can perform this safely since only one writer at the time is + allowed on the table. + */ file->s->key_stat_version++; + } return res; } @@ -155,7 +161,13 @@ int ha_heap::update_row(const byte * old_data, byte * new_data) res= heap_update(file,old_data,new_data); if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) + { + /* + We can perform this safely since only one writer at the time is + allowed on the table. + */ file->s->key_stat_version++; + } return res; } @@ -166,7 +178,13 @@ int ha_heap::delete_row(const byte * buf) res= heap_delete(file,buf); if (!res && table->tmp_table == NO_TMP_TABLE && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) + { + /* + We can perform this safely since only one writer at the time is + allowed on the table. + */ file->s->key_stat_version++; + } return res; } @@ -297,7 +315,13 @@ int ha_heap::delete_all_rows() { heap_clear(file); if (table->tmp_table == NO_TMP_TABLE) + { + /* + We can perform this safely since only one writer at the time is + allowed on the table. + */ file->s->key_stat_version++; + } return 0; } From 737084b22915b7ccc22064d8734fd142a6b4f1a2 Mon Sep 17 00:00:00 2001 From: "dlenev@mysql.com" <> Date: Sat, 28 Jan 2006 12:50:16 +0300 Subject: [PATCH 22/54] Fix for bug #16829 "Firing trigger with RETURN crashes the server" We should disallow usage of RETURN statement in triggers and emit error at parsing time (instead of crashing when trigger is fired). --- mysql-test/r/trigger.result | 5 +++++ mysql-test/t/trigger.test | 9 +++++++++ sql/sql_yacc.yy | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 9cfecde7610..ec63757df3a 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -785,3 +785,8 @@ create trigger test.t1_bi before insert on t1 for each row set @a:=0; ERROR 3D000: No database selected drop trigger t1_bi; ERROR 3D000: No database selected +create table t1 (i int); +create trigger t1_bi before insert on t1 for each row return 0; +ERROR 42000: RETURN is only allowed in a FUNCTION +insert into t1 values (1); +drop table t1; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index f2d9bb6c856..679698db4c0 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -958,3 +958,12 @@ create trigger test.t1_bi before insert on t1 for each row set @a:=0; --error ER_NO_DB_ERROR drop trigger t1_bi; connection default; + +# Test for bug #16829 "Firing trigger with RETURN crashes the server" +# RETURN is not supposed to be used anywhere except functions, so error +# should be returned when one attempts to create trigger with RETURN. +create table t1 (i int); +--error ER_SP_BADRETURN +create trigger t1_bi before insert on t1 for each row return 0; +insert into t1 values (1); +drop table t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0ef389950fc..055e5a9e908 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1981,7 +1981,7 @@ sp_proc_stmt: LEX *lex= Lex; sp_head *sp= lex->sphead; - if (sp->m_type == TYPE_ENUM_PROCEDURE) + if (sp->m_type != TYPE_ENUM_FUNCTION) { my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0)); YYABORT; From 67f34be9612566466b7ada3f56307a29512cb447 Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Mon, 30 Jan 2006 15:04:00 +0100 Subject: [PATCH 23/54] Post-review fix for BUG#15737 (corrected typo in sp-code.test comment) --- mysql-test/t/sp-code.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index b7b1fdbbb20..0a26ea644f6 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -63,7 +63,7 @@ drop procedure code_sample; # wasn't trivial to create a smaller test, # - There's some value in having another more complex code sample # in this test file. This might catch future code generation bugs -# that doesn't not show in behaviour in any obvious way. +# that doesn't show in behaviour in any obvious way. --disable_warnings drop procedure if exists sudoku_solve; From 7e5108392d72aa755174da8f56dc42ccd1b82ee6 Mon Sep 17 00:00:00 2001 From: "pekka@mysql.com" <> Date: Tue, 31 Jan 2006 08:13:42 +0100 Subject: [PATCH 24/54] ndb - testBlobs 'perf test' fix --- ndb/test/ndbapi/testBlobs.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp index efbdceac5a6..cd2287df876 100644 --- a/ndb/test/ndbapi/testBlobs.cpp +++ b/ndb/test/ndbapi/testBlobs.cpp @@ -1488,13 +1488,16 @@ testperf() // insert char (one trans) { DBG("--- insert char ---"); + char b[20]; t1.on(); CHK((g_con = g_ndb->startTransaction()) != 0); for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) { CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0); CHK(g_opr->insertTuple() == 0); CHK(g_opr->equal(cA, (char*)&k) == 0); - CHK(g_opr->setValue(cB, "b") == 0); + memset(b, 0x20, sizeof(b)); + b[0] = 'b'; + CHK(g_opr->setValue(cB, b) == 0); CHK(g_con->execute(NoCommit) == 0); } t1.off(g_opt.m_rowsperf); @@ -1531,12 +1534,15 @@ testperf() { DBG("--- insert for read test ---"); unsigned n = 0; + char b[20]; CHK((g_con = g_ndb->startTransaction()) != 0); for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) { CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0); CHK(g_opr->insertTuple() == 0); CHK(g_opr->equal(cA, (char*)&k) == 0); - CHK(g_opr->setValue(cB, "b") == 0); + memset(b, 0x20, sizeof(b)); + b[0] = 'b'; + CHK(g_opr->setValue(cB, b) == 0); CHK((g_bh1 = g_opr->getBlobHandle(cC)) != 0); CHK((g_bh1->setValue("c", 1) == 0)); if (++n == g_opt.m_batch) { @@ -1570,7 +1576,7 @@ testperf() a = (Uint32)-1; b[0] = 0; CHK(g_con->execute(NoCommit) == 0); - CHK(a == k && strcmp(b, "b") == 0); + CHK(a == k && b[0] == 'b'); } CHK(g_con->execute(Commit) == 0); t1.off(g_opt.m_rowsperf); @@ -1596,7 +1602,7 @@ testperf() CHK(g_con->execute(NoCommit) == 0); Uint32 m = 20; CHK(g_bh1->readData(c, m) == 0); - CHK(a == k && m == 1 && strcmp(c, "c") == 0); + CHK(a == k && m == 1 && c[0] == 'c'); } CHK(g_con->execute(Commit) == 0); t2.off(g_opt.m_rowsperf); @@ -1629,7 +1635,7 @@ testperf() CHK((ret = rs->nextResult(true)) == 0 || ret == 1); if (ret == 1) break; - CHK(a < g_opt.m_rowsperf && strcmp(b, "b") == 0); + CHK(a < g_opt.m_rowsperf && b[0] == 'b'); n++; } CHK(n == g_opt.m_rowsperf); @@ -1661,7 +1667,7 @@ testperf() break; Uint32 m = 20; CHK(g_bh1->readData(c, m) == 0); - CHK(a < g_opt.m_rowsperf && m == 1 && strcmp(c, "c") == 0); + CHK(a < g_opt.m_rowsperf && m == 1 && c[0] == 'c'); n++; } CHK(n == g_opt.m_rowsperf); From b7c3d5ef865b06641758eba0750d51e9ba11fdcc Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 31 Jan 2006 08:51:21 +0100 Subject: [PATCH 25/54] Update trigger-grant-test to use MYSQLTEST_VARDIR --- mysql-test/t/trigger-grant.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test index e28bf44a2cc..297aa445322 100644 --- a/mysql-test/t/trigger-grant.test +++ b/mysql-test/t/trigger-grant.test @@ -232,9 +232,9 @@ CREATE TRIGGER trg5 BEFORE DELETE ON t1 FOR EACH ROW SET @a = 5; ---exec egrep -v '^definers=' $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG > $MYSQL_TEST_DIR/var/tmp/t1.TRG ---exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >> $MYSQL_TEST_DIR/var/tmp/t1.TRG ---exec mv $MYSQL_TEST_DIR/var/tmp/t1.TRG $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG +--exec egrep -v '^definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG +--exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >> $MYSQLTEST_VARDIR/tmp/t1.TRG +--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG --echo From a002d316edf6822203ae9fc2d8ca9a2cb8d9414b Mon Sep 17 00:00:00 2001 From: "knielsen@mysql.com" <> Date: Tue, 31 Jan 2006 09:15:28 +0100 Subject: [PATCH 26/54] Fix missing --replace_result on $SLAVE_MYPORT in federated. --- mysql-test/r/federated.result | 2 +- mysql-test/t/federated.test | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 4391889fec9..c1e7533bcee 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1530,7 +1530,7 @@ CREATE TABLE federated.t1 ( PRIMARY KEY (`id`) ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:9308/federated/t1'; +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; INSERT INTO federated.t1 VALUES (); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index e550c5d3ac0..d1e03f8a05a 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1235,6 +1235,7 @@ CREATE TABLE federated.t1 ( connection master; DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT eval CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, PRIMARY KEY (`id`) From a71de6bfe2022eb1a0c93c6078b0de9ed48b5c88 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 31 Jan 2006 09:38:40 +0100 Subject: [PATCH 27/54] Bug #16919 some tests fail in 5.0 - Use "../tmp" as --slave-load-tmpdir. Same as in mysql-test-run.pl --- mysql-test/mysql-test-run.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 47253fec572..21eeb65943d 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -202,7 +202,14 @@ SYST=0 REALT=0 FAST_START="" MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp -SLAVE_LOAD_TMPDIR=../../var/tmp #needs to be same length to test logging + +# Use a relative path for where the slave will find the dumps +# generated by "LOAD DATA" on the master. The path is relative +# since it must have fixed length to test logging +# i.e otherwise the output from "SHOW MASTER STATUS" will vary +# with the strlen() of MYSQL_TEST_DIR +SLAVE_LOAD_TMPDIR=../tmp + RES_SPACE=" " MYSQLD_SRC_DIRS="strings mysys include extra regex myisam \ myisammrg heap sql" From 10036d354c7aaa2b6d137081fb780fe351387702 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 31 Jan 2006 10:48:40 +0100 Subject: [PATCH 28/54] Check std_data_ln already created Add / to std_data in ln command --- mysql-test/mysql-test-run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 21eeb65943d..ac5457beaa6 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -608,8 +608,10 @@ fi [ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp [ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run [ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log -ln -s $MYSQL_TEST_DIR/std_data $MYSQL_TEST_DIR/var/std_data_ln - +if ! test -L $MYSQL_TEST_DIR/var/std_data_ln ; then + ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln +fi + if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi E=`$EXPR $COLUMNS - 8` DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E` From af11dc3cbe84ded7f22ff78e00e881975c0cc340 Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Tue, 31 Jan 2006 16:27:57 +0100 Subject: [PATCH 29/54] Added test case for BUG#14270: Stored procedures: crash if load index which was fixed by earlier changesets; LOAD INDEX is not allowed in functions. Also testing CACHE INDEX, while OPTIMIZE and CHECK were covered by existing tests already. --- mysql-test/r/sp-error.result | 16 ++++++++++++++++ mysql-test/t/sp-error.test | 29 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 8483f6dc664..fb544ccd8de 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1147,3 +1147,19 @@ show procedure status; Db Name Type Definer Modified Created Security_type Comment test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER drop procedure ` bug15658`; +drop function if exists bug14270; +drop table if exists t1; +create table t1 (s1 int primary key); +create function bug14270() returns int +begin +load index into cache t1; +return 1; +end| +ERROR 0A000: Not allowed to return a result set from a function +create function bug14270() returns int +begin +cache index t1 key (`primary`) in keycache1; +return 1; +end| +ERROR 0A000: Not allowed to return a result set from a function +drop table t1; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 25944144d21..22cc325f55e 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1643,6 +1643,35 @@ show procedure status; drop procedure ` bug15658`; +# +# BUG#14270: Stored procedures: crash if load index +# +--disable_warnings +drop function if exists bug14270; +drop table if exists t1; +--enable_warnings + +create table t1 (s1 int primary key); + +delimiter |; +--error ER_SP_NO_RETSET +create function bug14270() returns int +begin + load index into cache t1; + return 1; +end| + +--error ER_SP_NO_RETSET +create function bug14270() returns int +begin + cache index t1 key (`primary`) in keycache1; + return 1; +end| +delimiter ;| + +drop table t1; + + # # BUG#NNNN: New bug synopsis # From b3ebd755cc7925675b73b4f631e94b0a3e603276 Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Tue, 31 Jan 2006 17:00:50 +0100 Subject: [PATCH 30/54] Added test case for BUG#15091: Sp Returns Unknown error in order clause....and there is no order by clause which was fixed by earlier changesets. The error message is now the more generic "Unknown table ... in field list". --- mysql-test/r/sp-error.result | 13 +++++++++++++ mysql-test/t/sp-error.test | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index fb544ccd8de..2766dca5845 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1163,3 +1163,16 @@ return 1; end| ERROR 0A000: Not allowed to return a result set from a function drop table t1; +drop procedure if exists bug15091; +create procedure bug15091() +begin +declare selectstr varchar(6000) default ' '; +declare conditionstr varchar(5000) default ''; +set selectstr = concat(selectstr, +' and ', +c.operatorid, +'in (',conditionstr, ')'); +end| +call bug15091(); +ERROR 42S02: Unknown table 'c' in field list +drop procedure bug15091; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 22cc325f55e..e1839b4b98f 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1672,6 +1672,37 @@ delimiter ;| drop table t1; +# +# BUG#15091: Sp Returns Unknown error in order clause....and +# there is no order by clause +# +--disable_warnings +drop procedure if exists bug15091; +--enable_warnings + +delimiter |; +create procedure bug15091() +begin + declare selectstr varchar(6000) default ' '; + declare conditionstr varchar(5000) default ''; + + set selectstr = concat(selectstr, + ' and ', + c.operatorid, + 'in (',conditionstr, ')'); +end| +delimiter ;| + +# The error message used to be: +# ERROR 1109 (42S02): Unknown table 'c' in order clause +# but is now rephrased to something less misleading: +# ERROR 1109 (42S02): Unknown table 'c' in field list +--error ER_UNKNOWN_TABLE +call bug15091(); + +drop procedure bug15091; + + # # BUG#NNNN: New bug synopsis # From 9296fb241d50199a60df7d9a0e93ac730432b82c Mon Sep 17 00:00:00 2001 From: "aivanov@mysql.com" <> Date: Tue, 31 Jan 2006 21:41:48 +0300 Subject: [PATCH 31/54] Fixed: BUG#15653, BUG#16157, BUG#16229, BUG#16298, BUG#16387, BUG#16582. Applied innodb-5.0-ss149/162 snapshots. --- innobase/btr/btr0sea.c | 44 ++++++++++++++-- innobase/dict/dict0dict.c | 3 +- innobase/dict/dict0load.c | 20 ++++++-- innobase/fil/fil0fil.c | 83 +++++++++++++++++++++++++++++- innobase/include/univ.i | 6 --- innobase/os/os0sync.c | 32 ++++++------ innobase/srv/srv0start.c | 14 +++++ mysql-test/r/innodb.result | 71 ++++++++++++++++++++++++++ mysql-test/t/innodb.test | 102 +++++++++++++++++++++++++++++++++++++ sql/ha_innodb.cc | 59 ++++++++++++--------- sql/ha_innodb.h | 13 +---- 11 files changed, 377 insertions(+), 70 deletions(-) diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index 81f23cfa99c..32e22aa51bc 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -191,7 +191,7 @@ static void btr_search_info_update_hash( /*========================*/ - btr_search_t* info, /* in: search info */ + btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { dict_index_t* index; @@ -452,7 +452,7 @@ Updates the search info. */ void btr_search_info_update_slow( /*========================*/ - btr_search_t* info, /* in: search info */ + btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { buf_block_t* block; @@ -912,12 +912,12 @@ btr_search_drop_page_hash_index( ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); #endif /* UNIV_SYNC_DEBUG */ - +retry: rw_lock_s_lock(&btr_search_latch); block = buf_block_align(page); - if (!block->is_hashed) { + if (UNIV_LIKELY(!block->is_hashed)) { rw_lock_s_unlock(&btr_search_latch); @@ -958,6 +958,8 @@ btr_search_drop_page_hash_index( tree_id = btr_page_get_index_id(page); + ut_a(0 == ut_dulint_cmp(tree_id, index->id)); + prev_fold = 0; heap = NULL; @@ -992,6 +994,26 @@ next_rec: rw_lock_x_lock(&btr_search_latch); + if (UNIV_UNLIKELY(!block->is_hashed)) { + /* Someone else has meanwhile dropped the hash index */ + + goto cleanup; + } + + ut_a(block->index == index); + + if (UNIV_UNLIKELY(block->curr_n_fields != n_fields) + || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) { + + /* Someone else has meanwhile built a new hash index on the + page, with different parameters */ + + rw_lock_x_unlock(&btr_search_latch); + + mem_free(folds); + goto retry; + } + for (i = 0; i < n_cached; i++) { ha_remove_all_nodes_to_page(table, folds[i], page); @@ -999,8 +1021,20 @@ next_rec: block->is_hashed = FALSE; block->index = NULL; +cleanup: + if (UNIV_UNLIKELY(block->n_pointers)) { + /* Corruption */ + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Corruption of adaptive hash index. After dropping\n" +"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n", + index->name, (ulong) block->n_pointers); + rw_lock_x_unlock(&btr_search_latch); - rw_lock_x_unlock(&btr_search_latch); + btr_search_validate(); + } else { + rw_lock_x_unlock(&btr_search_latch); + } mem_free(folds); } diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 8050eebddd8..58c4e3ed6a3 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -2803,7 +2803,8 @@ dict_table_get_highest_foreign_id( if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len && 0 == ut_memcmp(foreign->id, table->name, len) && 0 == ut_memcmp(foreign->id + len, - dict_ibfk, (sizeof dict_ibfk) - 1)) { + dict_ibfk, (sizeof dict_ibfk) - 1) + && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') { /* It is of the >= 4.0.18 format */ id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1), diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index 3281f9926f9..6415cc56b61 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -385,13 +385,23 @@ dict_load_columns( field = rec_get_nth_field_old(rec, 6, &len); prtype = mach_read_from_4(field); - if (dtype_is_non_binary_string_type(mtype, prtype) - && dtype_get_charset_coll(prtype) == 0) { - /* This is a non-binary string type, and the table - was created with < 4.1.2. Use the default charset. */ + if (dtype_get_charset_coll(prtype) == 0 + && dtype_is_string_type(mtype)) { + /* The table was created with < 4.1.2. */ - prtype = dtype_form_prtype(prtype, + if (dtype_is_binary_string_type(mtype, prtype)) { + /* Use the binary collation for + string columns of binary type. */ + + prtype = dtype_form_prtype(prtype, + DATA_MYSQL_BINARY_CHARSET_COLL); + } else { + /* Use the default charset for + other than binary columns. */ + + prtype = dtype_form_prtype(prtype, data_mysql_default_charset_coll); + } } field = rec_get_nth_field_old(rec, 7, &len); diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 20f522c1a60..69c076d78f3 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -181,6 +181,11 @@ struct fil_space_struct { hash_node_t name_hash;/* hash chain the name_hash table */ rw_lock_t latch; /* latch protecting the file space storage allocation */ + UT_LIST_NODE_T(fil_space_t) unflushed_spaces; + /* list of spaces with at least one unflushed + file we have written to */ + ibool is_in_unflushed_spaces; /* TRUE if this space is + currently in the list above */ UT_LIST_NODE_T(fil_space_t) space_list; /* list of all spaces */ ibuf_data_t* ibuf_data; @@ -213,6 +218,12 @@ struct fil_system_struct { not put to this list: they are opened after the startup, and kept open until shutdown */ + UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces; + /* base node for the list of those + tablespaces whose files contain + unflushed writes; those spaces have + at least one file node where + modification_counter > flush_counter */ ulint n_open; /* number of files currently open */ ulint max_n_open; /* n_open is not allowed to exceed this */ @@ -389,6 +400,36 @@ fil_space_get_ibuf_data( return(space->ibuf_data); } +/************************************************************************** +Checks if all the file nodes in a space are flushed. The caller must hold +the fil_system mutex. */ +static +ibool +fil_space_is_flushed( +/*=================*/ + /* out: TRUE if all are flushed */ + fil_space_t* space) /* in: space */ +{ + fil_node_t* node; + +#ifdef UNIV_SYNC_DEBUG + ut_ad(mutex_own(&(fil_system->mutex))); +#endif /* UNIV_SYNC_DEBUG */ + + node = UT_LIST_GET_FIRST(space->chain); + + while (node) { + if (node->modification_counter > node->flush_counter) { + + return(FALSE); + } + + node = UT_LIST_GET_NEXT(chain, node); + } + + return(TRUE); +} + /*********************************************************************** Appends a new file to the chain of files of a space. File must be closed. */ @@ -841,6 +882,16 @@ fil_node_free( node->modification_counter = node->flush_counter; + if (space->is_in_unflushed_spaces + && fil_space_is_flushed(space)) { + + space->is_in_unflushed_spaces = FALSE; + + UT_LIST_REMOVE(unflushed_spaces, + system->unflushed_spaces, + space); + } + fil_node_close_file(node, system); } @@ -1004,6 +1055,8 @@ try_again: HASH_INSERT(fil_space_t, name_hash, system->name_hash, ut_fold_string(name), space); + space->is_in_unflushed_spaces = FALSE; + UT_LIST_ADD_LAST(space_list, system->space_list, space); mutex_exit(&(system->mutex)); @@ -1099,6 +1152,13 @@ fil_space_free( HASH_DELETE(fil_space_t, name_hash, system->name_hash, ut_fold_string(space->name), space); + if (space->is_in_unflushed_spaces) { + space->is_in_unflushed_spaces = FALSE; + + UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, + space); + } + UT_LIST_REMOVE(space_list, system->space_list, space); ut_a(space->magic_n == FIL_SPACE_MAGIC_N); @@ -1250,6 +1310,7 @@ fil_system_create( system->tablespace_version = 0; + UT_LIST_INIT(system->unflushed_spaces); UT_LIST_INIT(system->space_list); return(system); @@ -3742,6 +3803,14 @@ fil_node_complete_io( if (type == OS_FILE_WRITE) { system->modification_counter++; node->modification_counter = system->modification_counter; + + if (!node->space->is_in_unflushed_spaces) { + + node->space->is_in_unflushed_spaces = TRUE; + UT_LIST_ADD_FIRST(unflushed_spaces, + system->unflushed_spaces, + node->space); + } } if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE @@ -4162,6 +4231,16 @@ retry: skip_flush: if (node->flush_counter < old_mod_counter) { node->flush_counter = old_mod_counter; + + if (space->is_in_unflushed_spaces + && fil_space_is_flushed(space)) { + + space->is_in_unflushed_spaces = FALSE; + + UT_LIST_REMOVE(unflushed_spaces, + system->unflushed_spaces, + space); + } } if (space->purpose == FIL_TABLESPACE) { @@ -4193,7 +4272,7 @@ fil_flush_file_spaces( mutex_enter(&(system->mutex)); - space = UT_LIST_GET_FIRST(system->space_list); + space = UT_LIST_GET_FIRST(system->unflushed_spaces); while (space) { if (space->purpose == purpose && !space->is_being_deleted) { @@ -4209,7 +4288,7 @@ fil_flush_file_spaces( space->n_pending_flushes--; } - space = UT_LIST_GET_NEXT(space_list, space); + space = UT_LIST_GET_NEXT(unflushed_spaces, space); } mutex_exit(&(system->mutex)); diff --git a/innobase/include/univ.i b/innobase/include/univ.i index 15650f22ed8..dd4862b3808 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -126,14 +126,8 @@ by one. */ #ifdef __WIN__ #define UNIV_INLINE __inline #else -/* config.h contains the right def for 'inline' for the current compiler */ -#if (__GNUC__ == 2) -#define UNIV_INLINE extern inline -#else -/* extern inline doesn't work with gcc 3.0.2 */ #define UNIV_INLINE static inline #endif -#endif #else /* If we want to compile a noninlined version we use the following macro diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c index 487e8f40a39..8bafb73baf8 100644 --- a/innobase/os/os0sync.c +++ b/innobase/os/os0sync.c @@ -317,28 +317,28 @@ os_event_wait( os_fast_mutex_lock(&(event->os_mutex)); old_signal_count = event->signal_count; -loop: - if (event->is_set == TRUE - || event->signal_count != old_signal_count) { - os_fast_mutex_unlock(&(event->os_mutex)); + for (;;) { + if (event->is_set == TRUE + || event->signal_count != old_signal_count) { - if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) { + os_fast_mutex_unlock(&(event->os_mutex)); - os_thread_exit(NULL); + if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) { + + os_thread_exit(NULL); + } + /* Ok, we may return */ + + return; } - /* Ok, we may return */ - return; + pthread_cond_wait(&(event->cond_var), &(event->os_mutex)); + + /* Solaris manual said that spurious wakeups may occur: we + have to check if the event really has been signaled after + we came here to wait */ } - - pthread_cond_wait(&(event->cond_var), &(event->os_mutex)); - - /* Solaris manual said that spurious wakeups may occur: we have to - check if the event really has been signaled after we came here to - wait */ - - goto loop; #endif } diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 4f99f340e1c..b345a27af20 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -233,6 +233,13 @@ srv_parse_data_file_paths_and_sizes( } } + if (i == 0) { + /* If innodb_data_file_path was defined it must contain + at least one data file definition */ + + return(FALSE); + } + *data_file_names = (char**)ut_malloc(i * sizeof(void*)); *data_file_sizes = (ulint*)ut_malloc(i * sizeof(ulint)); *data_file_is_raw_partition = (ulint*)ut_malloc(i * sizeof(ulint)); @@ -379,6 +386,13 @@ srv_parse_log_group_home_dirs( } } + if (i != 1) { + /* If innodb_log_group_home_dir was defined it must + contain exactly one path definition under current MySQL */ + + return(FALSE); + } + *log_group_home_dirs = (char**) ut_malloc(i * sizeof(void*)); /* Then store the actual values to our array */ diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 0816d0de43c..163b9302b5c 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -3180,3 +3180,74 @@ a hex(b) 7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 update t1 set b = 'three' where a = 6; drop table t1; +CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) default NULL, + KEY `t2_ibfk_0` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t2,t1; +create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +insert into t1(a) values (1),(2),(3); +commit; +set autocommit = 0; +update t1 set b = 5 where a = 2; +create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | +set autocommit = 0; +insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), +(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), +(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), +(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), +(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); +commit; +commit; +drop trigger t1t; +drop table t1; +create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +insert into t1(a) values (1),(2),(3); +insert into t2(a) values (1),(2),(3); +insert into t3(a) values (1),(2),(3); +insert into t4(a) values (1),(2),(3); +insert into t3(a) values (5),(7),(8); +insert into t4(a) values (5),(7),(8); +insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); +create trigger t1t before insert on t1 for each row begin +INSERT INTO t2 SET a = NEW.a; +end | +create trigger t2t before insert on t2 for each row begin +DELETE FROM t3 WHERE a = NEW.a; +end | +create trigger t3t before delete on t3 for each row begin +UPDATE t4 SET b = b + 1 WHERE a = OLD.a; +end | +create trigger t4t before update on t4 for each row begin +UPDATE t5 SET b = b + 1 where a = NEW.a; +end | +commit; +set autocommit = 0; +update t1 set b = b + 5 where a = 1; +update t2 set b = b + 5 where a = 1; +update t3 set b = b + 5 where a = 1; +update t4 set b = b + 5 where a = 1; +insert into t5(a) values(20); +set autocommit = 0; +insert into t1(a) values(7); +insert into t2(a) values(8); +delete from t2 where a = 3; +update t4 set b = b + 1 where a = 3; +commit; +drop trigger t1t; +drop trigger t2t; +drop trigger t3t; +drop trigger t4t; +drop table t1, t2, t3, t4, t5; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 8d2f18e2362..a47e635cf74 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -2047,3 +2047,105 @@ insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 select a,hex(b) from t1 order by b; update t1 set b = 'three' where a = 6; drop table t1; + +# Ensure that _ibfk_0 is not mistreated as a +# generated foreign key identifier. (Bug #16387) + +CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; +SHOW CREATE TABLE t2; +DROP TABLE t2,t1; + +# +# Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing +# + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +insert into t1(a) values (1),(2),(3); +commit; +connection b; +set autocommit = 0; +update t1 set b = 5 where a = 2; +connection a; +delimiter |; +create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | +delimiter ;| +set autocommit = 0; +connection a; +insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), +(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), +(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), +(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), +(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); +connection b; +commit; +connection a; +commit; +drop trigger t1t; +drop table t1; +disconnect a; +disconnect b; +# +# Another trigger test +# +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +insert into t1(a) values (1),(2),(3); +insert into t2(a) values (1),(2),(3); +insert into t3(a) values (1),(2),(3); +insert into t4(a) values (1),(2),(3); +insert into t3(a) values (5),(7),(8); +insert into t4(a) values (5),(7),(8); +insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); + +delimiter |; +create trigger t1t before insert on t1 for each row begin + INSERT INTO t2 SET a = NEW.a; +end | + +create trigger t2t before insert on t2 for each row begin + DELETE FROM t3 WHERE a = NEW.a; +end | + +create trigger t3t before delete on t3 for each row begin + UPDATE t4 SET b = b + 1 WHERE a = OLD.a; +end | + +create trigger t4t before update on t4 for each row begin + UPDATE t5 SET b = b + 1 where a = NEW.a; +end | +delimiter ;| +commit; +set autocommit = 0; +update t1 set b = b + 5 where a = 1; +update t2 set b = b + 5 where a = 1; +update t3 set b = b + 5 where a = 1; +update t4 set b = b + 5 where a = 1; +insert into t5(a) values(20); +connection b; +set autocommit = 0; +insert into t1(a) values(7); +insert into t2(a) values(8); +delete from t2 where a = 3; +update t4 set b = b + 1 where a = 3; +commit; +drop trigger t1t; +drop trigger t2t; +drop trigger t3t; +drop trigger t4t; +drop table t1, t2, t3, t4, t5; +disconnect a; +disconnect b; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b33d2dfbd97..1b1326920ad 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -138,8 +138,6 @@ extern "C" { #define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */ #define HA_INNOBASE_RANGE_COUNT 100 -uint innobase_init_flags = 0; -ulong innobase_cache_size = 0; ulong innobase_large_page_size = 0; /* The default values for the following, type long or longlong, start-up @@ -187,8 +185,6 @@ it every INNOBASE_WAKE_INTERVAL'th step. */ #define INNOBASE_WAKE_INTERVAL 32 ulong innobase_active_counter = 0; -char* innobase_home = NULL; - static HASH innobase_open_tables; #ifdef __NETWARE__ /* some special cleanup for NetWare */ @@ -814,7 +810,6 @@ ha_innobase::ha_innobase(TABLE *table_arg) HA_PRIMARY_KEY_IN_READ_INDEX | HA_CAN_GEOMETRY | HA_TABLE_SCAN_ON_INDEX), - last_dup_key((uint) -1), start_of_scan(0), num_write_row(0) {} @@ -983,6 +978,11 @@ innobase_query_caching_of_table_permitted( sql_print_error("The calling thread is holding the adaptive " "search, latch though calling " "innobase_query_caching_of_table_permitted."); + + mutex_enter_noninline(&kernel_mutex); + trx_print(stderr, trx, 1024); + mutex_exit_noninline(&kernel_mutex); + ut_error; } innobase_release_stat_resources(trx); @@ -6329,14 +6329,17 @@ ha_innobase::external_lock( TABLES if AUTOCOMMIT=1. It does not make much sense to acquire an InnoDB table lock if it is released immediately at the end of LOCK TABLES, and InnoDB's table locks in that case cause - VERY easily deadlocks. We do not set InnoDB table locks when - MySQL sets them at the start of a stored procedure call - (MySQL does have thd->in_lock_tables TRUE there). */ + VERY easily deadlocks. + + We do not set InnoDB table locks if user has not explicitly + requested a table lock. Note that thd->in_lock_tables + can be TRUE on some cases e.g. at the start of a stored + procedure call (SQLCOM_CALL). */ if (prebuilt->select_lock_type != LOCK_NONE) { if (thd->in_lock_tables && - thd->lex->sql_command != SQLCOM_CALL && + thd->lex->sql_command == SQLCOM_LOCK_TABLES && thd->variables.innodb_table_locks && (thd->options & OPTION_NOT_AUTOCOMMIT)) { @@ -6838,7 +6841,7 @@ ha_innobase::store_lock( } else if (lock_type != TL_IGNORE) { - /* We set possible LOCK_X value in external_lock, not yet + /* We set possible LOCK_X value in external_lock, not yet here even if this would be SELECT ... FOR UPDATE */ prebuilt->select_lock_type = LOCK_NONE; @@ -6847,7 +6850,7 @@ ha_innobase::store_lock( if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) { - /* Starting from 5.0.7, we weaken also the table locks + /* Starting from 5.0.7, we weaken also the table locks set at the start of a MySQL stored procedure call, just like we weaken the locks set at the start of an SQL statement. MySQL does set thd->in_lock_tables TRUE there, but in reality @@ -6870,26 +6873,36 @@ ha_innobase::store_lock( lock_type = TL_READ_NO_INSERT; } - /* If we are not doing a LOCK TABLE or DISCARD/IMPORT - TABLESPACE or TRUNCATE TABLE, then allow multiple writers */ + /* If we are not doing a LOCK TABLE, DISCARD/IMPORT + TABLESPACE or TRUNCATE TABLE then allow multiple + writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ + < TL_WRITE_CONCURRENT_INSERT. - if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && - lock_type <= TL_WRITE) + We especially allow multiple writers if MySQL is at the + start of a stored procedure call (SQLCOM_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_CALL) + || thd->lex->sql_command == SQLCOM_CALL) && !thd->tablespace_op && thd->lex->sql_command != SQLCOM_TRUNCATE - && thd->lex->sql_command != SQLCOM_OPTIMIZE - && thd->lex->sql_command != SQLCOM_CREATE_TABLE) { + && thd->lex->sql_command != SQLCOM_OPTIMIZE + && thd->lex->sql_command != SQLCOM_CREATE_TABLE) { - lock_type = TL_WRITE_ALLOW_WRITE; + 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 would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts to t2. Convert the lock to a normal read lock to allow - concurrent inserts to t2. */ + concurrent inserts to t2. + + We especially allow concurrent inserts if MySQL is at the + start of a stored procedure call (SQLCOM_CALL) + (MySQL does have thd->in_lock_tables TRUE there). */ if (lock_type == TL_READ_NO_INSERT && (!thd->in_lock_tables @@ -6898,10 +6911,10 @@ ha_innobase::store_lock( lock_type = TL_READ; } - lock.type = lock_type; - } + lock.type = lock_type; + } - *to++= &lock; + *to++= &lock; return(to); } diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index aa8506abe6d..fb93b2abb0e 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -52,7 +52,6 @@ class ha_innobase: public handler THR_LOCK_DATA lock; INNOBASE_SHARE *share; - gptr alloc_ptr; byte* upd_buff; /* buffer used in updates */ byte* key_val_buff; /* buffer used in converting search key values from MySQL format @@ -62,7 +61,6 @@ class ha_innobase: public handler two buffers */ ulong int_table_flags; uint primary_key; - uint last_dup_key; ulong start_of_scan; /* this is set to 1 when we are starting a table scan but have not yet fetched any row, else 0 */ @@ -70,7 +68,6 @@ class ha_innobase: public handler ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX, or undefined */ uint num_write_row; /* number of write_row() calls */ - ulong max_supported_row_length(const byte *buf); uint store_key_val_for_row(uint keynr, char* buff, uint buff_len, const byte* record); @@ -199,11 +196,8 @@ class ha_innobase: public handler }; extern struct show_var_st innodb_status_variables[]; -extern uint innobase_init_flags, innobase_lock_type; -extern ulong innobase_cache_size, innobase_fast_shutdown; +extern ulong innobase_fast_shutdown; extern ulong innobase_large_page_size; -extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; -extern long innobase_lock_scan_time; extern long innobase_mirrored_log_groups, innobase_log_files_in_group; extern longlong innobase_buffer_pool_size, innobase_log_file_size; extern long innobase_log_buffer_size; @@ -240,8 +234,6 @@ extern ulong srv_commit_concurrency; extern ulong srv_flush_log_at_trx_commit; } -extern TYPELIB innobase_lock_typelib; - bool innobase_init(void); bool innobase_end(void); bool innobase_flush_logs(void); @@ -311,9 +303,6 @@ int innobase_rollback_by_xid( XID *xid); /* in : X/Open XA Transaction Identification */ -int innobase_xa_end(THD *thd); - - int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name, my_off_t end_offset); From a84c7e1c295eeea89a232409d66596df085ef01b Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Wed, 1 Feb 2006 14:46:30 +0100 Subject: [PATCH 32/54] Added new test case for BUG#14533: 'desc tbl' in stored procedure causes error 1142 which is no longer repeatable. (Unclear when this was fixed.) --- mysql-test/r/sp-security.result | 23 ++++++++++++++++++++ mysql-test/t/sp-security.test | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index b223c0cd487..ff729e87f97 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -291,3 +291,26 @@ drop user user1_bug14834@localhost; drop user user2_bug14834@localhost; drop user user3_bug14834@localhost; drop database db_bug14834; +create database db_bug14533; +use db_bug14533; +create table t1 (id int); +create user user_bug14533@localhost identified by ''; +create procedure bug14533_1() +sql security definer +desc db_bug14533.t1; +create procedure bug14533_2() +sql security definer +select * from db_bug14533.t1; +grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost; +grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost; +call db_bug14533.bug14533_1(); +Field Type Null Key Default Extra +id int(11) YES NULL +call db_bug14533.bug14533_2(); +id +desc db_bug14533.t1; +ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1' +select * from db_bug14533.t1; +ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1' +drop user user_bug14533@localhost; +drop database db_bug14533; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 223bc09b9fc..90160780618 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -487,4 +487,42 @@ drop user user2_bug14834@localhost; drop user user3_bug14834@localhost; drop database db_bug14834; + +# +# BUG#14533: 'desc tbl' in stored procedure causes error 1142 +# +create database db_bug14533; +use db_bug14533; +create table t1 (id int); +create user user_bug14533@localhost identified by ''; + +create procedure bug14533_1() + sql security definer + desc db_bug14533.t1; + +create procedure bug14533_2() + sql security definer + select * from db_bug14533.t1; + +grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost; +grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost; + +connect (user_bug14533,localhost,user_bug14533,,test); + +# These should work +call db_bug14533.bug14533_1(); +call db_bug14533.bug14533_2(); + +# For reference, these should not work +--error ER_TABLEACCESS_DENIED_ERROR +desc db_bug14533.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from db_bug14533.t1; + +# Cleanup +connection default; +disconnect user_bug14533; +drop user user_bug14533@localhost; +drop database db_bug14533; + # End of 5.0 bugs. From 30d14266754a51c36fac2fb403e482bf1f64667d Mon Sep 17 00:00:00 2001 From: "pem@mysql.com" <> Date: Wed, 1 Feb 2006 16:00:11 +0100 Subject: [PATCH 33/54] Post-review fix for BUG#15011. Added comments. --- sql/sp_rcontext.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 4818ffbbe31..af4e41c29be 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -164,6 +164,33 @@ sp_rcontext::set_return_value(THD *thd, Item *return_value_item) #define IS_NOT_FOUND_CONDITION(S) ((S)[0] == '0' && (S)[1] == '2') #define IS_EXCEPTION_CONDITION(S) ((S)[0] != '0' || (S)[1] > '2') +/* + Find a handler for the given errno. + This is called from all error message functions (e.g. push_warning, + net_send_error, et al) when a sp_rcontext is in effect. If a handler + is found, no error is sent, and the the SP execution loop will instead + invoke the found handler. + This might be called several times before we get back to the execution + loop, so m_hfound can be >= 0 if a handler has already been found. + (In which case we don't search again - the first found handler will + be used.) + Handlers are pushed on the stack m_handler, with the latest/innermost + one on the top; we then search for matching handlers from the top and + down. + We search through all the handlers, looking for the most specific one + (sql_errno more specific than sqlstate more specific than the rest). + Note that mysql error code handlers is a MySQL extension, not part of + the standard. + + SYNOPSIS + sql_errno The error code + level Warning level + + RETURN + 1 if a handler was found, m_hfound is set to its index (>= 0) + 0 if not found, m_hfound is -1 +*/ + bool sp_rcontext::find_handler(uint sql_errno, MYSQL_ERROR::enum_warning_level level) @@ -174,11 +201,13 @@ sp_rcontext::find_handler(uint sql_errno, const char *sqlstate= mysql_errno_to_sqlstate(sql_errno); int i= m_hcount, found= -1; + /* Search handlers from the latest (innermost) to the oldest (outermost) */ while (i--) { sp_cond_type_t *cond= m_handler[i].cond; int j= m_ihsp; + /* Check active handlers, to avoid invoking one recursively */ while (j--) if (m_in_handler[j] == m_handler[i].handler) break; From 736faf473011dffd0fc0905c1d5e7859fa04c5aa Mon Sep 17 00:00:00 2001 From: "andrey@lmy004." <> Date: Wed, 1 Feb 2006 20:35:16 +0100 Subject: [PATCH 34/54] fix for bug #12744 (MYSQL_STMT operations cause seg fault after connection reset) --- libmysql/libmysql.c | 6 ++++++ tests/mysql_client_test.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 921f042922a..498881aa947 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4628,6 +4628,12 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt) /* If statement hasnt been prepared there is nothing to reset */ if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE) DBUG_RETURN(0); + if (!stmt->mysql) + { + /* mysql can be reset in mysql_close called from mysql_reconnect */ + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate); + DBUG_RETURN(1); + } mysql= stmt->mysql->last_used_con; int4store(buff, stmt->stmt_id); /* Send stmt id to server */ diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 91c2ab9205d..dbc2f582466 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11706,6 +11706,37 @@ static void test_bug12001() DIE_UNLESS(res==1); } +static void test_bug12744() +{ + MYSQL_STMT *prep_stmt = NULL; + int rc; + myheader("test_bug12744"); + + prep_stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(prep_stmt, "SELECT 1", 8); + DIE_UNLESS(rc==0); + + rc= mysql_kill(mysql, mysql_thread_id(mysql)); + DIE_UNLESS(rc==0); + + if (rc= mysql_stmt_execute(prep_stmt)) + { + if (rc= mysql_stmt_reset(prep_stmt)) + printf("OK!\n"); + else + { + printf("Error!"); + DIE_UNLESS(1==0); + } + } + else + { + fprintf(stderr, "expected error but no error occured\n"); + DIE_UNLESS(1==0); + } + rc= mysql_stmt_close(prep_stmt); +} + /* Bug#11718: query with function, join and order by returns wrong type */ @@ -12054,6 +12085,7 @@ static struct my_tests_st my_tests[]= { { "test_bug8378", test_bug8378 }, { "test_bug9735", test_bug9735 }, { "test_bug11183", test_bug11183 }, + { "test_bug12744", test_bug12744 }, { "test_bug12001", test_bug12001 }, { "test_bug11718", test_bug11718 }, { "test_bug12925", test_bug12925 }, From 17fe2512016311e03d65a3003259b7952040ef4d Mon Sep 17 00:00:00 2001 From: "gunnar@mysql.com." <> Date: Thu, 2 Feb 2006 21:27:23 +0100 Subject: [PATCH 35/54] item_timefunc.cc: manual adding the fix for bug#15828 which did not automerge --- sql/item_timefunc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 61449d3c671..17f25b49bcc 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3023,9 +3023,9 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; - if ((const_item= args[1]->const_item())) + format= args[1]->val_str(&format_str); + if (!args[1]->null_value && (const_item= args[1]->const_item())) { - format= args[1]->val_str(&format_str); cached_format_type= get_date_time_result_type(format->ptr(), format->length()); switch (cached_format_type) { From 303ad65fb2357f762d95d757af623a749a7f1e54 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 3 Feb 2006 00:07:36 +0300 Subject: [PATCH 36/54] Post-merge fixes. --- mysql-test/r/heap.result | 13 +++++++++++-- mysql-test/r/heap_hash.result | 22 +++++++++++----------- mysql-test/r/kill.result | 24 ++++++++++++------------ mysql-test/t/kill.test | 3 --- sql/ha_heap.cc | 4 ++-- tests/mysql_client_test.c | 17 ----------------- 6 files changed, 36 insertions(+), 47 deletions(-) diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 7f40dfa3a36..fda4886f1af 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where explain select * from t1 where btn="a" and new_col="a"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref btn btn 11 const,const 1 Using where +1 SIMPLE t1 ref btn btn 11 const,const 2 Using where drop table t1; CREATE TABLE t1 ( a int default NULL, @@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where +1 SIMPLE t1 ref a a 5 const 2 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 @@ -701,6 +701,15 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 drop table t1; +CREATE TABLE t1 (a int, key(a)) engine=heap; +insert delayed into t1 values (0); +delete from t1; +select * from t1; +a +insert delayed into t1 values (0), (1); +select * from t1 where a = 0; +a +drop table t1; create table t1 (c char(10)) engine=memory; create table t2 (c varchar(10)) engine=memory; show table status like 't_'; diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index d8d89b786b5..e0835bbf8d6 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where explain select * from t1 where btn="a" and new_col="a"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref btn btn 11 const,const 1 Using where +1 SIMPLE t1 ref btn btn 11 const,const 2 Using where drop table t1; CREATE TABLE t1 ( a int default NULL, @@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where +1 SIMPLE t1 ref a a 5 const 2 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 @@ -220,16 +220,16 @@ insert into t1 values ('aaag', 'prefill-hash=3',0); insert into t1 values ('aaah', 'prefill-hash=6',0); explain select * from t1 where a='aaaa'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where explain select * from t1 where a='aaab'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where explain select * from t1 where a='aaac'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where explain select * from t1 where a='aaad'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 8 const 1 Using where +1 SIMPLE t1 ref a a 8 const 2 Using where insert into t1 select * from t1; flush tables; explain select * from t1 where a='aaaa'; @@ -291,25 +291,25 @@ insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'), insert into t2 select * from t1; explain select * from t1 where name='matt'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where explain select * from t2 where name='matt'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where explain select * from t1 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where explain select * from t2 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where explain select * from t1 where name='Phil'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where explain select * from t2 where name='Phil'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where explain select * from t1 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where +1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where explain select * from t2 where name='Lilu'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where @@ -364,5 +364,5 @@ a 3 explain select a from t1 where a in (1,3); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where +1 SIMPLE t1 range a a 5 NULL 4 Using where drop table t1; diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index d52d2eb9ebb..2cb90679aed 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -15,18 +15,6 @@ select 4; 4 4 drop table t1; -select get_lock("a", 10); -get_lock("a", 10) -1 - select get_lock("a", 10); -get_lock("a", 10) -NULL -select 1; -1 -1 -select RELEASE_LOCK("a"); -RELEASE_LOCK("a") -1 create table t1 (id int primary key); create table t2 (id int unsigned not null); insert into t2 select id from t1; @@ -39,3 +27,15 @@ select ((@id := kill_id) - kill_id) from t3; kill @id; ERROR 08S01: Server shutdown in progress drop table t1, t2, t3; +select get_lock("a", 10); +get_lock("a", 10) +1 + select get_lock("a", 10); +get_lock("a", 10) +NULL +select 1; +1 +1 +select RELEASE_LOCK("a"); +RELEASE_LOCK("a") +1 diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 7c2482284e2..9a8f61b1052 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -47,7 +47,6 @@ connection con2; select 4; drop table t1; -disconnect con2; connection default; # # BUG#14851: killing long running subquery processed via a temporary table. @@ -88,8 +87,6 @@ connection conn1; -- error 1053 reap; -disconnect conn1; -disconnect conn2; connection default; drop table t1, t2, t3; diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 2a989a71edc..739569e305a 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -53,7 +53,7 @@ handlerton heap_hton= { ha_heap::ha_heap(TABLE *table_arg) :handler(&heap_hton, table_arg), file(0), records_changed(0), - key_stats_version(0) + key_stat_version(0) {} @@ -532,7 +532,7 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key, return records; /* Assert that info() did run. We need current statistics here. */ - DBUG_ASSERT(key_stats_ok); + DBUG_ASSERT(key_stat_version); return key->rec_per_key[key->key_parts-1]; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index c5d31f96867..f32fd752d77 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14697,23 +14697,6 @@ static void test_opt_reconnect() mysql_close(lmysql); } -/* Bug #16144: mysql_stmt_attr_get type error */ - -static void test_bug16144() -{ - const my_bool flag_orig= (my_bool) 0xde; - my_bool flag= flag_orig; - MYSQL_STMT *stmt; - myheader("test_bug16144"); - - /* Check that attr_get returns correct data on little and big endian CPUs */ - stmt= mysql_stmt_init(mysql); - mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (const void*) &flag); - mysql_stmt_attr_get(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &flag); - DIE_UNLESS(flag == flag_orig); - mysql_stmt_close(stmt); -} - static void test_bug12744() { From cb7118edcdee14b2a08bc2e37a69c8754c3d94f3 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 3 Feb 2006 02:01:01 +0300 Subject: [PATCH 37/54] One more post-merge fix. --- mysql-test/r/heap.result | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index fda4886f1af..3607a2e3ab5 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -709,6 +709,7 @@ a insert delayed into t1 values (0), (1); select * from t1 where a = 0; a +0 drop table t1; create table t1 (c char(10)) engine=memory; create table t2 (c varchar(10)) engine=memory; From 4ae74a8133888bdb0490d015a4e61944e74c7e73 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Fri, 3 Feb 2006 01:59:02 +0100 Subject: [PATCH 38/54] First set of rpl test updated for NDB and general test cleanup --- mysql-test/extra/rpl_tests/rpl000006.test | 10 +- .../rpl_tests/rpl_sv_relay_space.test} | 6 +- mysql-test/r/rpl000004.result | 6 +- mysql-test/r/rpl000006.result | 2 +- mysql-test/r/rpl000009.result | 8 +- mysql-test/r/rpl_LD_INFILE.result | 204 +++++++++--------- mysql-test/r/rpl_ndb_auto_inc.result | 185 ++++++++++++++++ mysql-test/r/rpl_ndb_relay_space.result | 25 +++ mysql-test/r/rpl_relay_space_innodb.result | 25 +++ ...5.result => rpl_relay_space_myisam.result} | 0 mysql-test/r/rpl_relay_space_ndb.result | 25 +++ mysql-test/t/disabled.def | 2 +- mysql-test/t/rpl000004.test | 14 +- mysql-test/t/rpl000009.test | 17 +- mysql-test/t/rpl_LD_INFILE.test | 8 +- mysql-test/t/rpl_auto_increment-slave.opt | 1 + mysql-test/t/rpl_ndb_auto_inc-master.opt | 1 + mysql-test/t/rpl_ndb_auto_inc.test | 7 + mysql-test/t/rpl_ndb_relay_space.test | 7 + .../t/rpl_relay_space_innodb-master.opt | 1 + mysql-test/t/rpl_relay_space_innodb-slave.opt | 1 + mysql-test/t/rpl_relay_space_innodb.test | 7 + mysql-test/t/rpl_relay_space_myisam.test | 6 + 23 files changed, 440 insertions(+), 128 deletions(-) rename mysql-test/{t/rpl000005.test => extra/rpl_tests/rpl_sv_relay_space.test} (76%) create mode 100644 mysql-test/r/rpl_ndb_auto_inc.result create mode 100644 mysql-test/r/rpl_ndb_relay_space.result create mode 100644 mysql-test/r/rpl_relay_space_innodb.result rename mysql-test/r/{rpl000005.result => rpl_relay_space_myisam.result} (100%) create mode 100644 mysql-test/r/rpl_relay_space_ndb.result create mode 100644 mysql-test/t/rpl_auto_increment-slave.opt create mode 100644 mysql-test/t/rpl_ndb_auto_inc-master.opt create mode 100644 mysql-test/t/rpl_ndb_auto_inc.test create mode 100644 mysql-test/t/rpl_ndb_relay_space.test create mode 100644 mysql-test/t/rpl_relay_space_innodb-master.opt create mode 100644 mysql-test/t/rpl_relay_space_innodb-slave.opt create mode 100644 mysql-test/t/rpl_relay_space_innodb.test create mode 100644 mysql-test/t/rpl_relay_space_myisam.test diff --git a/mysql-test/extra/rpl_tests/rpl000006.test b/mysql-test/extra/rpl_tests/rpl000006.test index 272e5744d9c..e4fbe841346 100644 --- a/mysql-test/extra/rpl_tests/rpl000006.test +++ b/mysql-test/extra/rpl_tests/rpl000006.test @@ -1,3 +1,11 @@ +########################################################### +# Change Author: JBM +# Change Date: 2006-2-2 +# Change: Added ENGINE=$engine_type for first create table +# Reason: Only MyISAM supports load from master no need to +# run test case for other engines, in addition test will +# fail if other engines are set as default engine +########################################################### # # Test forced timestamp # @@ -5,7 +13,7 @@ # Don't log table creating to the slave as we want to test LOAD TABLE set SQL_LOG_BIN=0,timestamp=200006; -create table t1(t timestamp not null,a char(1)); +eval create table t1(t timestamp not null,a char(1))ENGINE=$engine_type; insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; connection slave; diff --git a/mysql-test/t/rpl000005.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test similarity index 76% rename from mysql-test/t/rpl000005.test rename to mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index 0a2b7f9458a..57b74c80b58 100644 --- a/mysql-test/t/rpl000005.test +++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -3,6 +3,10 @@ # Change Date: 2006-01-17 # Change: Added order by in select #################### +# Change Date: 2006-02-02 +# Change: renamed to make bettre sense, +# and wrapped per Engine test +############################ source include/master-slave.inc; # @@ -10,7 +14,7 @@ source include/master-slave.inc; # SHOW VARIABLES LIKE 'relay_log_space_limit'; -CREATE TABLE t1 (name varchar(64), age smallint(3)); +eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type; INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; INSERT into t1 SET name='Caleb', age=1; diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result index 9abb4db7974..42e43546ffb 100644 --- a/mysql-test/r/rpl000004.result +++ b/mysql-test/r/rpl000004.result @@ -5,11 +5,11 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0; -create table t1 (word char(20) not null, index(word)); +create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; load data infile '../../std_data/words.dat' into table t1; -create table t2 (word char(20) not null); +create table t2 (word char(20) not null)ENGINE=MyISAM; load data infile '../../std_data/words.dat' into table t2; -create table t3 (word char(20) not null primary key); +create table t3 (word char(20) not null primary key)ENGINE=MyISAM; load table t1 from master; load table t2 from master; load table t3 from master; diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result index e4c2006c2f0..bb8d57a30cf 100644 --- a/mysql-test/r/rpl000006.result +++ b/mysql-test/r/rpl000006.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0,timestamp=200006; -create table t1(t timestamp not null,a char(1)); +create table t1(t timestamp not null,a char(1))ENGINE=MyISAM; insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; unix_timestamp(t) diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result index 9a3a2e7af3f..27569a087da 100644 --- a/mysql-test/r/rpl000009.result +++ b/mysql-test/r/rpl000009.result @@ -38,12 +38,12 @@ mysql mysqltest mysqltest2 test -create table mysqltest2.t1(n int, s char(20)); -create table mysqltest2.t2(n int, s text); +create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; +create table mysqltest2.t2(n int, s text)ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table mysqltest.t1(n int, s char(20)); -create table mysqltest.t2(n int, s text); +create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM; +create table mysqltest.t2(n int, s text)ENGINE=MyISAM; insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), (13, 'thirteen test'); diff --git a/mysql-test/r/rpl_LD_INFILE.result b/mysql-test/r/rpl_LD_INFILE.result index a2e4ef7b83b..b092dd9e088 100644 --- a/mysql-test/r/rpl_LD_INFILE.result +++ b/mysql-test/r/rpl_LD_INFILE.result @@ -4,118 +4,114 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; DELETE FROM test.t1 WHERE a = 'abashed'; DELETE FROM test.t1; LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; -SELECT * FROM test.t1; +SELECT * FROM test.t1 ORDER BY a DESC; a -abase -abased -abasement -abasements -abases -abash -abashed -abashes -abashing -abasing -abate -abated -abatement -abatements -abater -abates -abating -Abba -abbe -abbey -abbeys -abbot -abbots -Abbott -abbreviate -abbreviated -abbreviates -abbreviating -abbreviation -abbreviations -Abby -abdomen -abdomens -abdominal -abduct -abducted -abduction -abductions -abductor -abductors -abducts -Abe -abed -Abel -Abelian -Abelson -Aberdeen -Abernathy -aberrant aberration -SELECT * FROM test.t1; +aberrant +Abernathy +Aberdeen +Abelson +Abelian +Abel +abed +Abe +abducts +abductors +abductor +abductions +abduction +abducted +abduct +abdominal +abdomens +abdomen +Abby +abbreviations +abbreviation +abbreviating +abbreviates +abbreviated +abbreviate +Abbott +abbots +abbot +abbeys +abbey +abbe +Abba +abating +abates +abater +abatements +abatement +abated +abate +abasing +abashing +abashes +abashed +abash +abases +abasements +abasement +abased +abase +SELECT * FROM test.t1 ORDER BY a DESC; a -abase -abased -abasement -abasements -abases -abash -abashed -abashes -abashing -abasing -abate -abated -abatement -abatements -abater -abates -abating -Abba -abbe -abbey -abbeys -abbot -abbots -Abbott -abbreviate -abbreviated -abbreviates -abbreviating -abbreviation -abbreviations -Abby -abdomen -abdomens -abdominal -abduct -abducted -abduction -abductions -abductor -abductors -abducts -Abe -abed -Abel -Abelian -Abelson -Aberdeen -Abernathy -aberrant aberration -DROP PROCEDURE IF EXISTS test.p1; -Warnings: -Note 1305 PROCEDURE p1 does not exist +aberrant +Abernathy +Aberdeen +Abelson +Abelian +Abel +abed +Abe +abducts +abductors +abductor +abductions +abduction +abducted +abduct +abdominal +abdomens +abdomen +Abby +abbreviations +abbreviation +abbreviating +abbreviates +abbreviated +abbreviate +Abbott +abbots +abbot +abbeys +abbey +abbe +Abba +abating +abates +abater +abatements +abatement +abated +abate +abasing +abashing +abashes +abashed +abash +abases +abasements +abasement +abased +abase DROP TABLE test.t1; diff --git a/mysql-test/r/rpl_ndb_auto_inc.result b/mysql-test/r/rpl_ndb_auto_inc.result new file mode 100644 index 00000000000..9eca51ad2d9 --- /dev/null +++ b/mysql-test/r/rpl_ndb_auto_inc.result @@ -0,0 +1,185 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3; +insert into t1 values (NULL,1),(NULL,2),(NULL,3); +select * from t1; +a b +12 1 +22 2 +32 3 +select * from t1; +a b +12 1 +22 2 +32 3 +drop table t1; +create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam; +insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4); +delete from t1 where b=4; +insert into t1 values (NULL,5),(NULL,6); +select * from t1; +a b +1 1 +2 2 +3 3 +22 5 +32 6 +select * from t1; +a b +1 1 +2 2 +3 3 +22 5 +32 6 +drop table t1; +set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10; +show variables like "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; +insert into t1 values (NULL),(5),(NULL); +insert into t1 values (250),(NULL); +select * from t1; +a +5 +10 +110 +250 +310 +insert into t1 values (1000); +set @@insert_id=400; +insert into t1 values(NULL),(NULL); +select * from t1; +a +5 +10 +110 +250 +310 +400 +410 +1000 +select * from t1; +a +5 +10 +110 +250 +310 +400 +410 +1000 +drop table t1; +create table t1 (a int not null auto_increment, primary key (a)) engine=innodb; +insert into t1 values (NULL),(5),(NULL); +insert into t1 values (250),(NULL); +select * from t1; +a +5 +10 +110 +250 +310 +insert into t1 values (1000); +set @@insert_id=400; +insert into t1 values(NULL),(NULL); +select * from t1; +a +5 +10 +110 +250 +310 +400 +410 +1000 +select * from t1; +a +5 +10 +110 +250 +310 +400 +410 +1000 +drop table t1; +set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; +create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; +insert into t1 values (NULL),(5),(NULL),(NULL); +insert into t1 values (500),(NULL),(502),(NULL),(NULL); +select * from t1; +a +1 +5 +6 +7 +500 +501 +502 +503 +504 +set @@insert_id=600; +insert into t1 values(600),(NULL),(NULL); +ERROR 23000: Duplicate entry '600' for key 1 +set @@insert_id=600; +insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL); +select * from t1; +a +1 +5 +6 +7 +500 +501 +502 +503 +504 +600 +610 +611 +select * from t1; +a +1 +5 +6 +7 +500 +501 +502 +503 +504 +600 +610 +611 +drop table t1; +set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1; +create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; +insert into t1 values(2),(12),(22),(32),(42); +insert into t1 values (NULL),(NULL); +insert into t1 values (3),(NULL),(NULL); +select * from t1; +a +1 +3 +11 +21 +31 +select * from t1; +a +1 +2 +3 +11 +12 +21 +22 +31 +32 +42 +drop table t1; diff --git a/mysql-test/r/rpl_ndb_relay_space.result b/mysql-test/r/rpl_ndb_relay_space.result new file mode 100644 index 00000000000..1e25b7fe8c1 --- /dev/null +++ b/mysql-test/r/rpl_ndb_relay_space.result @@ -0,0 +1,25 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SHOW VARIABLES LIKE 'relay_log_space_limit'; +Variable_name Value +relay_log_space_limit 0 +CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=NDB; +INSERT INTO t1 SET name='Andy', age=31; +INSERT t1 SET name='Jacob', age=2; +INSERT into t1 SET name='Caleb', age=1; +ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; +SELECT * FROM t1 ORDER BY id; +name age id +Andy 31 00000001 +Caleb 1 00000002 +Jacob 2 00000003 +SELECT * FROM t1 ORDER BY id; +name age id +Andy 31 00000001 +Caleb 1 00000002 +Jacob 2 00000003 +drop table t1; diff --git a/mysql-test/r/rpl_relay_space_innodb.result b/mysql-test/r/rpl_relay_space_innodb.result new file mode 100644 index 00000000000..80d8c48c241 --- /dev/null +++ b/mysql-test/r/rpl_relay_space_innodb.result @@ -0,0 +1,25 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SHOW VARIABLES LIKE 'relay_log_space_limit'; +Variable_name Value +relay_log_space_limit 0 +CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=InnoDB; +INSERT INTO t1 SET name='Andy', age=31; +INSERT t1 SET name='Jacob', age=2; +INSERT into t1 SET name='Caleb', age=1; +ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; +SELECT * FROM t1 ORDER BY id; +name age id +Andy 31 00000001 +Jacob 2 00000002 +Caleb 1 00000003 +SELECT * FROM t1 ORDER BY id; +name age id +Andy 31 00000001 +Jacob 2 00000002 +Caleb 1 00000003 +drop table t1; diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl_relay_space_myisam.result similarity index 100% rename from mysql-test/r/rpl000005.result rename to mysql-test/r/rpl_relay_space_myisam.result diff --git a/mysql-test/r/rpl_relay_space_ndb.result b/mysql-test/r/rpl_relay_space_ndb.result new file mode 100644 index 00000000000..02bff7ae881 --- /dev/null +++ b/mysql-test/r/rpl_relay_space_ndb.result @@ -0,0 +1,25 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SHOW VARIABLES LIKE 'relay_log_space_limit'; +Variable_name Value +relay_log_space_limit 0 +CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM; +INSERT INTO t1 SET name='Andy', age=31; +INSERT t1 SET name='Jacob', age=2; +INSERT into t1 SET name='Caleb', age=1; +ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; +SELECT * FROM t1 ORDER BY id; +name age id +Andy 31 00000001 +Jacob 2 00000002 +Caleb 1 00000003 +SELECT * FROM t1 ORDER BY id; +name age id +Andy 31 00000001 +Jacob 2 00000002 +Caleb 1 00000003 +drop table t1; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index b66fa869eb0..11658892c54 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -25,7 +25,6 @@ partition_03ndb : Bug#16385 ndb_binlog_basic : Results are not deterministic, Tomas will fix rpl_ndb_basic : Bug#16228 rpl_sp : Bug #16456 -#ndb_dd_disk2memory : Bug #16466 ndb_autodiscover : Needs to be fixed w.r.t binlog ndb_autodiscover2 : Needs to be fixed w.r.t binlog ndb_blob : BLOB replication causes core in master1 (Pekka will fix) @@ -33,5 +32,6 @@ system_mysql_db : Needs fixing system_mysql_db_fix : Needs fixing #ndb_alter_table_row : sometimes wrong error 1015!=1046 ndb_gis : garbled msgs from corrupt THD* +rpl_ndb_auto_inc.test : MySQL Bugs:17086 # vim: set filetype=conf: diff --git a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test index f2a02bd4dd6..993b804d469 100644 --- a/mysql-test/t/rpl000004.test +++ b/mysql-test/t/rpl000004.test @@ -1,11 +1,19 @@ +###################################### +# Change Author: JBM +# Change Date: 2006-02-02 +# Change: Added ENGINE=MyISAM +# Reason: LOAD FROM MASTER is only supported from +# MyISAM, therefore there is no reason for this test +# To use anyother Engine +###################################### source include/master-slave.inc; set SQL_LOG_BIN=0; -create table t1 (word char(20) not null, index(word)); +create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; load data infile '../../std_data/words.dat' into table t1; -create table t2 (word char(20) not null); +create table t2 (word char(20) not null)ENGINE=MyISAM; load data infile '../../std_data/words.dat' into table t2; -create table t3 (word char(20) not null primary key); +create table t3 (word char(20) not null primary key)ENGINE=MyISAM; connection slave; load table t1 from master; load table t2 from master; diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test index 81e9860c186..9de075efeaf 100644 --- a/mysql-test/t/rpl000009.test +++ b/mysql-test/t/rpl000009.test @@ -1,5 +1,14 @@ # This one assumes we are ignoring updates on tables in database mysqltest2, # but doing the ones in database mysqltest +################################################################# +# Change Author: JBM +# Change Date: 2006-02-02 +# Change: Added ENGINE=MyISAM +# Reason: NDB engine does not support sql_log_bin and the test is testing +# Different replication features. It is better that the test not be +# skipped due to NDB being default engine so that NDB will be used for +# Some of the testing when default is set to NDB +################################################################# source include/master-slave.inc; --disable_warnings @@ -49,13 +58,13 @@ set sql_log_bin = 0; create database mysqltest2; create database mysqltest; show databases; -create table mysqltest2.t1(n int, s char(20)); -create table mysqltest2.t2(n int, s text); +create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; +create table mysqltest2.t2(n int, s text)ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table mysqltest.t1(n int, s char(20)); -create table mysqltest.t2(n int, s text); +create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM; +create table mysqltest.t2(n int, s text)ENGINE=MyISAM; insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), (13, 'thirteen test'); diff --git a/mysql-test/t/rpl_LD_INFILE.test b/mysql-test/t/rpl_LD_INFILE.test index 769462b5898..06c14cf109c 100644 --- a/mysql-test/t/rpl_LD_INFILE.test +++ b/mysql-test/t/rpl_LD_INFILE.test @@ -11,7 +11,6 @@ # Begin clean up test section --disable_warnings connection master; -DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; --enable_warnings @@ -23,18 +22,15 @@ DELETE FROM test.t1; LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; -connection master; -SELECT * FROM test.t1; +SELECT * FROM test.t1 ORDER BY a DESC; save_master_pos; sync_slave_with_master; connection slave; -SELECT * FROM test.t1; - +SELECT * FROM test.t1 ORDER BY a DESC; connection master; # Lets cleanup #show binlog events; -DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; # End of 5.0 test case diff --git a/mysql-test/t/rpl_auto_increment-slave.opt b/mysql-test/t/rpl_auto_increment-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_auto_increment-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_ndb_auto_inc-master.opt b/mysql-test/t/rpl_ndb_auto_inc-master.opt new file mode 100644 index 00000000000..a8a6af19da9 --- /dev/null +++ b/mysql-test/t/rpl_ndb_auto_inc-master.opt @@ -0,0 +1 @@ +--auto-increment-increment=10 --auto-increment-offset=2 diff --git a/mysql-test/t/rpl_ndb_auto_inc.test b/mysql-test/t/rpl_ndb_auto_inc.test new file mode 100644 index 00000000000..c64fe1d2f8f --- /dev/null +++ b/mysql-test/t/rpl_ndb_auto_inc.test @@ -0,0 +1,7 @@ +##################################### +# Wrapper for rpl_auto_increment.test# +##################################### +-- source include/have_innodb.inc +let $engine_type=NDB; +let $engine_type2=myisam; +-- source extra/rpl_tests/rpl_auto_increment.test diff --git a/mysql-test/t/rpl_ndb_relay_space.test b/mysql-test/t/rpl_ndb_relay_space.test new file mode 100644 index 00000000000..93b918daab6 --- /dev/null +++ b/mysql-test/t/rpl_ndb_relay_space.test @@ -0,0 +1,7 @@ +################################## +# Wrapper rpl_sv_relay_space.test# +################################## +--source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_sv_relay_space.test + diff --git a/mysql-test/t/rpl_relay_space_innodb-master.opt b/mysql-test/t/rpl_relay_space_innodb-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_relay_space_innodb-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_relay_space_innodb-slave.opt b/mysql-test/t/rpl_relay_space_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_relay_space_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_relay_space_innodb.test b/mysql-test/t/rpl_relay_space_innodb.test new file mode 100644 index 00000000000..33bcc00bbf9 --- /dev/null +++ b/mysql-test/t/rpl_relay_space_innodb.test @@ -0,0 +1,7 @@ +################################## +# Wrapper rpl_sv_relay_space.test# +################################## +-- source include/have_innodb.inc +let $engine_type=InnoDB; +-- source extra/rpl_tests/rpl_sv_relay_space.test + diff --git a/mysql-test/t/rpl_relay_space_myisam.test b/mysql-test/t/rpl_relay_space_myisam.test new file mode 100644 index 00000000000..05bcba54c48 --- /dev/null +++ b/mysql-test/t/rpl_relay_space_myisam.test @@ -0,0 +1,6 @@ +################################## +# Wrapper rpl_sv_relay_space.test# +################################## +let $engine_type=MyISAM; +-- source extra/rpl_tests/rpl_sv_relay_space.test + From 43a9daf0b8d8611d99dd624bc0777ef136f5f12d Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Fri, 3 Feb 2006 15:38:27 +0100 Subject: [PATCH 39/54] Implemented requested changes by Lars and did some general test cleanup. Lots more togo --- mysql-test/extra/rpl_tests/rpl000006.test | 55 ----------- mysql-test/r/rpl000004.a.result | 2 - mysql-test/r/rpl000004.b.result | 2 - mysql-test/r/rpl000006.result | 29 ------ ....result => rpl_ignore_table_update.result} | 0 ...009.result => rpl_load_from_master.result} | 16 ++-- ...sult => rpl_load_table_from_master.result} | 21 +++++ ...000002.result => rpl_mixed_ddl_dml.result} | 0 mysql-test/r/rpl_relay_space_ndb.result | 25 ----- ...pl_000012.result => rpl_temp_table.result} | 0 mysql-test/t/disabled.def | 3 +- mysql-test/t/rpl000004.test | 33 ------- mysql-test/t/rpl000006.test | 2 - ....opt => rpl_ignore_table_update-slave.opt} | 0 ...0008.test => rpl_ignore_table_update.test} | 0 ...ave.opt => rpl_load_from_master-slave.opt} | 0 ...l000009.test => rpl_load_from_master.test} | 21 ++--- mysql-test/t/rpl_load_table_from_master.test | 93 +++++++++++++++++++ ...{rpl000002.test => rpl_mixed_ddl_dml.test} | 0 mysql-test/t/rpl_ndb_relay_space.test | 20 +++- mysql-test/t/rpl_relay_space_innodb.test | 20 +++- mysql-test/t/rpl_relay_space_myisam.test | 20 +++- .../{rpl_000012.test => rpl_temp_table.test} | 4 +- 23 files changed, 186 insertions(+), 180 deletions(-) delete mode 100644 mysql-test/extra/rpl_tests/rpl000006.test delete mode 100644 mysql-test/r/rpl000004.a.result delete mode 100644 mysql-test/r/rpl000004.b.result delete mode 100644 mysql-test/r/rpl000006.result rename mysql-test/r/{rpl000008.result => rpl_ignore_table_update.result} (100%) rename mysql-test/r/{rpl000009.result => rpl_load_from_master.result} (87%) rename mysql-test/r/{rpl000004.result => rpl_load_table_from_master.result} (57%) rename mysql-test/r/{rpl000002.result => rpl_mixed_ddl_dml.result} (100%) delete mode 100644 mysql-test/r/rpl_relay_space_ndb.result rename mysql-test/r/{rpl_000012.result => rpl_temp_table.result} (100%) delete mode 100644 mysql-test/t/rpl000004.test delete mode 100644 mysql-test/t/rpl000006.test rename mysql-test/t/{rpl000008-slave.opt => rpl_ignore_table_update-slave.opt} (100%) rename mysql-test/t/{rpl000008.test => rpl_ignore_table_update.test} (100%) rename mysql-test/t/{rpl000009-slave.opt => rpl_load_from_master-slave.opt} (100%) rename mysql-test/t/{rpl000009.test => rpl_load_from_master.test} (89%) create mode 100644 mysql-test/t/rpl_load_table_from_master.test rename mysql-test/t/{rpl000002.test => rpl_mixed_ddl_dml.test} (100%) rename mysql-test/t/{rpl_000012.test => rpl_temp_table.test} (93%) diff --git a/mysql-test/extra/rpl_tests/rpl000006.test b/mysql-test/extra/rpl_tests/rpl000006.test deleted file mode 100644 index e4fbe841346..00000000000 --- a/mysql-test/extra/rpl_tests/rpl000006.test +++ /dev/null @@ -1,55 +0,0 @@ -########################################################### -# Change Author: JBM -# Change Date: 2006-2-2 -# Change: Added ENGINE=$engine_type for first create table -# Reason: Only MyISAM supports load from master no need to -# run test case for other engines, in addition test will -# fail if other engines are set as default engine -########################################################### -# -# Test forced timestamp -# --- source include/master-slave.inc - -# Don't log table creating to the slave as we want to test LOAD TABLE -set SQL_LOG_BIN=0,timestamp=200006; -eval create table t1(t timestamp not null,a char(1))ENGINE=$engine_type; -insert into t1 ( a) values ('F'); -select unix_timestamp(t) from t1; -connection slave; -load table t1 from master; -select unix_timestamp(t) from t1; - -# Delete the created table on master and slave -connection master; -set SQL_LOG_BIN=1,timestamp=default; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; -connection master; - -# -# Test copying table with checksum -# - -# Don't log table creating to the slave as we want to test LOAD TABLE -set SQL_LOG_BIN=0; - -eval CREATE TABLE t1 ( - a int not null -) ENGINE=$engine_type MAX_ROWS=4000 CHECKSUM=1; -INSERT INTO t1 VALUES (1); -save_master_pos; -connection slave; -sync_with_master; -load table t1 from master; -check table t1; -drop table t1; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/r/rpl000004.a.result b/mysql-test/r/rpl000004.a.result deleted file mode 100644 index 694d7429a14..00000000000 --- a/mysql-test/r/rpl000004.a.result +++ /dev/null @@ -1,2 +0,0 @@ -Table Op Msg_type Msg_text -test.t1 check status OK diff --git a/mysql-test/r/rpl000004.b.result b/mysql-test/r/rpl000004.b.result deleted file mode 100644 index 7e05933909e..00000000000 --- a/mysql-test/r/rpl000004.b.result +++ /dev/null @@ -1,2 +0,0 @@ -count(*) -10 diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result deleted file mode 100644 index bb8d57a30cf..00000000000 --- a/mysql-test/r/rpl000006.result +++ /dev/null @@ -1,29 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -set SQL_LOG_BIN=0,timestamp=200006; -create table t1(t timestamp not null,a char(1))ENGINE=MyISAM; -insert into t1 ( a) values ('F'); -select unix_timestamp(t) from t1; -unix_timestamp(t) -200006 -load table t1 from master; -select unix_timestamp(t) from t1; -unix_timestamp(t) -200006 -set SQL_LOG_BIN=1,timestamp=default; -drop table t1; -set SQL_LOG_BIN=0; -CREATE TABLE t1 ( -a int not null -) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; -INSERT INTO t1 VALUES (1); -load table t1 from master; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -drop table t1; diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl_ignore_table_update.result similarity index 100% rename from mysql-test/r/rpl000008.result rename to mysql-test/r/rpl_ignore_table_update.result diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl_load_from_master.result similarity index 87% rename from mysql-test/r/rpl000009.result rename to mysql-test/r/rpl_load_from_master.result index 27569a087da..edf1f0ee7c9 100644 --- a/mysql-test/r/rpl000009.result +++ b/mysql-test/r/rpl_load_from_master.result @@ -13,11 +13,11 @@ drop database if exists mysqltest3; create database mysqltest2; create database mysqltest; create database mysqltest2; -create table mysqltest2.foo (n int); +create table mysqltest2.foo (n int)ENGINE=MyISAM; insert into mysqltest2.foo values(4); -create table mysqltest2.foo (n int); +create table mysqltest2.foo (n int)ENGINE=MyISAM; insert into mysqltest2.foo values(5); -create table mysqltest.bar (m int); +create table mysqltest.bar (m int)ENGINE=MyISAM; insert into mysqltest.bar values(15); select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; n m @@ -55,17 +55,17 @@ cluster_replication mysql test create database mysqltest2; -create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'original foo.t1'); -create table mysqltest2.t3(n int, s char(20)); +create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM; insert into mysqltest2.t3 values (1, 'original foo.t3'); create database mysqltest3; -create table mysqltest3.t1(n int, s char(20)); +create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest3.t1 values (1, 'original foo2.t1'); create database mysqltest; -create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest.t1 values (1, 'original bar.t1'); -create table mysqltest.t3(n int, s char(20)); +create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM; insert into mysqltest.t3 values (1, 'original bar.t3'); load data from master; show databases; diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl_load_table_from_master.result similarity index 57% rename from mysql-test/r/rpl000004.result rename to mysql-test/r/rpl_load_table_from_master.result index 42e43546ffb..308e54557fb 100644 --- a/mysql-test/r/rpl000004.result +++ b/mysql-test/r/rpl_load_table_from_master.result @@ -4,6 +4,27 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +SET SQL_LOG_BIN=0,timestamp=200006; +CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM; +INSERT INTO t1 ( a) VALUE ('F'); +select unix_timestamp(t) from t1; +unix_timestamp(t) +200006 +load table t1 from master; +select unix_timestamp(t) from t1; +unix_timestamp(t) +200006 +set SQL_LOG_BIN=1,timestamp=default; +drop table t1; +set SQL_LOG_BIN=0; +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; +INSERT INTO t1 VALUES (1); +load table t1 from master; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +drop table t1; set SQL_LOG_BIN=0; create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; load data infile '../../std_data/words.dat' into table t1; diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl_mixed_ddl_dml.result similarity index 100% rename from mysql-test/r/rpl000002.result rename to mysql-test/r/rpl_mixed_ddl_dml.result diff --git a/mysql-test/r/rpl_relay_space_ndb.result b/mysql-test/r/rpl_relay_space_ndb.result deleted file mode 100644 index 02bff7ae881..00000000000 --- a/mysql-test/r/rpl_relay_space_ndb.result +++ /dev/null @@ -1,25 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -SHOW VARIABLES LIKE 'relay_log_space_limit'; -Variable_name Value -relay_log_space_limit 0 -CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; -ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; -SELECT * FROM t1 ORDER BY id; -name age id -Andy 31 00000001 -Jacob 2 00000002 -Caleb 1 00000003 -SELECT * FROM t1 ORDER BY id; -name age id -Andy 31 00000001 -Jacob 2 00000002 -Caleb 1 00000003 -drop table t1; diff --git a/mysql-test/r/rpl_000012.result b/mysql-test/r/rpl_temp_table.result similarity index 100% rename from mysql-test/r/rpl_000012.result rename to mysql-test/r/rpl_temp_table.result diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 11658892c54..843c5a1a2e4 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -32,6 +32,7 @@ system_mysql_db : Needs fixing system_mysql_db_fix : Needs fixing #ndb_alter_table_row : sometimes wrong error 1015!=1046 ndb_gis : garbled msgs from corrupt THD* -rpl_ndb_auto_inc.test : MySQL Bugs:17086 +rpl_ndb_auto_inc : MySQL Bugs:17086 +rpl_ndb_relay_space : Results are not deterministic # vim: set filetype=conf: diff --git a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test deleted file mode 100644 index 993b804d469..00000000000 --- a/mysql-test/t/rpl000004.test +++ /dev/null @@ -1,33 +0,0 @@ -###################################### -# Change Author: JBM -# Change Date: 2006-02-02 -# Change: Added ENGINE=MyISAM -# Reason: LOAD FROM MASTER is only supported from -# MyISAM, therefore there is no reason for this test -# To use anyother Engine -###################################### -source include/master-slave.inc; - -set SQL_LOG_BIN=0; -create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; -load data infile '../../std_data/words.dat' into table t1; -create table t2 (word char(20) not null)ENGINE=MyISAM; -load data infile '../../std_data/words.dat' into table t2; -create table t3 (word char(20) not null primary key)ENGINE=MyISAM; -connection slave; -load table t1 from master; -load table t2 from master; -load table t3 from master; -check table t1; -select count(*) from t2; -select count(*) from t3; -connection master; -set SQL_LOG_BIN=1; -drop table if exists t1,t2,t3; -save_master_pos; -connection slave; -sync_with_master; -create table t1(n int); -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test deleted file mode 100644 index bca97391f8e..00000000000 --- a/mysql-test/t/rpl000006.test +++ /dev/null @@ -1,2 +0,0 @@ -let $engine_type=MyISAM; --- source extra/rpl_tests/rpl000006.test diff --git a/mysql-test/t/rpl000008-slave.opt b/mysql-test/t/rpl_ignore_table_update-slave.opt similarity index 100% rename from mysql-test/t/rpl000008-slave.opt rename to mysql-test/t/rpl_ignore_table_update-slave.opt diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl_ignore_table_update.test similarity index 100% rename from mysql-test/t/rpl000008.test rename to mysql-test/t/rpl_ignore_table_update.test diff --git a/mysql-test/t/rpl000009-slave.opt b/mysql-test/t/rpl_load_from_master-slave.opt similarity index 100% rename from mysql-test/t/rpl000009-slave.opt rename to mysql-test/t/rpl_load_from_master-slave.opt diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl_load_from_master.test similarity index 89% rename from mysql-test/t/rpl000009.test rename to mysql-test/t/rpl_load_from_master.test index 9de075efeaf..eabae3ed399 100644 --- a/mysql-test/t/rpl000009.test +++ b/mysql-test/t/rpl_load_from_master.test @@ -4,10 +4,7 @@ # Change Author: JBM # Change Date: 2006-02-02 # Change: Added ENGINE=MyISAM -# Reason: NDB engine does not support sql_log_bin and the test is testing -# Different replication features. It is better that the test not be -# skipped due to NDB being default engine so that NDB will be used for -# Some of the testing when default is set to NDB +# Reason: LOAD from master is only supported by MyISAM ################################################################# source include/master-slave.inc; @@ -28,12 +25,12 @@ save_master_pos; connection slave; sync_with_master; create database mysqltest2; -create table mysqltest2.foo (n int); +create table mysqltest2.foo (n int)ENGINE=MyISAM; insert into mysqltest2.foo values(4); connection master; -create table mysqltest2.foo (n int); +create table mysqltest2.foo (n int)ENGINE=MyISAM; insert into mysqltest2.foo values(5); -create table mysqltest.bar (m int); +create table mysqltest.bar (m int)ENGINE=MyISAM; insert into mysqltest.bar values(15); save_master_pos; connection slave; @@ -78,21 +75,21 @@ show databases; # Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM # MASTER will neither touch database mysqltest nor mysqltest3 create database mysqltest2; -create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest2.t1 values (1, 'original foo.t1'); -create table mysqltest2.t3(n int, s char(20)); +create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM; insert into mysqltest2.t3 values (1, 'original foo.t3'); create database mysqltest3; -create table mysqltest3.t1(n int, s char(20)); +create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest3.t1 values (1, 'original foo2.t1'); # Create mysqltest, and mysqltest.t1, to check that it gets replaced, # and mysqltest.t3 to check that it is not touched (there is no # mysqltest.t3 on master) create database mysqltest; -create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM; insert into mysqltest.t1 values (1, 'original bar.t1'); -create table mysqltest.t3(n int, s char(20)); +create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM; insert into mysqltest.t3 values (1, 'original bar.t3'); load data from master; diff --git a/mysql-test/t/rpl_load_table_from_master.test b/mysql-test/t/rpl_load_table_from_master.test new file mode 100644 index 00000000000..c1397a175d9 --- /dev/null +++ b/mysql-test/t/rpl_load_table_from_master.test @@ -0,0 +1,93 @@ +########################################################### +# Change Author: JBM +# Change Date: 2006-2-2 +# Change: Added ENGINE=$engine_type for first create table +# Reason: Only MyISAM supports load from master no need to +# run test case for other engines, in addition test will +# fail if other engines are set as default engine +########################################################### +# Change Author: JBM +# Change Date: 2006-2-3 +# Change: removed ENGINE=$engine_type for first create table +# and renamed test file to rpl_load_table_from_master.test. +# In addition added test requirements. +# Reason: Request from review. +############################################################ +# REQUIREMENT TEST 1: +# LOAD TABLE FROM MASTER must work with a forced timestamp. +# +# REQUIREMENTi TEST 2: +#LOAD TABLE FROM MASTER must work with table checksum +############################################################ +# +# Test forced timestamp +# +-- source include/master-slave.inc + +# Don't log table creating to the slave as we want to test LOAD TABLE +SET SQL_LOG_BIN=0,timestamp=200006; +eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM; +INSERT INTO t1 ( a) VALUE ('F'); +select unix_timestamp(t) from t1; +connection slave; +load table t1 from master; +select unix_timestamp(t) from t1; + +# Delete the created table on master and slave +connection master; +set SQL_LOG_BIN=1,timestamp=default; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; +connection master; + +# +# Test copying table with checksum +# + +# Don't log table creating to the slave as we want to test LOAD TABLE +set SQL_LOG_BIN=0; + +eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; +INSERT INTO t1 VALUES (1); +save_master_pos; +connection slave; +sync_with_master; +load table t1 from master; +check table t1; +drop table t1; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; + +connection master; +set SQL_LOG_BIN=0; +create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; +load data infile '../../std_data/words.dat' into table t1; +create table t2 (word char(20) not null)ENGINE=MyISAM; +load data infile '../../std_data/words.dat' into table t2; +create table t3 (word char(20) not null primary key)ENGINE=MyISAM; +connection slave; +load table t1 from master; +load table t2 from master; +load table t3 from master; +check table t1; +select count(*) from t2; +select count(*) from t3; +connection master; +set SQL_LOG_BIN=1; +drop table if exists t1,t2,t3; +save_master_pos; +connection slave; +sync_with_master; +create table t1(n int); +drop table t1; + + + + + +# End of 4.1 tests diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl_mixed_ddl_dml.test similarity index 100% rename from mysql-test/t/rpl000002.test rename to mysql-test/t/rpl_mixed_ddl_dml.test diff --git a/mysql-test/t/rpl_ndb_relay_space.test b/mysql-test/t/rpl_ndb_relay_space.test index 93b918daab6..0484d807996 100644 --- a/mysql-test/t/rpl_ndb_relay_space.test +++ b/mysql-test/t/rpl_ndb_relay_space.test @@ -1,6 +1,20 @@ -################################## -# Wrapper rpl_sv_relay_space.test# -################################## +################################### +# Wrapper rpl_sv_relay_space.test # +# This test has to be wrapped as # +# It tests ndb, innodb and MyISAM.# +# By Wrapping we are saving some # +# space and making the test more # +# Maintainable by only having one # +# test file and reusing the code # +# In Addition, INNODB has to have # +# Option files during this test # +# to force innodb on the slave # +# else the test will fail # +################################### +#Change Author: JBM # +#Change Date: 2006-02-03 # +#Change: Added Comments # +################################### --source include/have_ndb.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_sv_relay_space.test diff --git a/mysql-test/t/rpl_relay_space_innodb.test b/mysql-test/t/rpl_relay_space_innodb.test index 33bcc00bbf9..90276d87523 100644 --- a/mysql-test/t/rpl_relay_space_innodb.test +++ b/mysql-test/t/rpl_relay_space_innodb.test @@ -1,6 +1,20 @@ -################################## -# Wrapper rpl_sv_relay_space.test# -################################## +################################### +# Wrapper rpl_sv_relay_space.test # +# This test has to be wrapped as # +# It tests ndb, innodb and MyISAM.# +# By Wrapping we are saving some # +# space and making the test more # +# Maintainable by only having one # +# test file and reusing the code # +# In Addition, INNODB has to have # +# Option files during this test # +# to force innodb on the slave # +# else the test will fail # +################################### +#Change Author: JBM # +#Change Date: 2006-02-03 # +#Change: Added Comments # +################################### -- source include/have_innodb.inc let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_sv_relay_space.test diff --git a/mysql-test/t/rpl_relay_space_myisam.test b/mysql-test/t/rpl_relay_space_myisam.test index 05bcba54c48..cb129f7c87a 100644 --- a/mysql-test/t/rpl_relay_space_myisam.test +++ b/mysql-test/t/rpl_relay_space_myisam.test @@ -1,6 +1,20 @@ -################################## -# Wrapper rpl_sv_relay_space.test# -################################## +################################### +# Wrapper rpl_sv_relay_space.test # +# This test has to be wrapped as # +# It tests ndb, innodb and MyISAM.# +# By Wrapping we are saving some # +# space and making the test more # +# Maintainable by only having one # +# test file and reusing the code # +# In Addition, INNODB has to have # +# Option files during this test # +# to force innodb on the slave # +# else the test will fail # +################################### +#Change Author: JBM # +#Change Date: 2006-02-03 # +#Change: Added Comments # +################################### let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_sv_relay_space.test diff --git a/mysql-test/t/rpl_000012.test b/mysql-test/t/rpl_temp_table.test similarity index 93% rename from mysql-test/t/rpl_000012.test rename to mysql-test/t/rpl_temp_table.test index 17f1d38dbae..c29fa8e676d 100644 --- a/mysql-test/t/rpl_000012.test +++ b/mysql-test/t/rpl_temp_table.test @@ -1,7 +1,7 @@ # drop table t1 t2 t3 are included int master-slave.inc -# Like rpl000013, meaningful only in statement-based: +# meaningful only in statement-based: + -- source include/have_binlog_format_statement.inc -# Should work on both stm and row -- source include/master-slave.inc From 23b68e3a5a7d49a6f5a53c83b48929344cab7ea4 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Tue, 7 Feb 2006 00:18:10 +0100 Subject: [PATCH 40/54] More test case updates for using RPL with NDB as default engine --- mysql-test/extra/rpl_tests/rpl_log.test | 16 ++- mysql-test/r/rpl_create_database.result | 18 ++- mysql-test/r/rpl_ndb_func003.result | 29 +++++ mysql-test/r/rpl_ndb_log.result | 139 +++++++++++++++++++++ mysql-test/r/rpl_redirect.result | 8 +- mysql-test/r/rpl_replicate_do.result | 2 +- mysql-test/r/rpl_row_log.result | 42 +++---- mysql-test/r/rpl_row_log_innodb.result | 113 +++++++++++++++++ mysql-test/r/rpl_row_sp001.result | 16 +-- mysql-test/t/disabled.def | 1 + mysql-test/t/rpl_create_database.test | 6 +- mysql-test/t/rpl_ndb_func003.test | 11 ++ mysql-test/t/rpl_ndb_log-master.opt | 1 + mysql-test/t/rpl_ndb_log.test | 12 ++ mysql-test/t/rpl_redirect.test | 8 +- mysql-test/t/rpl_replicate_do.test | 2 +- mysql-test/t/rpl_row_func003-slave.opt | 1 + mysql-test/t/rpl_row_log.test | 9 +- mysql-test/t/rpl_row_log_innodb-master.opt | 1 + mysql-test/t/rpl_row_log_innodb-slave.opt | 1 + mysql-test/t/rpl_row_log_innodb.test | 12 ++ mysql-test/t/rpl_row_sp001.test | 16 +-- 22 files changed, 400 insertions(+), 64 deletions(-) create mode 100644 mysql-test/r/rpl_ndb_func003.result create mode 100644 mysql-test/r/rpl_ndb_log.result create mode 100644 mysql-test/r/rpl_row_log_innodb.result create mode 100644 mysql-test/t/rpl_ndb_func003.test create mode 100644 mysql-test/t/rpl_ndb_log-master.opt create mode 100644 mysql-test/t/rpl_ndb_log.test create mode 100644 mysql-test/t/rpl_row_func003-slave.opt create mode 100644 mysql-test/t/rpl_row_log_innodb-master.opt create mode 100644 mysql-test/t/rpl_row_log_innodb-slave.opt create mode 100644 mysql-test/t/rpl_row_log_innodb.test diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 252c1fcca41..1e5074d9260 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -30,21 +30,25 @@ let $VERSION=`select version()`; connection master; reset master; -create table t1(n int not null auto_increment primary key); +eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type; insert into t1 values (NULL); drop table t1; -create table t1 (word char(20) not null); +eval create table t1 (word char(20) not null)ENGINE=$engine_type; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; select count(*) from t1; drop table t1; --replace_result $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events; --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events from 102 limit 1; --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events from 102 limit 2; --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events from 102 limit 2,1; flush logs; @@ -64,7 +68,7 @@ flush logs; # To make it predictable, we do a useless update now, but which has the # interest of making the slave catch both rotate events. -create table t5 (a int); +eval create table t5 (a int)ENGINE=$engine_type; drop table t5; # Sync slave and force it to start on another binary log @@ -82,14 +86,16 @@ connection master; # Create some entries for second log -create table t1 (n int); +eval create table t1 (n int)ENGINE=$engine_type; insert into t1 values (1); drop table t1; --replace_result $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events; --replace_result $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events in 'master-bin.000002'; show binary logs; save_master_pos; @@ -99,9 +105,11 @@ sync_with_master; show binary logs; --replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events in 'slave-bin.000001' from 4; --replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events in 'slave-bin.000002' from 4; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 16 # 23 # 33 # diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result index 74708c8ec9a..cb3c7944962 100644 --- a/mysql-test/r/rpl_create_database.result +++ b/mysql-test/r/rpl_create_database.result @@ -61,16 +61,14 @@ mysql mysqltest_prometheus mysqltest_sisyfos test -SHOW CREATE TABLE mysqltest_prometheus.t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW CREATE TABLE mysqltest_sisyfos.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +USE mysqltest_prometheus; +SHOW TABLES; +Tables_in_mysqltest_prometheus +t1 +USE mysqltest_sisyfos; +SHOW TABLES; +Tables_in_mysqltest_sisyfos +t2 DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; diff --git a/mysql-test/r/rpl_ndb_func003.result b/mysql-test/r/rpl_ndb_func003.result new file mode 100644 index 00000000000..ad72a3fb244 --- /dev/null +++ b/mysql-test/r/rpl_ndb_func003.result @@ -0,0 +1,29 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +DROP FUNCTION IF EXISTS test.f1; +DROP TABLE IF EXISTS test.t1; +CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB; +create function test.f1() RETURNS CHAR(16) +BEGIN +DECLARE tmp CHAR(16); +DECLARE var_name FLOAT; +SET var_name = RAND(); +IF var_name > .6 +THEN SET tmp = 'Texas'; +ELSE SET tmp = 'MySQL'; +END IF; +RETURN tmp; +END| +INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1()); +INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1()); +SET AUTOCOMMIT=0; +START TRANSACTION; +INSERT INTO test.t1 VALUES (null,test.f1()); +ROLLBACK; +SET AUTOCOMMIT=1; +DROP FUNCTION test.f1; +DROP TABLE test.t1; diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result new file mode 100644 index 00000000000..523495e284f --- /dev/null +++ b/mysql-test/r/rpl_ndb_log.result @@ -0,0 +1,139 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +stop slave; +reset master; +reset slave; +reset master; +create table t1(n int not null auto_increment primary key)ENGINE=NDB; +insert into t1 values (NULL); +drop table t1; +create table t1 (word char(20) not null)ENGINE=NDB; +load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +select count(*) from t1; +count(*) +69 +drop table t1; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # cluster_replication.apply_status +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Query 1 # COMMIT +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # cluster_replication.apply_status +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Query 1 # COMMIT +master-bin.000001 # Query 1 # use `test`; drop table t1 +show binlog events from 102 limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +show binlog events from 102 limit 2; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +show binlog events from 102 limit 2,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Table_map 1 # cluster_replication.apply_status +flush logs; +create table t5 (a int)ENGINE=NDB; +drop table t5; +start slave; +flush logs; +stop slave; +create table t1 (n int)ENGINE=NDB; +insert into t1 values (1); +drop table t1; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # cluster_replication.apply_status +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Query 1 # COMMIT +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # cluster_replication.apply_status +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Query 1 # COMMIT +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +show binlog events in 'master-bin.000002'; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB +master-bin.000002 # Query 1 # BEGIN +master-bin.000002 # Table_map 1 # cluster_replication.apply_status +master-bin.000002 # Write_rows 1 # +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Query 1 # use `test`; drop table t5 +master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=NDB +master-bin.000002 # Query 1 # BEGIN +master-bin.000002 # Table_map 1 # cluster_replication.apply_status +master-bin.000002 # Write_rows 1 # +master-bin.000002 # Table_map 1 # test.t1 +master-bin.000002 # Write_rows 1 # +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Query 1 # use `test`; drop table t1 +show binary logs; +Log_name File_size +master-bin.000001 1087 +master-bin.000002 991 +start slave; +show binary logs; +Log_name File_size +slave-bin.000001 1494 +slave-bin.000002 583 +show binlog events in 'slave-bin.000001' from 4; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +slave-bin.000001 # Query 2 # BEGIN +slave-bin.000001 # Table_map 2 # cluster_replication.apply_status +slave-bin.000001 # Write_rows 2 # +slave-bin.000001 # Table_map 2 # test.t1 +slave-bin.000001 # Write_rows 2 # +slave-bin.000001 # Query 2 # COMMIT +slave-bin.000001 # Query 1 # use `test`; drop table t1 +slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +slave-bin.000001 # Query 2 # BEGIN +slave-bin.000001 # Table_map 2 # cluster_replication.apply_status +slave-bin.000001 # Write_rows 2 # +slave-bin.000001 # Query 2 # COMMIT +slave-bin.000001 # Query 1 # use `test`; drop table t1 +slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB +slave-bin.000001 # Query 2 # BEGIN +slave-bin.000001 # Table_map 2 # cluster_replication.apply_status +slave-bin.000001 # Write_rows 2 # +slave-bin.000001 # Query 2 # COMMIT +slave-bin.000001 # Query 1 # use `test`; drop table t5 +slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +show binlog events in 'slave-bin.000002' from 4; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=NDB +slave-bin.000002 # Query 2 # BEGIN +slave-bin.000002 # Table_map 2 # cluster_replication.apply_status +slave-bin.000002 # Write_rows 2 # +slave-bin.000002 # Table_map 2 # test.t1 +slave-bin.000002 # Write_rows 2 # +slave-bin.000002 # Query 2 # COMMIT +slave-bin.000002 # Query 1 # use `test`; drop table t1 +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 991 # # master-bin.000002 Yes Yes # 0 0 991 # None 0 No # +show binlog events in 'slave-bin.000005' from 4; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result index 9dd51eaba4d..b4ef84da559 100644 --- a/mysql-test/r/rpl_redirect.result +++ b/mysql-test/r/rpl_redirect.result @@ -12,26 +12,26 @@ Server_id Host Port Rpl_recovery_rank Master_id create table t1 ( n int); insert into t1 values (1),(2),(3),(4); insert into t1 values(5); -select * from t1; +SELECT * FROM t1 ORDER BY n; n 1 2 3 4 5 -select * from t1; +SELECT * FROM t1 ORDER BY n; n 1 2 3 4 -select * from t1; +SELECT * FROM t1 ORDER BY n; n 1 2 3 4 -select * from t1; +SELECT * FROM t1 ORDER BY n; n 1 2 diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index 438671fb103..9f7e1a81507 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -16,7 +16,7 @@ insert into t1 values(15),(16),(17); update t1 set m=20 where m=16; delete from t1 where m=17; create table t11 select * from t1; -select * from t1; +select * from t1 ORDER BY m; m 15 20 diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result index 8784d9d16e2..85c93702de2 100644 --- a/mysql-test/r/rpl_row_log.result +++ b/mysql-test/r/rpl_row_log.result @@ -8,10 +8,10 @@ stop slave; reset master; reset slave; reset master; -create table t1(n int not null auto_increment primary key); +create table t1(n int not null auto_increment primary key)ENGINE=MyISAM; insert into t1 values (NULL); drop table t1; -create table t1 (word char(20) not null); +create table t1 (word char(20) not null)ENGINE=MyISAM; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) @@ -20,41 +20,41 @@ drop table t1; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Table_map 1 # test.t1 master-bin.000001 # Write_rows 1 # master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null) +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Table_map 1 # test.t1 master-bin.000001 # Write_rows 1 # master-bin.000001 # Query 1 # use `test`; drop table t1 show binlog events from 102 limit 1; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM show binlog events from 102 limit 2; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Table_map 1 # test.t1 show binlog events from 102 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Write_rows 1 # flush logs; -create table t5 (a int); +create table t5 (a int)ENGINE=MyISAM; drop table t5; start slave; flush logs; stop slave; -create table t1 (n int); +create table t1 (n int)ENGINE=MyISAM; insert into t1 values (1); drop table t1; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Table_map 1 # test.t1 master-bin.000001 # Write_rows 1 # master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null) +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Table_map 1 # test.t1 master-bin.000001 # Write_rows 1 # master-bin.000001 # Query 1 # use `test`; drop table t1 @@ -62,44 +62,44 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000002 # Query 1 # use `test`; create table t5 (a int) +master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM master-bin.000002 # Query 1 # use `test`; drop table t5 -master-bin.000002 # Query 1 # use `test`; create table t1 (n int) +master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM master-bin.000002 # Table_map 1 # test.t1 master-bin.000002 # Write_rows 1 # master-bin.000002 # Query 1 # use `test`; drop table t1 show binary logs; Log_name File_size -master-bin.000001 1306 -master-bin.000002 499 +master-bin.000001 1332 +master-bin.000002 525 start slave; show binary logs; Log_name File_size -slave-bin.000001 1467 -slave-bin.000002 337 +slave-bin.000001 1506 +slave-bin.000002 350 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 -slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM slave-bin.000001 # Table_map 1 # test.t1 slave-bin.000001 # Write_rows 1 # slave-bin.000001 # Query 1 # use `test`; drop table t1 -slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null) +slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM slave-bin.000001 # Table_map 1 # test.t1 slave-bin.000001 # Write_rows 1 # slave-bin.000001 # Query 1 # use `test`; drop table t1 -slave-bin.000001 # Query 1 # use `test`; create table t5 (a int) +slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM slave-bin.000001 # Query 1 # use `test`; drop table t5 slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 show binlog events in 'slave-bin.000002' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 -slave-bin.000002 # Query 1 # use `test`; create table t1 (n int) +slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM slave-bin.000002 # Table_map 1 # test.t1 slave-bin.000002 # Write_rows 1 # slave-bin.000002 # Query 1 # use `test`; drop table t1 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 499 # # master-bin.000002 Yes Yes # 0 0 499 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 525 # # master-bin.000002 Yes Yes # 0 0 525 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result new file mode 100644 index 00000000000..2bc7534f31f --- /dev/null +++ b/mysql-test/r/rpl_row_log_innodb.result @@ -0,0 +1,113 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +stop slave; +reset master; +reset slave; +reset master; +create table t1(n int not null auto_increment primary key)ENGINE=InnoDB; +insert into t1 values (NULL); +drop table t1; +create table t1 (word char(20) not null)ENGINE=InnoDB; +load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +select count(*) from t1; +count(*) +69 +drop table t1; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query 1 # use `test`; drop table t1 +show binlog events from 102 limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB +show binlog events from 102 limit 2; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB +master-bin.000001 # Table_map 1 # test.t1 +show binlog events from 102 limit 2,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Write_rows 1 # +flush logs; +create table t5 (a int)ENGINE=InnoDB; +drop table t5; +start slave; +flush logs; +stop slave; +create table t1 (n int)ENGINE=InnoDB; +insert into t1 values (1); +drop table t1; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # +master-bin.000001 # Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +show binlog events in 'master-bin.000002'; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB +master-bin.000002 # Query 1 # use `test`; drop table t5 +master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB +master-bin.000002 # Table_map 1 # test.t1 +master-bin.000002 # Write_rows 1 # +master-bin.000002 # Xid 1 # COMMIT /* XID */ +master-bin.000002 # Query 1 # use `test`; drop table t1 +show binary logs; +Log_name File_size +master-bin.000001 1386 +master-bin.000002 552 +start slave; +show binary logs; +Log_name File_size +slave-bin.000001 1560 +slave-bin.000002 377 +show binlog events in 'slave-bin.000001' from 4; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB +slave-bin.000001 # Table_map 1 # test.t1 +slave-bin.000001 # Write_rows 1 # +slave-bin.000001 # Xid 1 # COMMIT /* XID */ +slave-bin.000001 # Query 1 # use `test`; drop table t1 +slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB +slave-bin.000001 # Table_map 1 # test.t1 +slave-bin.000001 # Write_rows 1 # +slave-bin.000001 # Xid 1 # COMMIT /* XID */ +slave-bin.000001 # Query 1 # use `test`; drop table t1 +slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB +slave-bin.000001 # Query 1 # use `test`; drop table t5 +slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +show binlog events in 'slave-bin.000002' from 4; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB +slave-bin.000002 # Table_map 1 # test.t1 +slave-bin.000002 # Write_rows 1 # +slave-bin.000002 # Xid 1 # COMMIT /* XID */ +slave-bin.000002 # Query 1 # use `test`; drop table t1 +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 552 # # master-bin.000002 Yes Yes # 0 0 552 # None 0 No # +show binlog events in 'slave-bin.000005' from 4; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log diff --git a/mysql-test/r/rpl_row_sp001.result b/mysql-test/r/rpl_row_sp001.result index 0276fb721b9..8c26c061376 100644 --- a/mysql-test/r/rpl_row_sp001.result +++ b/mysql-test/r/rpl_row_sp001.result @@ -28,52 +28,52 @@ UPDATE test.t2 set t ='NONE'; END CASE; end// INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 NEW 2 NEW 3 NEW 4 NEW -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 NEW 2 NEW 3 NEW 4 NEW call test.p2(1); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 Tex 2 Tex 3 Tex 4 Tex -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 Tex 2 Tex 3 Tex 4 Tex call test.p2(2); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 SQL 2 SQL 3 SQL 4 SQL -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 SQL 2 SQL 3 SQL 4 SQL call test.p2(3); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 NONE 2 NONE 3 NONE 4 NONE -select * from test.t2; +SELECT * FROM t2 ORDER BY a; a t 1 NONE 2 NONE diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index a002a34796f..4ffce33766a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -32,3 +32,4 @@ ndb_gis : garbled msgs from corrupt THD* rpl_ndb_auto_inc : MySQL Bugs:17086 rpl_ndb_relay_space : Results are not deterministic ndb_binlog_ddl_multi : Bug #17038 +rpl_ndb_log : MySQL Bugs: #17158 diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test index 7ec73132113..70cff8daca2 100644 --- a/mysql-test/t/rpl_create_database.test +++ b/mysql-test/t/rpl_create_database.test @@ -58,8 +58,10 @@ let $VERSION=`select version()`; SHOW DATABASES; sync_slave_with_master; SHOW DATABASES; -SHOW CREATE TABLE mysqltest_prometheus.t1; -SHOW CREATE TABLE mysqltest_sisyfos.t2; +USE mysqltest_prometheus; +SHOW TABLES; +USE mysqltest_sisyfos; +SHOW TABLES; connection master; DROP DATABASE IF EXISTS mysqltest_prometheus; diff --git a/mysql-test/t/rpl_ndb_func003.test b/mysql-test/t/rpl_ndb_func003.test new file mode 100644 index 00000000000..2d240385555 --- /dev/null +++ b/mysql-test/t/rpl_ndb_func003.test @@ -0,0 +1,11 @@ +################################### +# Wrapper for rpl_row_func003.test# +# This test was orginally designed# +# To test InnoDB using RBR, but # +# It can also be used to test NDB # +# So this wrapper is being used to# +# reduce test case code # +################################### +-- source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_row_func003.test diff --git a/mysql-test/t/rpl_ndb_log-master.opt b/mysql-test/t/rpl_ndb_log-master.opt new file mode 100644 index 00000000000..e0d075c3fbd --- /dev/null +++ b/mysql-test/t/rpl_ndb_log-master.opt @@ -0,0 +1 @@ +--skip-external-locking diff --git a/mysql-test/t/rpl_ndb_log.test b/mysql-test/t/rpl_ndb_log.test new file mode 100644 index 00000000000..e883d24b977 --- /dev/null +++ b/mysql-test/t/rpl_ndb_log.test @@ -0,0 +1,12 @@ +################################### +# Wrapper for rpl_row_log.test # +# Added wrapper so that MyISAM & # +# Innodb and NDB could all use the# +# Same test. NDB produced a diff # +# bin-log # +################################### +-- source include/have_binlog_format_row.inc +-- source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_log.test + diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test index c001d85d2f8..58321babb39 100644 --- a/mysql-test/t/rpl_redirect.test +++ b/mysql-test/t/rpl_redirect.test @@ -32,12 +32,12 @@ insert into t1 values(5); connection master; enable_rpl_parse; # The first of the queries will be sent to the slave, the second to the master. -select * from t1; -select * from t1; +SELECT * FROM t1 ORDER BY n; +SELECT * FROM t1 ORDER BY n; disable_rpl_parse; -select * from t1; +SELECT * FROM t1 ORDER BY n; connection slave; -select * from t1; +SELECT * FROM t1 ORDER BY n; drop table t1; connection master; drop table t1; diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test index 5a2cb50d53a..c9294175f15 100644 --- a/mysql-test/t/rpl_replicate_do.test +++ b/mysql-test/t/rpl_replicate_do.test @@ -21,7 +21,7 @@ create table t11 select * from t1; save_master_pos; connection slave; sync_with_master; -select * from t1; +select * from t1 ORDER BY m; select * from t2; --error 1146 select * from t11; diff --git a/mysql-test/t/rpl_row_func003-slave.opt b/mysql-test/t/rpl_row_func003-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_func003-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_row_log.test b/mysql-test/t/rpl_row_log.test index 29abf5bb93e..5a9b21165e5 100644 --- a/mysql-test/t/rpl_row_log.test +++ b/mysql-test/t/rpl_row_log.test @@ -1,4 +1,11 @@ -# Requires row base logging +################################### +# Wrapper for rpl_row_log.test # +# Added wrapper so that MyISAM & # +# Innodb and NDB could all use the# +# Same test. NDB produced a diff # +# bin-log # +################################### -- source include/have_binlog_format_row.inc +let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_log.test diff --git a/mysql-test/t/rpl_row_log_innodb-master.opt b/mysql-test/t/rpl_row_log_innodb-master.opt new file mode 100644 index 00000000000..e0d075c3fbd --- /dev/null +++ b/mysql-test/t/rpl_row_log_innodb-master.opt @@ -0,0 +1 @@ +--skip-external-locking diff --git a/mysql-test/t/rpl_row_log_innodb-slave.opt b/mysql-test/t/rpl_row_log_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_log_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_row_log_innodb.test b/mysql-test/t/rpl_row_log_innodb.test new file mode 100644 index 00000000000..f4a9cf06291 --- /dev/null +++ b/mysql-test/t/rpl_row_log_innodb.test @@ -0,0 +1,12 @@ +################################### +# Wrapper for rpl_row_log.test # +# Added wrapper so that MyISAM & # +# Innodb and NDB could all use the# +# Same test. NDB produced a diff # +# bin-log # +################################### +-- source include/have_binlog_format_row.inc +-- source include/have_innodb.inc +let $engine_type=InnoDB; +-- source extra/rpl_tests/rpl_log.test + diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test index f6ac18dc78b..6a38feb0999 100644 --- a/mysql-test/t/rpl_row_sp001.test +++ b/mysql-test/t/rpl_row_sp001.test @@ -85,34 +85,34 @@ delimiter ;// INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -select * from test.t2; +SELECT * FROM t2 ORDER BY a; connection master; call test.p2(1); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; sync_slave_with_master; -select * from test.t2; +SELECT * FROM t2 ORDER BY a; connection master; call test.p2(2); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -select * from test.t2; +SELECT * FROM t2 ORDER BY a; connection master; call test.p2(3); -select * from test.t2; +SELECT * FROM t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -select * from test.t2; +SELECT * FROM t2 ORDER BY a; ##Used for debugging #show binlog events; From 54e07cea2e7ffb47c94bb29c4122b3d82d2a0a52 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Tue, 7 Feb 2006 14:51:46 +0100 Subject: [PATCH 41/54] More rpl test updates with using ndb as default engine --- mysql-test/r/rpl_drop_temp.result | 4 ++-- mysql-test/r/rpl_err_ignoredtable.result | 6 +++--- mysql-test/r/rpl_load_table_from_master.result | 2 ++ mysql-test/t/disabled.def | 2 +- mysql-test/t/rpl_drop_temp.test | 11 +++++++++-- mysql-test/t/rpl_err_ignoredtable.test | 10 ++++++---- mysql-test/t/rpl_foreign_key_innodb-slave.opt | 1 + mysql-test/t/rpl_load_table_from_master.test | 11 ++++++++--- 8 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 mysql-test/t/rpl_foreign_key_innodb-slave.opt diff --git a/mysql-test/r/rpl_drop_temp.result b/mysql-test/r/rpl_drop_temp.result index 04fe094ea26..40d578dd13e 100644 --- a/mysql-test/r/rpl_drop_temp.result +++ b/mysql-test/r/rpl_drop_temp.result @@ -5,8 +5,8 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create database if not exists mysqltest; -create temporary table mysqltest.t1 (n int); -create temporary table mysqltest.t2 (n int); +create temporary table mysqltest.t1 (n int)ENGINE=MyISAM; +create temporary table mysqltest.t2 (n int)ENGINE=MyISAM; show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 diff --git a/mysql-test/r/rpl_err_ignoredtable.result b/mysql-test/r/rpl_err_ignoredtable.result index 84072be7d44..27db9c0372c 100644 --- a/mysql-test/r/rpl_err_ignoredtable.result +++ b/mysql-test/r/rpl_err_ignoredtable.result @@ -7,14 +7,14 @@ start slave; create table t1 (a int primary key); create table t4 (a int primary key); insert into t1 values (1),(1); -ERROR 23000: Duplicate entry '1' for key 1 +Got one of the listed errors insert into t4 values (1),(2); show tables like 't1'; Tables_in_test (t1) show tables like 't4'; Tables_in_test (t4) t4 -SELECT * FROM test.t4; +SELECT * FROM test.t4 ORDER BY a; a 1 2 @@ -33,7 +33,7 @@ select (@id := id) - id from t3; kill @id; drop table t2,t3; insert into t4 values (3),(4); -SELECT * FROM test.t4; +SELECT * FROM test.t4 ORDER BY a; a 1 2 diff --git a/mysql-test/r/rpl_load_table_from_master.result b/mysql-test/r/rpl_load_table_from_master.result index 308e54557fb..9d9a1d7d6cb 100644 --- a/mysql-test/r/rpl_load_table_from_master.result +++ b/mysql-test/r/rpl_load_table_from_master.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +"******************** Test Requirment 1 *************" SET SQL_LOG_BIN=0,timestamp=200006; CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM; INSERT INTO t1 ( a) VALUE ('F'); @@ -17,6 +18,7 @@ unix_timestamp(t) set SQL_LOG_BIN=1,timestamp=default; drop table t1; set SQL_LOG_BIN=0; +"******************** Test Requirment 2 *************" CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; INSERT INTO t1 VALUES (1); load table t1 from master; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 4ffce33766a..5010e8afb81 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -30,6 +30,6 @@ ndb_autodiscover2 : Needs to be fixed w.r.t binlog #ndb_alter_table_row : sometimes wrong error 1015!=1046 ndb_gis : garbled msgs from corrupt THD* rpl_ndb_auto_inc : MySQL Bugs:17086 -rpl_ndb_relay_space : Results are not deterministic +rpl_ndb_relay_space : Bug 16993 ndb_binlog_ddl_multi : Bug #17038 rpl_ndb_log : MySQL Bugs: #17158 diff --git a/mysql-test/t/rpl_drop_temp.test b/mysql-test/t/rpl_drop_temp.test index 55a4e741d7c..53261e91b7b 100644 --- a/mysql-test/t/rpl_drop_temp.test +++ b/mysql-test/t/rpl_drop_temp.test @@ -1,10 +1,17 @@ +############################################## +# Change Author: JBM +# Change Date: 2006-02-07 +# Change: Added ENGINE=MyISAM +# Purpose: According to TU in 16552 This is how +# to work around NDB's issue with temp tables +############################################## source include/master-slave.inc; --disable_warnings create database if not exists mysqltest; --enable_warnings -create temporary table mysqltest.t1 (n int); -create temporary table mysqltest.t2 (n int); +create temporary table mysqltest.t1 (n int)ENGINE=MyISAM; +create temporary table mysqltest.t2 (n int)ENGINE=MyISAM; sync_slave_with_master; connection master; disconnect master; diff --git a/mysql-test/t/rpl_err_ignoredtable.test b/mysql-test/t/rpl_err_ignoredtable.test index 81aa76225be..42ca8cf2e8b 100644 --- a/mysql-test/t/rpl_err_ignoredtable.test +++ b/mysql-test/t/rpl_err_ignoredtable.test @@ -1,15 +1,17 @@ # Test for # Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave # still checks that it has the same error as on the master. +########################################################################## +# 2006-02-07 JBM Added error code 1022 for NDB Engine + ORDER BY +########################################################################## -# Requires statement logging -- source include/master-slave.inc connection master; create table t1 (a int primary key); create table t4 (a int primary key); # generate an error that goes to the binlog ---error 1062 +--error 1022, 1062 insert into t1 values (1),(1); insert into t4 values (1),(2); save_master_pos; @@ -19,7 +21,7 @@ sync_with_master; # check that the table has been ignored, because otherwise the test is nonsense show tables like 't1'; show tables like 't4'; -SELECT * FROM test.t4; +SELECT * FROM test.t4 ORDER BY a; connection master; drop table t1; save_master_pos; @@ -53,7 +55,7 @@ connection master1; save_master_pos; connection slave; sync_with_master; -SELECT * FROM test.t4; +SELECT * FROM test.t4 ORDER BY a; connection master1; DROP TABLE test.t4; diff --git a/mysql-test/t/rpl_foreign_key_innodb-slave.opt b/mysql-test/t/rpl_foreign_key_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_foreign_key_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_load_table_from_master.test b/mysql-test/t/rpl_load_table_from_master.test index c1397a175d9..aad113878d3 100644 --- a/mysql-test/t/rpl_load_table_from_master.test +++ b/mysql-test/t/rpl_load_table_from_master.test @@ -15,15 +15,14 @@ ############################################################ # REQUIREMENT TEST 1: # LOAD TABLE FROM MASTER must work with a forced timestamp. -# -# REQUIREMENTi TEST 2: -#LOAD TABLE FROM MASTER must work with table checksum ############################################################ # # Test forced timestamp # -- source include/master-slave.inc +-- echo "******************** Test Requirment 1 *************" + # Don't log table creating to the slave as we want to test LOAD TABLE SET SQL_LOG_BIN=0,timestamp=200006; eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM; @@ -49,6 +48,12 @@ connection master; # Don't log table creating to the slave as we want to test LOAD TABLE set SQL_LOG_BIN=0; +####################################################### +# REQUIREMENTi TEST 2: +#LOAD TABLE FROM MASTER must work with table checksum +####################################################### +-- echo "******************** Test Requirment 2 *************" + eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1; INSERT INTO t1 VALUES (1); save_master_pos; From 824ac10fbcf2286ff82e39d51418198023ed16b5 Mon Sep 17 00:00:00 2001 From: "reggie@linux.site" <> Date: Tue, 7 Feb 2006 10:45:11 -0600 Subject: [PATCH 42/54] BUG# 17082 - Client hangs when creating tables with partition no test case needed since simply creating a partitioned table reproduces it. --- sql/sql_partition.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index c6df76f2674..abc3ce0f7f9 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2397,7 +2397,8 @@ char *generate_partition_syntax(partition_info *part_info, DBUG_ENTER("generate_partition_syntax"); write_part_state= (part_info->part_state && !part_info->part_state_len); - if (unlikely(((fptr= create_temp_file(path,mysql_tmpdir,"psy", 0,0))) < 0)) + if (unlikely(((fptr= create_temp_file(path,mysql_tmpdir,"psy", O_RDWR, + MYF(MY_WME)))) < 0)) DBUG_RETURN(NULL); #ifndef __WIN__ unlink(path); From 23d99ee03c8e360dade0d6063b5e938fa5c2e196 Mon Sep 17 00:00:00 2001 From: "brian@zim.tangent.org" <> Date: Tue, 7 Feb 2006 22:42:57 -0800 Subject: [PATCH 43/54] The handlerton structures for archive and CSV had not been updated. Nicht so gute. I also fixed CSV to use fast alter table and put in a test in archive in case someone tries to do the same there (hint... it won't work). --- mysql-test/r/archive.result | 55 +++++++++++++++++++++++++++++++++++++ mysql-test/r/csv.result | 55 +++++++++++++++++++++++++++++++++++++ mysql-test/t/archive.test | 28 +++++++++++++++++++ mysql-test/t/csv.test | 26 ++++++++++++++++++ sql/ha_archive.cc | 4 ++- storage/csv/ha_tina.cc | 10 ++++++- storage/csv/ha_tina.h | 2 ++ 7 files changed, 178 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 201383b06be..26d95a4dc8d 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12537,4 +12537,59 @@ SELECT c FROM t5 WHERE a IN (32, 23, 5); c NULL posterity +drop table t1; +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +v +def +abc +hij +3r4f +alter table t1 change v v2 varchar(32); +select * from t1; +v2 +def +abc +hij +3r4f +alter table t1 change v2 v varchar(64); +select * from t1; +v +def +abc +hij +3r4f +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +v +def +abc +lmn +3r4f +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +i v +1 def +2 abc +3 lmn +4 3r4f +update t1 set i=5 where i=3; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 change i i bigint; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +i v +4 3r4f drop table t1, t2, t4, t5; diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 6f58fdfe54a..9e63b82c29d 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5017,3 +5017,58 @@ insert t1 values (1),(2),(3),(4),(5); truncate table t1; affected rows: 0 drop table t1; +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +v +def +abc +hij +3r4f +alter table t1 change v v2 varchar(32); +select * from t1; +v2 +def +abc +hij +3r4f +alter table t1 change v2 v varchar(64); +select * from t1; +v +def +abc +hij +3r4f +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +v +def +abc +lmn +3r4f +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +i v +1 def +2 abc +3 lmn +4 3r4f +update t1 set i=5 where i=3; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 change i i bigint; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +i v +4 3r4f +drop table t1; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 185210b8c54..68e3192e8a4 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1456,6 +1456,34 @@ SELECT c FROM t5; SELECT c FROM t5 WHERE a =3; SELECT c FROM t5 WHERE a IN (32, 23, 5); +# Adding this in case someone tries to add fast alter table and doesn't tes +# it. +# Some additional tests for new, faster alter table. Note that most of the +# whole alter table code is being tested all around the test suite already. +# + +drop table t1; +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v v2 varchar(32); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v2 v varchar(64); +select * from t1; +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +# Regular alter table +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +update t1 set i=5 where i=3; +select * from t1; +alter table t1 change i i bigint; +select * from t1; +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); + # # Cleanup, test is over # diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 6f0f42f109c..916a2132deb 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1418,3 +1418,29 @@ truncate table t1; -- truncate --disable_info drop table t1; +# +# Some additional tests for new, faster alter table. Note that most of the +# whole alter table code is being tested all around the test suite already. +# + +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v v2 varchar(32); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v2 v varchar(64); +select * from t1; +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +# Regular alter table +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +update t1 set i=5 where i=3; +select * from t1; +alter table t1 change i i bigint; +select * from t1; +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +drop table t1; diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc index 366ae08462b..9239f67fced 100644 --- a/sql/ha_archive.cc +++ b/sql/ha_archive.cc @@ -177,7 +177,9 @@ handlerton archive_hton = { NULL, /* Partition flags */ NULL, /* Alter table flags */ NULL, /* Alter interface */ - HTON_NO_FLAGS + HTON_NO_FLAGS, + NULL, /* binlog_func */ + NULL /* binlog_log_query */ }; static handler *archive_create_handler(TABLE_SHARE *table) diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 17c842f43e0..bc228d5c767 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -92,7 +92,9 @@ handlerton tina_hton= { NULL, /* Alter table flags */ NULL, /* Alter Tablespace */ NULL, /* Fill FILES Table */ - HTON_CAN_RECREATE + HTON_CAN_RECREATE, + NULL, /* binlog_func */ + NULL /* binlog_log_query */ }; /***************************************************************************** @@ -1018,6 +1020,12 @@ int ha_tina::create(const char *name, TABLE *table_arg, DBUG_RETURN(0); } +bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes) +{ + return COMPATIBLE_DATA_YES; +} + mysql_declare_plugin { MYSQL_STORAGE_ENGINE_PLUGIN, diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index a11d4281389..572d05cb779 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -122,6 +122,8 @@ public: int extra(enum ha_extra_function operation); int delete_all_rows(void); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + bool check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); From 760bc0a22547842b0c1bcc8ac26a476b41f2edc9 Mon Sep 17 00:00:00 2001 From: "reggie@linux.site" <> Date: Wed, 8 Feb 2006 04:05:18 -0600 Subject: [PATCH 44/54] bug# 17082 Client hangs when creating tables with partition This bug was only on Windows but we updated the call to create_temporary_file to match what is being done in other areas of MySQL --- sql/sql_partition.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index abc3ce0f7f9..3d138b4e3d0 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2397,8 +2397,9 @@ char *generate_partition_syntax(partition_info *part_info, DBUG_ENTER("generate_partition_syntax"); write_part_state= (part_info->part_state && !part_info->part_state_len); - if (unlikely(((fptr= create_temp_file(path,mysql_tmpdir,"psy", O_RDWR, - MYF(MY_WME)))) < 0)) + if (unlikely(((fptr= create_temp_file(path,mysql_tmpdir,"psy", + O_RDWR | O_BINARY | O_TRUNC | + O_TEMPORARY, MYF(MY_WME)))) < 0)) DBUG_RETURN(NULL); #ifndef __WIN__ unlink(path); From 790c9a05f4de3d6af5898983efd1760660c11aef Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Wed, 8 Feb 2006 15:03:09 +0300 Subject: [PATCH 45/54] Post merge-fixes. Apply a patch by Jonas for NDB diskdata. --- mysql-test/r/sp-code.result | 4 ++-- storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index c9fe170dda6..bb0adae6bab 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -155,11 +155,11 @@ Pos Instruction 0 stmt 9 "drop temporary table if exists sudoku..." 1 stmt 1 "create temporary table sudoku_work ( ..." 2 stmt 1 "create temporary table sudoku_schedul..." -3 stmt 95 "call sudoku_init(" +3 stmt 94 "call sudoku_init(" 4 jump_if_not 7(8) p_naive@0 5 stmt 4 "update sudoku_work set cnt = 0 where ..." 6 jump 8 -7 stmt 95 "call sudoku_count(" +7 stmt 94 "call sudoku_count(" 8 stmt 6 "insert into sudoku_schedule (row,col)..." 9 set v_scounter@2 0 10 set v_i@3 1 diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 41a705fea2d..e0324c2c8ea 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -431,6 +431,7 @@ void AsyncFile::openReq(Request* request) m_fs.EXECUTE_DIRECT(block, GSN_FSWRITEREQ, signal, FsReadWriteReq::FixedLength + 1); + retry: Uint32 size = request->par.open.page_size; char* buf = (char*)m_page_ptr.p; while(size > 0){ @@ -457,7 +458,7 @@ void AsyncFile::openReq(Request* request) close(theFd); theFd = ::open(theFileName.c_str(), new_flags, mode); if (theFd != -1) - continue; + goto retry; } #endif close(theFd); From 75b6720509d70201c15762cae623b24d8fb38c2b Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 13:08:19 +0100 Subject: [PATCH 46/54] More updates for using NDB as default and some bug fixes along the way --- mysql-test/extra/rpl_tests/rpl_insert_id.test | 25 +++++++++++-------- mysql-test/extra/rpl_tests/rpl_row_001.test | 4 +-- mysql-test/r/rpl_insert_id.result | 22 ++++++++-------- mysql-test/r/rpl_ndb_log.result | 10 ++++++-- mysql-test/r/rpl_row_001.result | 18 ++++++------- mysql-test/r/rpl_row_blob_innodb.result | 4 +-- mysql-test/r/rpl_row_blob_myisam.result | 4 +-- mysql-test/r/rpl_row_trig002.result | 14 ++++++++--- mysql-test/r/rpl_skip_error.result | 2 +- mysql-test/r/rpl_sporadic_master.result | 2 +- mysql-test/r/rpl_temporary.result | 14 +++++------ mysql-test/t/rpl_row_blob_innodb-slave.opt | 1 + mysql-test/t/rpl_row_blob_innodb.test | 2 +- mysql-test/t/rpl_row_trig002.test | 10 +++++--- mysql-test/t/rpl_skip_error.test | 5 +++- mysql-test/t/rpl_sporadic_master.test | 5 +++- mysql-test/t/rpl_temporary.test | 19 ++++++++------ 17 files changed, 95 insertions(+), 66 deletions(-) create mode 100644 mysql-test/t/rpl_row_blob_innodb-slave.opt diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index adf8631bea2..69addb16e43 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -1,3 +1,6 @@ +########################################################### +# 2006-02-01: By JBM: Added 1022, ORDER BY and PK for NDB +########################################################### # See if queries that use both auto_increment and LAST_INSERT_ID() # are replicated well @@ -7,16 +10,16 @@ #should work for both SBR and RBR connection master; -create table t1(a int auto_increment, key(a)); -create table t2(b int auto_increment, c int, key(b)); +create table t1(a int auto_increment, PRIMARY key(a)); +create table t2(b int auto_increment, c int, PRIMARY key(b)); insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); save_master_pos; connection slave; sync_with_master; -select * from t1; -select * from t2; +select * from t1 ORDER BY a; +select * from t2 ORDER BY b; connection master; #check if multi-line inserts, #which set last_insert_id to the first id inserted, @@ -44,18 +47,18 @@ connection master; drop table t2; drop table t1; -create table t1(a int auto_increment, key(a)); -create table t2(b int auto_increment, c int, key(b)); +create table t1(a int auto_increment, PRIMARY key(a)); +create table t2(b int auto_increment, c int, PRIMARY key(b)); insert into t1 values (10); insert into t1 values (null),(null),(null); insert into t2 values (5,0); -insert into t2 (c) select * from t1; -select * from t2; +insert into t2 (c) select * from t1 ORDER BY a; +select * from t2 ORDER BY b; save_master_pos; connection slave; sync_with_master; -select * from t1; -select * from t2; +select * from t1 ORDER BY a; +select * from t2 ORDER BY b; connection master; drop table t1; drop table t2; @@ -71,7 +74,7 @@ connection master; SET TIMESTAMP=1000000000; CREATE TABLE t1 ( a INT UNIQUE ); SET FOREIGN_KEY_CHECKS=0; ---error 1062 +--error 1022, 1062 INSERT INTO t1 VALUES (1),(1); sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test index 2efefb3cd63..44638bdac96 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_001.test +++ b/mysql-test/extra/rpl_tests/rpl_row_001.test @@ -5,7 +5,7 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; -SELECT * FROM t1 LIMIT 10; +SELECT * FROM t1 ORDER BY word LIMIT 10; # # Test slave with wrong password @@ -30,7 +30,7 @@ sleep 2; CREATE TABLE t3(n INT); INSERT INTO t3 VALUES(1),(2); sync_slave_with_master; -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY n; SELECT SUM(LENGTH(word)) FROM t1; connection master; DROP TABLE t1,t3; diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result index 8482f631553..0f772a7d288 100644 --- a/mysql-test/r/rpl_insert_id.result +++ b/mysql-test/r/rpl_insert_id.result @@ -4,18 +4,18 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create table t1(a int auto_increment, key(a)); -create table t2(b int auto_increment, c int, key(b)); +create table t1(a int auto_increment, PRIMARY key(a)); +create table t2(b int auto_increment, c int, PRIMARY key(b)); insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); -select * from t1; +select * from t1 ORDER BY a; a 1 2 3 4 -select * from t2; +select * from t2 ORDER BY b; b c 1 4 drop table t1; @@ -40,26 +40,26 @@ b c 6 11 drop table t2; drop table t1; -create table t1(a int auto_increment, key(a)); -create table t2(b int auto_increment, c int, key(b)); +create table t1(a int auto_increment, PRIMARY key(a)); +create table t2(b int auto_increment, c int, PRIMARY key(b)); insert into t1 values (10); insert into t1 values (null),(null),(null); insert into t2 values (5,0); -insert into t2 (c) select * from t1; -select * from t2; +insert into t2 (c) select * from t1 ORDER BY a; +select * from t2 ORDER BY b; b c 5 0 6 10 7 11 8 12 9 13 -select * from t1; +select * from t1 ORDER BY a; a 10 11 12 13 -select * from t2; +select * from t2 ORDER BY b; b c 5 0 6 10 @@ -72,4 +72,4 @@ SET TIMESTAMP=1000000000; CREATE TABLE t1 ( a INT UNIQUE ); SET FOREIGN_KEY_CHECKS=0; INSERT INTO t1 VALUES (1),(1); -ERROR 23000: Duplicate entry '1' for key 1 +Got one of the listed errors diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index 523495e284f..5238943e725 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -32,6 +32,8 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not nul master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # cluster_replication.apply_status master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # use `test`; drop table t1 show binlog events from 102 limit 1; @@ -68,6 +70,8 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not nul master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # cluster_replication.apply_status master-bin.000001 # Write_rows 1 # +master-bin.000001 # Table_map 1 # test.t1 +master-bin.000001 # Write_rows 1 # master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 @@ -90,12 +94,12 @@ master-bin.000002 # Query 1 # COMMIT master-bin.000002 # Query 1 # use `test`; drop table t1 show binary logs; Log_name File_size -master-bin.000001 1087 +master-bin.000001 1798 master-bin.000002 991 start slave; show binary logs; Log_name File_size -slave-bin.000001 1494 +slave-bin.000001 2205 slave-bin.000002 583 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info @@ -112,6 +116,8 @@ slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null slave-bin.000001 # Query 2 # BEGIN slave-bin.000001 # Table_map 2 # cluster_replication.apply_status slave-bin.000001 # Write_rows 2 # +slave-bin.000001 # Table_map 2 # test.t1 +slave-bin.000001 # Write_rows 2 # slave-bin.000001 # Query 2 # COMMIT slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB diff --git a/mysql-test/r/rpl_row_001.result b/mysql-test/r/rpl_row_001.result index 990ebbc5d7a..b07a99644fc 100644 --- a/mysql-test/r/rpl_row_001.result +++ b/mysql-test/r/rpl_row_001.result @@ -7,25 +7,25 @@ start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; -SELECT * FROM t1 LIMIT 10; +SELECT * FROM t1 ORDER BY word LIMIT 10; word Aarhus +Aarhus +Aarhus +Aarhus +Aaron +Aaron +Aaron Aaron Ababa -aback -abaft -abandon -abandoned -abandoning -abandonment -abandons +Ababa STOP SLAVE; SET PASSWORD FOR root@"localhost" = PASSWORD('foo'); START SLAVE; SET PASSWORD FOR root@"localhost" = PASSWORD(''); CREATE TABLE t3(n INT); INSERT INTO t3 VALUES(1),(2); -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY n; n 1 2 diff --git a/mysql-test/r/rpl_row_blob_innodb.result b/mysql-test/r/rpl_row_blob_innodb.result index 92671f10ab9..713ac8bae81 100644 --- a/mysql-test/r/rpl_row_blob_innodb.result +++ b/mysql-test/r/rpl_row_blob_innodb.result @@ -9,7 +9,7 @@ DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** CREATE TABLE test.t1 (c1 int not null auto_increment, -data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type; +data LONGBLOB, PRIMARY KEY(c1))ENGINE=engine_type; **** Data Insert Section test.t1 ***** @@ -76,7 +76,7 @@ c1 INT NOT NULL PRIMARY KEY, c2 TEXT, c3 INT, c4 LONGBLOB, -KEY(c3))ENGINE=$engine_type; +KEY(c3))ENGINE=engine_type; *** Setup Values For test.t2 *** set @x0 = '01234567012345670123456701234567'; diff --git a/mysql-test/r/rpl_row_blob_myisam.result b/mysql-test/r/rpl_row_blob_myisam.result index 92671f10ab9..713ac8bae81 100644 --- a/mysql-test/r/rpl_row_blob_myisam.result +++ b/mysql-test/r/rpl_row_blob_myisam.result @@ -9,7 +9,7 @@ DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** CREATE TABLE test.t1 (c1 int not null auto_increment, -data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type; +data LONGBLOB, PRIMARY KEY(c1))ENGINE=engine_type; **** Data Insert Section test.t1 ***** @@ -76,7 +76,7 @@ c1 INT NOT NULL PRIMARY KEY, c2 TEXT, c3 INT, c4 LONGBLOB, -KEY(c3))ENGINE=$engine_type; +KEY(c3))ENGINE=engine_type; *** Setup Values For test.t2 *** set @x0 = '01234567012345670123456701234567'; diff --git a/mysql-test/r/rpl_row_trig002.result b/mysql-test/r/rpl_row_trig002.result index 62dc2f17562..794104db750 100644 --- a/mysql-test/r/rpl_row_trig002.result +++ b/mysql-test/r/rpl_row_trig002.result @@ -13,14 +13,14 @@ CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id)); CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'| INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com'); -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; id domain 1 example.com 2 mysql.com 3 earthmotherwear.com 4 yahoo.com 5 example.com -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; id domain 1 example.com 2 mysql.com @@ -45,13 +45,19 @@ value domain_id mailaccount_id program keey No 5 NULL spamfilter scan_incoming Yes 1 NULL spamfilter scan_incoming DELETE FROM test.t1 WHERE id = 1; -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; id domain 2 mysql.com 3 earthmotherwear.com 4 yahoo.com 5 example.com -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; +id domain +2 mysql.com +3 earthmotherwear.com +4 yahoo.com +5 example.com +SELECT * FROM test.t1 ORDER BY id; id domain 2 mysql.com 3 earthmotherwear.com diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result index e52426c381c..c66e73d7c59 100644 --- a/mysql-test/r/rpl_skip_error.result +++ b/mysql-test/r/rpl_skip_error.result @@ -8,7 +8,7 @@ create table t1 (n int not null primary key); insert into t1 values (1); insert into t1 values (1); insert into t1 values (2),(3); -select * from t1; +select * from t1 ORDER BY n; n 1 2 diff --git a/mysql-test/r/rpl_sporadic_master.result b/mysql-test/r/rpl_sporadic_master.result index 789c3bf2b2b..14fb673a081 100644 --- a/mysql-test/r/rpl_sporadic_master.result +++ b/mysql-test/r/rpl_sporadic_master.result @@ -15,7 +15,7 @@ insert into t1 values (NULL),(NULL); flush logs; truncate table t1; insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); -select * from t1; +select * from t1 ORDER BY n; n 10 11 diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index a7dbfd44944..24900fab56a 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -24,15 +24,15 @@ drop table if exists t1,t2; create table t1(f int); create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; insert into t3 select * from t1 where f<6; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; insert into t2 select count(*) from t3; insert into t3 select * from t1 where f>=4; drop temporary table t3; insert into t2 select count(*) from t3; drop temporary table t3; -select * from t2; +select * from t2 ORDER BY f; f 5 7 @@ -46,13 +46,13 @@ SET TIMESTAMP=1040323938; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); SET TIMESTAMP=1040323945; SET @@session.pseudo_thread_id=1; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; SET TIMESTAMP=1040323952; SET @@session.pseudo_thread_id=1; insert into t3 select * from t1 where f<6; SET TIMESTAMP=1040324145; SET @@session.pseudo_thread_id=2; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; SET TIMESTAMP=1040324186; SET @@session.pseudo_thread_id=1; insert into t2 select count(*) from t3; @@ -68,9 +68,9 @@ insert into t2 select count(*) from t3; SET TIMESTAMP=1040324224; SET @@session.pseudo_thread_id=2; drop temporary table t3; -select * from t2; +select * from t2 ORDER BY f; f 5 7 drop table t1,t2; -create temporary table t3 (f int); +create temporary table t3 (f int)ENGINE=MyISAM; diff --git a/mysql-test/t/rpl_row_blob_innodb-slave.opt b/mysql-test/t/rpl_row_blob_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_blob_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_row_blob_innodb.test b/mysql-test/t/rpl_row_blob_innodb.test index b6832010e22..0e43af8c388 100644 --- a/mysql-test/t/rpl_row_blob_innodb.test +++ b/mysql-test/t/rpl_row_blob_innodb.test @@ -2,6 +2,6 @@ # Wrapper for rpl_row_blob.test# ################################# -- source include/have_innodb.inc -let $engine_type=INNODB; +let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_row_blob.test diff --git a/mysql-test/t/rpl_row_trig002.test b/mysql-test/t/rpl_row_trig002.test index 2cd84009b2b..d2a1b6327dd 100644 --- a/mysql-test/t/rpl_row_trig002.test +++ b/mysql-test/t/rpl_row_trig002.test @@ -37,12 +37,12 @@ delimiter ;| INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com'); -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; #show binlog events; save_master_pos; connection slave; sync_with_master; -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; connection master; INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming'); @@ -60,11 +60,13 @@ connection master; DELETE FROM test.t1 WHERE id = 1; -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; +connection master; +SELECT * FROM test.t1 ORDER BY id; save_master_pos; connection slave; sync_with_master; -select * from test.t1; +SELECT * FROM test.t1 ORDER BY id; connection master; #show binlog events; diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test index e0e569a65b7..bfc4a2c2711 100644 --- a/mysql-test/t/rpl_skip_error.test +++ b/mysql-test/t/rpl_skip_error.test @@ -1,3 +1,6 @@ +########################################## +# 2006-02-07 By JBM: Added order by +######################################### source include/master-slave.inc; create table t1 (n int not null primary key); @@ -11,6 +14,6 @@ insert into t1 values (2),(3); save_master_pos; connection slave; sync_with_master; -select * from t1; +select * from t1 ORDER BY n; # End of 4.1 tests diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test index 26b633a1c4f..824f7abc9f5 100644 --- a/mysql-test/t/rpl_sporadic_master.test +++ b/mysql-test/t/rpl_sporadic_master.test @@ -1,3 +1,6 @@ +############################################################# +# 2006-02-07 By JBM added order by +############################################################# # test to see if replication can continue when master sporadically fails on # COM_BINLOG_DUMP and additionally limits the number of events per dump @@ -18,7 +21,7 @@ flush logs; truncate table t1; insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); sync_slave_with_master; -select * from t1; +select * from t1 ORDER BY n; connection master; drop table t1,t2; sync_slave_with_master; diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 0eb5d4074d8..3cd2357e565 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -1,3 +1,8 @@ +######################################################### +# 2006-02-07 By JBM according to 16552 MyISAM should be used +# As work around for NDB using temp tables. +########################################################## + -- source include/master-slave.inc # Clean up old slave's binlogs. @@ -55,12 +60,12 @@ create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); connection con1; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; insert into t3 select * from t1 where f<6; sleep 1; connection con2; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; sleep 1; connection con1; @@ -79,7 +84,7 @@ connection con2; insert into t2 select count(*) from t3; drop temporary table t3; -select * from t2; +select * from t2 ORDER BY f; # Commented out 8/30/2005 to make compatable with both sbr and rbr #--replace_result $VERSION VERSION @@ -98,13 +103,13 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); SET TIMESTAMP=1040323945; SET @@session.pseudo_thread_id=1; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; SET TIMESTAMP=1040323952; SET @@session.pseudo_thread_id=1; insert into t3 select * from t1 where f<6; SET TIMESTAMP=1040324145; SET @@session.pseudo_thread_id=2; -create temporary table t3(f int); +create temporary table t3(f int)ENGINE=MyISAM; SET TIMESTAMP=1040324186; SET @@session.pseudo_thread_id=1; insert into t2 select count(*) from t3; @@ -121,13 +126,13 @@ SET TIMESTAMP=1040324224; SET @@session.pseudo_thread_id=2; drop temporary table t3; -select * from t2; +select * from t2 ORDER BY f; drop table t1,t2; # Create last a temporary table that is not dropped at end to ensure that we # don't get any memory leaks for this -create temporary table t3 (f int); +create temporary table t3 (f int)ENGINE=MyISAM; sync_with_master; # The server will now close done From dacf64b6780be14c38b81e3c13228df0d3e60fa7 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 16:47:46 +0100 Subject: [PATCH 47/54] Implement suggestions from lars review --- mysql-test/extra/rpl_tests/rpl_insert_id.test | 17 ++-- .../extra/rpl_tests/rpl_insert_id_pk.test | 87 +++++++++++++++++++ mysql-test/extra/rpl_tests/rpl_row_blob.test | 9 +- mysql-test/r/rpl_insert_id.result | 8 +- mysql-test/r/rpl_insert_id_pk.result | 75 ++++++++++++++++ mysql-test/r/rpl_row_blob_innodb.result | 4 +- mysql-test/r/rpl_row_blob_myisam.result | 4 +- mysql-test/t/rpl_insert_id_pk-slave.opt | 1 + mysql-test/t/rpl_insert_id_pk.test | 6 ++ 9 files changed, 193 insertions(+), 18 deletions(-) create mode 100644 mysql-test/extra/rpl_tests/rpl_insert_id_pk.test create mode 100644 mysql-test/r/rpl_insert_id_pk.result create mode 100644 mysql-test/t/rpl_insert_id_pk-slave.opt create mode 100644 mysql-test/t/rpl_insert_id_pk.test diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index 69addb16e43..a832076fbe2 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -1,8 +1,14 @@ ########################################################### -# 2006-02-01: By JBM: Added 1022, ORDER BY and PK for NDB +# 2006-02-01: By JBM: Added 1022, ORDER BY ########################################################### # See if queries that use both auto_increment and LAST_INSERT_ID() # are replicated well +############################################################ +# REQUIREMENT +# Auto increment should work for a table with an auto_increment +# column and index but without primary key. +############################################################## + # We also check how the foreign_key_check variable is replicated @@ -10,8 +16,8 @@ #should work for both SBR and RBR connection master; -create table t1(a int auto_increment, PRIMARY key(a)); -create table t2(b int auto_increment, c int, PRIMARY key(b)); +create table t1(a int auto_increment, key(a)); +create table t2(b int auto_increment, c int, key(b)); insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); @@ -47,8 +53,8 @@ connection master; drop table t2; drop table t1; -create table t1(a int auto_increment, PRIMARY key(a)); -create table t2(b int auto_increment, c int, PRIMARY key(b)); +create table t1(a int auto_increment, key(a)); +create table t2(b int auto_increment, c int, key(b)); insert into t1 values (10); insert into t1 values (null),(null),(null); insert into t2 values (5,0); @@ -74,6 +80,7 @@ connection master; SET TIMESTAMP=1000000000; CREATE TABLE t1 ( a INT UNIQUE ); SET FOREIGN_KEY_CHECKS=0; +# Duplicate Key Errors --error 1022, 1062 INSERT INTO t1 VALUES (1),(1); sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test new file mode 100644 index 00000000000..a36c402b630 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test @@ -0,0 +1,87 @@ +########################################################### +# 2006-02-08: By JBM: +########################################################### +# See if queries that use both auto_increment and LAST_INSERT_ID() +# are replicated well +############################################################ +# REQUIREMENT +# Auto increment should work for a table with auto_increment column +# and primary key. +############################################################## + +# We also check how the foreign_key_check variable is replicated + +-- source include/master-slave.inc +#should work for both SBR and RBR + +connection master; +create table t1(a int auto_increment, primary key(a)); +create table t2(b int auto_increment, c int, primary key(b)); +insert into t1 values (1),(2),(3); +insert into t1 values (null); +insert into t2 values (null,last_insert_id()); +save_master_pos; +connection slave; +sync_with_master; +select * from t1 ORDER BY a; +select * from t2 ORDER BY b; +connection master; +#check if multi-line inserts, +#which set last_insert_id to the first id inserted, +#are replicated the same way +drop table t1; +drop table t2; +--disable_warnings +eval create table t1(a int auto_increment, key(a)) engine=$engine_type; +eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type; +--enable_warnings +SET FOREIGN_KEY_CHECKS=0; +insert into t1 values (10); +insert into t1 values (null),(null),(null); +insert into t2 values (5,0); +insert into t2 values (null,last_insert_id()); +SET FOREIGN_KEY_CHECKS=1; +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +select * from t2; +connection master; + +# check if INSERT SELECT in auto_increment is well replicated (bug #490) + +drop table t2; +drop table t1; +create table t1(a int auto_increment, primary key(a)); +create table t2(b int auto_increment, c int, primary key(b)); +insert into t1 values (10); +insert into t1 values (null),(null),(null); +insert into t2 values (5,0); +insert into t2 (c) select * from t1 ORDER BY a; +select * from t2 ORDER BY b; +save_master_pos; +connection slave; +sync_with_master; +select * from t1 ORDER BY a; +select * from t2 ORDER BY b; +connection master; +drop table t1; +drop table t2; +save_master_pos; +connection slave; +sync_with_master; + +# +# Bug#8412: Error codes reported in binary log for CHARACTER SET, +# FOREIGN_KEY_CHECKS +# +connection master; +SET TIMESTAMP=1000000000; +CREATE TABLE t1 ( a INT UNIQUE ); +SET FOREIGN_KEY_CHECKS=0; +# Duplicate Key Errors codes +--error 1022, 1062 +INSERT INTO t1 VALUES (1),(1); +sync_slave_with_master; + +# End of 4.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test index 5f1e4bea6f3..a1beafc32e1 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -20,12 +20,11 @@ DROP TABLE IF EXISTS test.t2; --echo ***** Table Create Section **** --echo --disable_warnings ---replace_result $engine_type engine_type -CREATE TABLE test.t1 (c1 int not null auto_increment, +--replace_result $engine_type # +eval CREATE TABLE test.t1 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type; --enable_warnings --echo - --echo **** Data Insert Section test.t1 ***** --echo INSERT INTO test.t1 VALUES (NULL, NULL); @@ -77,8 +76,8 @@ connection master; --echo **** Create Table test.t2 **** --echo --disable_warnings ---replace_result $engine_type engine_type -CREATE TABLE test.t2 ( +--replace_result $engine_type # +eval CREATE TABLE test.t2 ( c1 INT NOT NULL PRIMARY KEY, c2 TEXT, c3 INT, diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result index 0f772a7d288..4504ad8e5a7 100644 --- a/mysql-test/r/rpl_insert_id.result +++ b/mysql-test/r/rpl_insert_id.result @@ -4,8 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create table t1(a int auto_increment, PRIMARY key(a)); -create table t2(b int auto_increment, c int, PRIMARY key(b)); +create table t1(a int auto_increment, key(a)); +create table t2(b int auto_increment, c int, key(b)); insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); @@ -40,8 +40,8 @@ b c 6 11 drop table t2; drop table t1; -create table t1(a int auto_increment, PRIMARY key(a)); -create table t2(b int auto_increment, c int, PRIMARY key(b)); +create table t1(a int auto_increment, key(a)); +create table t2(b int auto_increment, c int, key(b)); insert into t1 values (10); insert into t1 values (null),(null),(null); insert into t2 values (5,0); diff --git a/mysql-test/r/rpl_insert_id_pk.result b/mysql-test/r/rpl_insert_id_pk.result new file mode 100644 index 00000000000..0a452d2dd73 --- /dev/null +++ b/mysql-test/r/rpl_insert_id_pk.result @@ -0,0 +1,75 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create table t1(a int auto_increment, primary key(a)); +create table t2(b int auto_increment, c int, primary key(b)); +insert into t1 values (1),(2),(3); +insert into t1 values (null); +insert into t2 values (null,last_insert_id()); +select * from t1 ORDER BY a; +a +1 +2 +3 +4 +select * from t2 ORDER BY b; +b c +1 4 +drop table t1; +drop table t2; +create table t1(a int auto_increment, key(a)) engine=innodb; +create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb; +SET FOREIGN_KEY_CHECKS=0; +insert into t1 values (10); +insert into t1 values (null),(null),(null); +insert into t2 values (5,0); +insert into t2 values (null,last_insert_id()); +SET FOREIGN_KEY_CHECKS=1; +select * from t1; +a +10 +11 +12 +13 +select * from t2; +b c +5 0 +6 11 +drop table t2; +drop table t1; +create table t1(a int auto_increment, primary key(a)); +create table t2(b int auto_increment, c int, primary key(b)); +insert into t1 values (10); +insert into t1 values (null),(null),(null); +insert into t2 values (5,0); +insert into t2 (c) select * from t1 ORDER BY a; +select * from t2 ORDER BY b; +b c +5 0 +6 10 +7 11 +8 12 +9 13 +select * from t1 ORDER BY a; +a +10 +11 +12 +13 +select * from t2 ORDER BY b; +b c +5 0 +6 10 +7 11 +8 12 +9 13 +drop table t1; +drop table t2; +SET TIMESTAMP=1000000000; +CREATE TABLE t1 ( a INT UNIQUE ); +SET FOREIGN_KEY_CHECKS=0; +INSERT INTO t1 VALUES (1),(1); +Got one of the listed errors diff --git a/mysql-test/r/rpl_row_blob_innodb.result b/mysql-test/r/rpl_row_blob_innodb.result index 713ac8bae81..b9dc831350b 100644 --- a/mysql-test/r/rpl_row_blob_innodb.result +++ b/mysql-test/r/rpl_row_blob_innodb.result @@ -9,7 +9,7 @@ DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** CREATE TABLE test.t1 (c1 int not null auto_increment, -data LONGBLOB, PRIMARY KEY(c1))ENGINE=engine_type; +data LONGBLOB, PRIMARY KEY(c1))ENGINE=#; **** Data Insert Section test.t1 ***** @@ -76,7 +76,7 @@ c1 INT NOT NULL PRIMARY KEY, c2 TEXT, c3 INT, c4 LONGBLOB, -KEY(c3))ENGINE=engine_type; +KEY(c3))ENGINE=#; *** Setup Values For test.t2 *** set @x0 = '01234567012345670123456701234567'; diff --git a/mysql-test/r/rpl_row_blob_myisam.result b/mysql-test/r/rpl_row_blob_myisam.result index 713ac8bae81..b9dc831350b 100644 --- a/mysql-test/r/rpl_row_blob_myisam.result +++ b/mysql-test/r/rpl_row_blob_myisam.result @@ -9,7 +9,7 @@ DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** CREATE TABLE test.t1 (c1 int not null auto_increment, -data LONGBLOB, PRIMARY KEY(c1))ENGINE=engine_type; +data LONGBLOB, PRIMARY KEY(c1))ENGINE=#; **** Data Insert Section test.t1 ***** @@ -76,7 +76,7 @@ c1 INT NOT NULL PRIMARY KEY, c2 TEXT, c3 INT, c4 LONGBLOB, -KEY(c3))ENGINE=engine_type; +KEY(c3))ENGINE=#; *** Setup Values For test.t2 *** set @x0 = '01234567012345670123456701234567'; diff --git a/mysql-test/t/rpl_insert_id_pk-slave.opt b/mysql-test/t/rpl_insert_id_pk-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_insert_id_pk-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_insert_id_pk.test b/mysql-test/t/rpl_insert_id_pk.test new file mode 100644 index 00000000000..148afdac87b --- /dev/null +++ b/mysql-test/t/rpl_insert_id_pk.test @@ -0,0 +1,6 @@ +################################# +# Wrapper for rpl_insert_id.test# +################################# +-- source include/have_innodb.inc +let $engine_type=innodb; +-- source extra/rpl_tests/rpl_insert_id_pk.test From 8e8235ff7ccf1c660abb5aa88e892548eae2eb82 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 17:09:57 +0100 Subject: [PATCH 48/54] implement a reviw comments --- mysql-test/r/rpl_temporary.result | 10 +++++----- mysql-test/t/rpl_temporary.test | 14 +++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index 24900fab56a..5e3030f2c7a 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -24,9 +24,9 @@ drop table if exists t1,t2; create table t1(f int); create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); insert into t3 select * from t1 where f<6; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); insert into t2 select count(*) from t3; insert into t3 select * from t1 where f>=4; drop temporary table t3; @@ -46,13 +46,13 @@ SET TIMESTAMP=1040323938; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); SET TIMESTAMP=1040323945; SET @@session.pseudo_thread_id=1; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); SET TIMESTAMP=1040323952; SET @@session.pseudo_thread_id=1; insert into t3 select * from t1 where f<6; SET TIMESTAMP=1040324145; SET @@session.pseudo_thread_id=2; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); SET TIMESTAMP=1040324186; SET @@session.pseudo_thread_id=1; insert into t2 select count(*) from t3; @@ -73,4 +73,4 @@ f 5 7 drop table t1,t2; -create temporary table t3 (f int)ENGINE=MyISAM; +create temporary table t3 (f int); diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 3cd2357e565..9c6056f9217 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -1,7 +1,3 @@ -######################################################### -# 2006-02-07 By JBM according to 16552 MyISAM should be used -# As work around for NDB using temp tables. -########################################################## -- source include/master-slave.inc @@ -60,12 +56,12 @@ create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); connection con1; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); insert into t3 select * from t1 where f<6; sleep 1; connection con2; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); sleep 1; connection con1; @@ -103,13 +99,13 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); SET TIMESTAMP=1040323945; SET @@session.pseudo_thread_id=1; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); SET TIMESTAMP=1040323952; SET @@session.pseudo_thread_id=1; insert into t3 select * from t1 where f<6; SET TIMESTAMP=1040324145; SET @@session.pseudo_thread_id=2; -create temporary table t3(f int)ENGINE=MyISAM; +create temporary table t3(f int); SET TIMESTAMP=1040324186; SET @@session.pseudo_thread_id=1; insert into t2 select count(*) from t3; @@ -132,7 +128,7 @@ drop table t1,t2; # Create last a temporary table that is not dropped at end to ensure that we # don't get any memory leaks for this -create temporary table t3 (f int)ENGINE=MyISAM; +create temporary table t3 (f int); sync_with_master; # The server will now close done From be29712da5b5ed51e92016da2040aa17ef5941e6 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 17:47:27 +0100 Subject: [PATCH 49/54] updated results --- mysql-test/r/rpl_ndb_log.result | 2 +- mysql-test/r/rpl_row_log_innodb.result | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index 5238943e725..0bc3811ce05 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=NDB; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=NDB; -load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result index 2bc7534f31f..52b5219cf43 100644 --- a/mysql-test/r/rpl_row_log_innodb.result +++ b/mysql-test/r/rpl_row_log_innodb.result @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=InnoDB; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=InnoDB; -load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 From 60af944d39b2d2800505c6e02f53f45743d202d5 Mon Sep 17 00:00:00 2001 From: "reggie@big_geek." <> Date: Wed, 8 Feb 2006 11:18:17 -0600 Subject: [PATCH 50/54] cmakefiles cleanup --- win/cmakefiles/base | 7 ++++++ win/cmakefiles/client | 10 +++++---- win/cmakefiles/extra | 12 ++++++++++ win/cmakefiles/sql | 51 ++++++++++++++++++++++++------------------- 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/win/cmakefiles/base b/win/cmakefiles/base index 6cc11a1e174..f8ac9969a26 100644 --- a/win/cmakefiles/base +++ b/win/cmakefiles/base @@ -6,6 +6,13 @@ EXEC_PROGRAM(cscript.exe win ARGS config-version.js OUT_VARIABLE out) SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF") SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996") +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") # replace /MDd with /MTd STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT}) diff --git a/win/cmakefiles/client b/win/cmakefiles/client index 711a5bf499b..7c0c6f2400b 100644 --- a/win/cmakefiles/client +++ b/win/cmakefiles/client @@ -2,7 +2,10 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/libmysql) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/zlib + ${CMAKE_SOURCE_DIR}/extra/yassl/include + ${CMAKE_SOURCE_DIR}/libmysql) ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c @@ -38,10 +41,9 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c - ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c - ${PROJECT_SOURCE_DIR}/include/mysql_version.h) + ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c) -ADD_DEPENDENCIES(mysqlclient comp_err) +ADD_DEPENDENCIES(mysqlclient GenError) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc) LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib) TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl zlib dbug yassl taocrypt wsock32) diff --git a/win/cmakefiles/extra b/win/cmakefiles/extra index 5fedfcac2b9..40327eac0ad 100644 --- a/win/cmakefiles/extra +++ b/win/cmakefiles/extra @@ -6,4 +6,16 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) ADD_EXECUTABLE(comp_err comp_err.c) TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32) +GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) + +ADD_CUSTOM_TARGET(GenError + ${COMP_ERR_EXE} --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets + --out-dir=${PROJECT_SOURCE_DIR}/sql/share/ + --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h + --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h + --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h + --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt + DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) + + diff --git a/win/cmakefiles/sql b/win/cmakefiles/sql index 8361038bf4f..ee53436a1a6 100644 --- a/win/cmakefiles/sql +++ b/win/cmakefiles/sql @@ -1,7 +1,11 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR") -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex ${CMAKE_SOURCE_DIR}/zlib) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/extra/yassl/include + ${CMAKE_SOURCE_DIR}/sql + ${CMAKE_SOURCE_DIR}/regex + ${CMAKE_SOURCE_DIR}/zlib) SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc ${CMAKE_SOURCE_DIR}/sql/message.h @@ -46,6 +50,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover. ${PROJECT_SOURCE_DIR}/sql/handlerton.cc ${PROJECT_SOURCE_DIR}/sql/lex_hash.h) TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg innobase mysys yassl zlib dbug yassl taocrypt strings vio regex wsock32) +ADD_DEPENDENCIES(mysqld GenError) # Sql Parser custom command ADD_CUSTOM_COMMAND( @@ -82,30 +87,30 @@ ADD_CUSTOM_COMMAND( DEPENDS ${PROJECT_SOURCE_DIR}/sql/handlerton.cc.in) # Error file -GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) -ADD_CUSTOM_COMMAND( - SOURCE ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt - OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h - COMMAND ${COMP_ERR_EXE} - ARGS --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets - --out-dir=${PROJECT_SOURCE_DIR}/sql/share/ - --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h - --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h - --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt - DEPENDS ${COMP_ERR_EXE} share/errmsg.txt) +#GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) +#ADD_CUSTOM_COMMAND( + #SOURCE ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt + #OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h + #COMMAND ${COMP_ERR_EXE} + #ARGS --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets + # --out-dir=${PROJECT_SOURCE_DIR}/sql/share/ +## --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h +# --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h +# --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h + # --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt + # DEPENDS ${COMP_ERR_EXE} share/errmsg.txt) -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - COMMAND echo - DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h -) +#ADD_CUSTOM_COMMAND( +# OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h +# COMMAND echo +# DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h +#) -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_SOURCE_DIR}/include/sql_state.h - COMMAND echo - DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h -) +#ADD_CUSTOM_COMMAND( +# OUTPUT ${PROJECT_SOURCE_DIR}/include/sql_state.h +# COMMAND echo +# DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h +#) # Gen_lex_hash From 33781f642e2db82eea7defb317abca1f0621799c Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 22:00:11 +0100 Subject: [PATCH 51/54] Missed a check in of new results for rpl_relay_space_myisam --- mysql-test/r/rpl_relay_space_myisam.result | 2 +- mysql-test/r/rpl_row_sp005.result | 32 +++++++++++----------- mysql-test/r/rpl_row_sp009.result | 12 ++++---- mysql-test/r/rpl_row_view01.result | 28 +++++++++---------- mysql-test/t/rpl_row_sp005.test | 19 +++++++------ mysql-test/t/rpl_row_sp009.test | 14 ++++++---- mysql-test/t/rpl_row_view01.test | 28 +++++++++++-------- 7 files changed, 72 insertions(+), 63 deletions(-) diff --git a/mysql-test/r/rpl_relay_space_myisam.result b/mysql-test/r/rpl_relay_space_myisam.result index 2518c12aace..02bff7ae881 100644 --- a/mysql-test/r/rpl_relay_space_myisam.result +++ b/mysql-test/r/rpl_relay_space_myisam.result @@ -7,7 +7,7 @@ start slave; SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 -CREATE TABLE t1 (name varchar(64), age smallint(3)); +CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM; INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; INSERT into t1 SET name='Caleb', age=1; diff --git a/mysql-test/r/rpl_row_sp005.result b/mysql-test/r/rpl_row_sp005.result index 24d68f3af3d..01e1970e0df 100644 --- a/mysql-test/r/rpl_row_sp005.result +++ b/mysql-test/r/rpl_row_sp005.result @@ -17,8 +17,8 @@ BEGIN DECLARE done INT DEFAULT 0; DECLARE spa CHAR(16); DECLARE spb,spc INT; -DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1; -DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2; +DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id; +DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; OPEN cur1; OPEN cur2; @@ -46,13 +46,13 @@ END| < ---- Master selects-- > ------------------------- CALL test.p2(); -SELECT * FROM test.t1; +SELECT * FROM test.t1 ORDER BY id; id data 8 MySQL -20 ROCKS -11 Texas 10 kyle -SELECT * FROM test.t2; +11 Texas +20 ROCKS +SELECT * FROM test.t2 ORDER BY id2; id2 1 2 @@ -61,13 +61,13 @@ id2 < ---- Slave selects-- > ------------------------ -SELECT * FROM test.t1; +SELECT * FROM test.t1 ORDER BY id; id data 8 MySQL -20 ROCKS -11 Texas 10 kyle -SELECT * FROM test.t2; +11 Texas +20 ROCKS +SELECT * FROM test.t2 ORDER BY id2; id2 1 2 @@ -77,21 +77,21 @@ id2 < ---- Master selects-- > ------------------------- CALL test.p1(); -SELECT * FROM test.t3; +SELECT * FROM test.t3 ORDER BY id3; id3 c 1 MySQL -2 ROCKS +2 kyle 3 Texas -4 kyle +4 ROCKS < ---- Slave selects-- > ------------------------ -SELECT * FROM test.t3; +SELECT * FROM test.t3 ORDER BY id3; id3 c 1 MySQL -2 ROCKS +2 kyle 3 Texas -4 kyle +4 ROCKS ALTER PROCEDURE test.p1 MODIFIES SQL DATA; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; diff --git a/mysql-test/r/rpl_row_sp009.result b/mysql-test/r/rpl_row_sp009.result index 8073e506ade..35ce0d7b420 100644 --- a/mysql-test/r/rpl_row_sp009.result +++ b/mysql-test/r/rpl_row_sp009.result @@ -49,28 +49,28 @@ END; END IF; END| CALL test.p1('a'); -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a 1 3 -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a 1 3 truncate test.t2; call test.p1('b'); -select * from test.t2; +select * from test.t2 ORDER BY a; a 2 4 -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a 2 4 truncate test.t2; -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; a DROP PROCEDURE test.p1; DROP TABLE test.t1; diff --git a/mysql-test/r/rpl_row_view01.result b/mysql-test/r/rpl_row_view01.result index 039d14d6272..0006ec99f5e 100644 --- a/mysql-test/r/rpl_row_view01.result +++ b/mysql-test/r/rpl_row_view01.result @@ -21,15 +21,15 @@ CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty)); INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday'); INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF'); INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4); -CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4; -CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a; +CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty; +CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a; CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1; CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION; SELECT * FROM mysqltest1.v2; qty price value 3 50 150 -18 3 54 4 4 16 +18 3 54 SELECT * FROM mysqltest1.v1; a c c2 1 Thank GOD @@ -38,8 +38,8 @@ a c c2 SELECT * FROM mysqltest1.v2; qty price value 3 50 150 -18 3 54 4 4 16 +18 3 54 SELECT * FROM mysqltest1.v1; a c c2 1 Thank GOD @@ -47,45 +47,45 @@ a c c2 3 Friday TGIF INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2; INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1; -SELECT * FROM mysqltest1.t5; +SELECT * FROM mysqltest1.t5 ORDER BY qty; qty price total 3 50 150 -18 3 54 4 4 16 -SELECT * FROM mysqltest1.t3; +18 3 54 +SELECT * FROM mysqltest1.t3 ORDER BY a; a c c2 1 Thank GOD 2 it is 3 Friday TGIF -SELECT * FROM mysqltest1.t5; +SELECT * FROM mysqltest1.t5 ORDER BY qty; qty price total 3 50 150 -18 3 54 4 4 16 -SELECT * FROM mysqltest1.t3; +18 3 54 +SELECT * FROM mysqltest1.t3 ORDER BY a; a c c2 1 Thank GOD 2 it is 3 Friday TGIF INSERT INTO mysqltest1.v4 VALUES (4,'TEST'); -SELECT * FROM mysqltest1.t1; +SELECT * FROM mysqltest1.t1 ORDER BY a; a c 1 Thank 2 it 3 Friday 4 TEST -SELECT * FROM mysqltest1.v4; +SELECT * FROM mysqltest1.v4 ORDER BY a; a c 2 it 3 Friday 4 TEST -SELECT * FROM mysqltest1.t1; +SELECT * FROM mysqltest1.t1 ORDER BY a; a c 1 Thank 2 it 3 Friday 4 TEST -SELECT * FROM mysqltest1.v4; +SELECT * FROM mysqltest1.v4 ORDER BY a; a c 2 it 3 Friday diff --git a/mysql-test/t/rpl_row_sp005.test b/mysql-test/t/rpl_row_sp005.test index c2cdd820eeb..b55d10a1b8a 100644 --- a/mysql-test/t/rpl_row_sp005.test +++ b/mysql-test/t/rpl_row_sp005.test @@ -6,7 +6,8 @@ # Test: Tests SPs with cursors, flow logic, and alter sp. In addition the # # tests SPs with insert and update operations. # ############################################################################# - +# 2006-02-08 By JBM added ORDER BY for use with NDB engine +############################################################################# # Includes -- source include/have_binlog_format_row.inc @@ -35,8 +36,8 @@ BEGIN DECLARE done INT DEFAULT 0; DECLARE spa CHAR(16); DECLARE spb,spc INT; - DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1; - DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2; + DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id; + DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; OPEN cur1; @@ -68,28 +69,28 @@ delimiter ;| let $message=< ---- Master selects-- >; --source include/show_msg.inc CALL test.p2(); -SELECT * FROM test.t1; -SELECT * FROM test.t2; +SELECT * FROM test.t1 ORDER BY id; +SELECT * FROM test.t2 ORDER BY id2; let $message=< ---- Slave selects-- >; --source include/show_msg.inc save_master_pos; connection slave; sync_with_master; -SELECT * FROM test.t1; -SELECT * FROM test.t2; +SELECT * FROM test.t1 ORDER BY id; +SELECT * FROM test.t2 ORDER BY id2; let $message=< ---- Master selects-- >; --source include/show_msg.inc connection master; CALL test.p1(); sleep 6; -SELECT * FROM test.t3; +SELECT * FROM test.t3 ORDER BY id3; let $message=< ---- Slave selects-- >; --source include/show_msg.inc connection slave; -SELECT * FROM test.t3; +SELECT * FROM test.t3 ORDER BY id3; connection master; diff --git a/mysql-test/t/rpl_row_sp009.test b/mysql-test/t/rpl_row_sp009.test index b06267df783..64a2d19aed1 100644 --- a/mysql-test/t/rpl_row_sp009.test +++ b/mysql-test/t/rpl_row_sp009.test @@ -5,6 +5,8 @@ ############################################################################# #TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 # ############################################################################# +# 2006-02-08 By JBM : Added order by for ndb engine use +############################################################################# # Includes -- source include/have_binlog_format_row.inc @@ -68,29 +70,29 @@ END| delimiter ;| CALL test.p1('a'); -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; connection master; truncate test.t2; # this next call fails, but should not call test.p1('b'); -select * from test.t2; +select * from test.t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; connection master; truncate test.t2; -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; save_master_pos; connection slave; sync_with_master; -SELECT * FROM test.t2; +SELECT * FROM test.t2 ORDER BY a; connection master; diff --git a/mysql-test/t/rpl_row_view01.test b/mysql-test/t/rpl_row_view01.test index 85137e03dbf..895a922fef8 100644 --- a/mysql-test/t/rpl_row_view01.test +++ b/mysql-test/t/rpl_row_view01.test @@ -5,7 +5,8 @@ ############################################################################# #TEST: row based replication of views # ############################################################################# - +# 2006-02-08 By JBM added order by and sleep for use with ndb engine +############################################################################# # Includes -- source include/have_binlog_format_row.inc -- source include/master-slave.inc @@ -34,14 +35,19 @@ INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF'); INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4); -CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4; -CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a; +CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty; +CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a; CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1; CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION; SELECT * FROM mysqltest1.v2; SELECT * FROM mysqltest1.v1; +# Had to add a sleep for use with NDB +# engine. Injector thread would have not +# populated biblog and data would not be on +# the slave. +sleep 10; sync_slave_with_master; SELECT * FROM mysqltest1.v2; SELECT * FROM mysqltest1.v1; @@ -50,20 +56,20 @@ connection master; INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2; INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1; -SELECT * FROM mysqltest1.t5; -SELECT * FROM mysqltest1.t3; +SELECT * FROM mysqltest1.t5 ORDER BY qty; +SELECT * FROM mysqltest1.t3 ORDER BY a; sync_slave_with_master; -SELECT * FROM mysqltest1.t5; -SELECT * FROM mysqltest1.t3; +SELECT * FROM mysqltest1.t5 ORDER BY qty; +SELECT * FROM mysqltest1.t3 ORDER BY a; connection master; INSERT INTO mysqltest1.v4 VALUES (4,'TEST'); -SELECT * FROM mysqltest1.t1; -SELECT * FROM mysqltest1.v4; +SELECT * FROM mysqltest1.t1 ORDER BY a; +SELECT * FROM mysqltest1.v4 ORDER BY a; sync_slave_with_master; -SELECT * FROM mysqltest1.t1; -SELECT * FROM mysqltest1.v4; +SELECT * FROM mysqltest1.t1 ORDER BY a; +SELECT * FROM mysqltest1.v4 ORDER BY a; connection master; From 4a7cd1a5832c4209b0d080dfffa7ff432bb55b97 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 22:17:46 +0100 Subject: [PATCH 52/54] rpl_stm_log.test: Fixed bug in test case --- mysql-test/t/rpl_stm_log.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/rpl_stm_log.test b/mysql-test/t/rpl_stm_log.test index f5b0a7eead8..d11e1fd8ac1 100644 --- a/mysql-test/t/rpl_stm_log.test +++ b/mysql-test/t/rpl_stm_log.test @@ -1,5 +1,6 @@ # Requires statement logging -- source include/have_binlog_format_statement.inc +let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_log.test From 057b3f9e25f99059f9f0e032b9c4c997ab71cf61 Mon Sep 17 00:00:00 2001 From: "jmiller@mysql.com" <> Date: Wed, 8 Feb 2006 22:26:16 +0100 Subject: [PATCH 53/54] rpl_stm_log.result: Fixed bug in test case --- mysql-test/r/rpl_stm_log.result | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/mysql-test/r/rpl_stm_log.result b/mysql-test/r/rpl_stm_log.result index 82d50ff2810..d9713660dbb 100644 --- a/mysql-test/r/rpl_stm_log.result +++ b/mysql-test/r/rpl_stm_log.result @@ -8,10 +8,10 @@ stop slave; reset master; reset slave; reset master; -create table t1(n int not null auto_increment primary key); +create table t1(n int not null auto_increment primary key)ENGINE=MyISAM; insert into t1 values (NULL); drop table t1; -create table t1 (word char(20) not null); +create table t1 (word char(20) not null)ENGINE=MyISAM; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) @@ -20,41 +20,41 @@ drop table t1; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Intvar 1 # INSERT_ID=1 master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null) +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1 master-bin.000001 # Query 1 # use `test`; drop table t1 show binlog events from 102 limit 1; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM show binlog events from 102 limit 2; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Intvar 1 # INSERT_ID=1 show binlog events from 102 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) flush logs; -create table t5 (a int); +create table t5 (a int)ENGINE=MyISAM; drop table t5; start slave; flush logs; stop slave; -create table t1 (n int); +create table t1 (n int)ENGINE=MyISAM; insert into t1 values (1); drop table t1; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Intvar 1 # INSERT_ID=1 master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null) +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1 master-bin.000001 # Query 1 # use `test`; drop table t1 @@ -62,42 +62,42 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000002 # Query 1 # use `test`; create table t5 (a int) +master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM master-bin.000002 # Query 1 # use `test`; drop table t5 -master-bin.000002 # Query 1 # use `test`; create table t1 (n int) +master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM master-bin.000002 # Query 1 # use `test`; insert into t1 values (1) master-bin.000002 # Query 1 # use `test`; drop table t1 show binary logs; Log_name File_size -master-bin.000001 1393 -master-bin.000002 514 +master-bin.000001 1419 +master-bin.000002 540 start slave; show binary logs; Log_name File_size -slave-bin.000001 1556 -slave-bin.000002 352 +slave-bin.000001 1595 +slave-bin.000002 365 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 -slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key) +slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM slave-bin.000001 # Intvar 1 # INSERT_ID=1 slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) slave-bin.000001 # Query 1 # use `test`; drop table t1 -slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null) +slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1 slave-bin.000001 # Query 1 # use `test`; drop table t1 -slave-bin.000001 # Query 1 # use `test`; create table t5 (a int) +slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM slave-bin.000001 # Query 1 # use `test`; drop table t5 slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 show binlog events in 'slave-bin.000002' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 -slave-bin.000002 # Query 1 # use `test`; create table t1 (n int) +slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM slave-bin.000002 # Query 1 # use `test`; insert into t1 values (1) slave-bin.000002 # Query 1 # use `test`; drop table t1 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 514 # # master-bin.000002 Yes Yes # 0 0 514 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 540 # # master-bin.000002 Yes Yes # 0 0 540 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log From a76665698bab96a3f42f40080fdb679e3bb6cca0 Mon Sep 17 00:00:00 2001 From: "reggie@big_geek." <> Date: Wed, 8 Feb 2006 23:57:30 -0600 Subject: [PATCH 54/54] added cmake file for instance manager --- win/cmakefiles/base | 2 +- win/cmakefiles/deploy.bat | 2 +- win/cmakefiles/im | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 win/cmakefiles/im diff --git a/win/cmakefiles/base b/win/cmakefiles/base index f8ac9969a26..4430ac0ec46 100644 --- a/win/cmakefiles/base +++ b/win/cmakefiles/base @@ -32,4 +32,4 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu ADD_DEFINITIONS("-D_WINDOWS -D__WIN__") SUBDIRS(vio dbug strings regex mysys extra zlib storage/innobase storage/heap storage/myisam storage/myisammrg - extra/yassl extra/yassl/taocrypt client sql) + extra/yassl extra/yassl/taocrypt client sql server-tools/instance-manager) diff --git a/win/cmakefiles/deploy.bat b/win/cmakefiles/deploy.bat index 52a921a7188..cb55b8cdb12 100644 --- a/win/cmakefiles/deploy.bat +++ b/win/cmakefiles/deploy.bat @@ -16,4 +16,4 @@ copy heap ..\..\storage\heap\cmakelists.txt copy innobase ..\..\storage\innobase\cmakelists.txt copy myisam ..\..\storage\myisam\cmakelists.txt copy myisammrg ..\..\storage\myisammrg\cmakelists.txt - +copy im ..\..\server-tools\instance-manager\cmakelists.txt diff --git a/win/cmakefiles/im b/win/cmakefiles/im new file mode 100644 index 00000000000..32f243b43d9 --- /dev/null +++ b/win/cmakefiles/im @@ -0,0 +1,16 @@ +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") + +ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER) +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql) + +ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc + instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc + mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc + thread_registry.cc user_map.cc imservice.cpp windowsservice.cpp + ../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c + ../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c + ../../libmysql/errmsg.c) + +ADD_DEPENDENCIES(mysqlmanager GenError) +TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)