From d09d815649cd37ef87e8e31c713a186d1c283414 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2005 22:17:16 -0400 Subject: BUG#7967 Fix mysqlhotcopy --record-log-position BitKeeper/etc/ignore: Added scripts/mysqlhotcopy.sh.rej to the ignore list scripts/mysqlhotcopy.sh: BUG#7967 Use fetchrow_hashref() when parsing SHOW SLAVE STATUS so that --record-log-pos option will work with all versions from 3.23 forward and will not break again in the future if additional columns are added. --- .bzrignore | 1 + scripts/mysqlhotcopy.sh | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.bzrignore b/.bzrignore index c9f9f140366..174fc6020f2 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1052,3 +1052,4 @@ vio/test-ssl vio/test-sslclient vio/test-sslserver vio/viotest-ssl +scripts/mysqlhotcopy.sh.rej diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 632174dc41a..1c5cd6a4faf 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -746,9 +746,15 @@ sub record_log_pos { my ($file,$position) = get_row( $dbh, "show master status" ); die "master status is undefined" if !defined $file || !defined $position; - my ($master_host, undef, undef, undef, $log_file, $log_pos ) - = get_row( $dbh, "show slave status" ); - + my $row_hash = get_row_hash( $dbh, "show slave status" ); + my ($master_host, $log_file, $log_pos ); + if ( $dbh->{mysql_serverinfo} =~ /^3\.23/ ) { + ($master_host, $log_file, $log_pos ) + = @{$row_hash}{ qw / Master_Host Log_File Pos / }; + } else { + ($master_host, $log_file, $log_pos ) + = @{$row_hash}{ qw / Master_Host Master_Log_File Read_Master_Log_Pos / }; + } my $hostname = hostname(); $dbh->do( qq{ replace into $table_name @@ -773,6 +779,14 @@ sub get_row { return $sth->fetchrow_array(); } +sub get_row_hash { + my ( $dbh, $sql ) = @_; + + my $sth = $dbh->prepare($sql); + $sth->execute; + return $sth->fetchrow_hashref(); +} + sub scan_raid_dir { my ( $r_db_files, $data_dir, @raid_dir ) = @_; -- cgit v1.2.1 From c9914ac6ac456386aff36f948fa8036f066612bf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 13:56:42 +0500 Subject: Bug#10253: compound index length and utf8 char set produces invalid query results mi_key.c: well_formed_length should be executed before space trimming, not after. ctype_utf8.test: ctype_utf8.result: adding test. myisam/mi_key.c: Bug#10253: ompound index length and utf8 char set produces invalid query results well_formed_length should be executed before space trimming, not after. mysql-test/r/ctype_utf8.result: adding test. adding test. mysql-test/t/ctype_utf8.test: adding test. --- myisam/mi_key.c | 6 +++--- mysql-test/r/ctype_utf8.result | 11 +++++++++++ mysql-test/t/ctype_utf8.test | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/myisam/mi_key.c b/myisam/mi_key.c index b7240f34538..6a8d88f1117 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -84,7 +84,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, pos= (byte*) record+keyseg->start; if (keyseg->flag & HA_SPACE_PACK) { - end=pos+length; + FIX_LENGTH(cs, pos, length, char_length); + end= pos + char_length; if (type != HA_KEYTYPE_NUM) { while (end > pos && end[-1] == ' ') @@ -95,8 +96,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, while (pos < end && pos[0] == ' ') pos++; } - length=(uint) (end-pos); - FIX_LENGTH(cs, pos, length, char_length); + char_length= (uint) (end - pos); store_key_length_inc(key,char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length); key+=char_length; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index b7aa7c68b67..ac421ea1717 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -891,3 +891,14 @@ string create table t1 (a varchar(255)) default character set utf8; insert into t1 values (1.0); drop table t1; +create table t1 ( +id int not null, +city varchar(20) not null, +key (city(7),id) +) character set=utf8; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +id city +2 Durban +drop table t1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index bac6e60c302..a281558e5a1 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -731,3 +731,17 @@ select ifnull(NULL, _utf8'string'); create table t1 (a varchar(255)) default character set utf8; insert into t1 values (1.0); drop table t1; + +# +# Bug#10253 compound index length and utf8 char set +# produces invalid query results +# +create table t1 ( + id int not null, + city varchar(20) not null, + key (city(7),id) +) character set=utf8; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +drop table t1; -- cgit v1.2.1 From 295a55423ba45ec915cb5e7203005416acedd889 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 05:10:18 -0400 Subject: Accepted openlogging --- BitKeeper/etc/logging_ok | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index ce1e179789e..343fb26c83a 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -47,6 +47,7 @@ dlenev@build.mysql.com dlenev@jabberwock.localdomain dlenev@mysql.com ejonore@mc03.ndb.mysql.com +elliot@mysql.com evgen@moonbone.(none) evgen@moonbone.local gbichot@bk-internal.mysql.com -- cgit v1.2.1 From 8b15aba810c39e1ea5ca318c8f6ca9dd1d92df3b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 04:21:19 -0700 Subject: item_buff.cc: Removed an extra space char. sql/item_buff.cc: Removed an extra space char. --- sql/item_buff.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 2324205eb65..f5e77862e1d 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -43,7 +43,7 @@ Item_buff::~Item_buff() {} */ Item_str_buff::Item_str_buff(THD *thd, Item *arg) - :item(arg), value(min(arg->max_length, thd->variables. max_sort_length)) + :item(arg), value(min(arg->max_length, thd->variables.max_sort_length)) {} bool Item_str_buff::cmp(void) -- cgit v1.2.1 From d499ead64c468cab0fb03b98568e01bfd971f7b3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 06:34:13 -0700 Subject: Many files: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. sql/sql_class.cc: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_1general.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_2myisam.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_3innodb.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_4heap.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_5merge.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. --- mysql-test/r/ps_1general.result | 12 ++++++------ mysql-test/r/ps_2myisam.result | 6 +++--- mysql-test/r/ps_3innodb.result | 6 +++--- mysql-test/r/ps_4heap.result | 6 +++--- mysql-test/r/ps_5merge.result | 12 ++++++------ sql/sql_class.cc | 10 +++++++--- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 68d88a454ff..db8dc2e60af 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -468,13 +468,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 14 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort @@ -484,13 +484,13 @@ execute stmt1 using @arg00; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 5 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 5 Y 0 31 8 def possible_keys 253 4096 7 Y 0 31 8 def key 253 64 7 Y 0 31 8 def key_len 8 3 1 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 27 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index fd17dc5b1b5..c569c9842f7 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1151,13 +1151,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 50dc580a930..930aea2e381 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1151,13 +1151,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 050a63f254c..083a4b221fe 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1152,13 +1152,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index c228ec4672f..1edd617ffc6 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1194,13 +1194,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 @@ -4208,13 +4208,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 805db107370..e845769d7ad 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -667,8 +667,10 @@ int THD::send_explain_fields(select_result *result) CHARSET_INFO *cs= system_charset_info; field_list.push_back(new Item_return_int("id",3, MYSQL_TYPE_LONGLONG)); field_list.push_back(new Item_empty_string("select_type", 19, cs)); - field_list.push_back(new Item_empty_string("table", NAME_LEN, cs)); - field_list.push_back(new Item_empty_string("type", 10, cs)); + field_list.push_back(item= new Item_empty_string("table", NAME_LEN, cs)); + item->maybe_null= 1; + field_list.push_back(item= new Item_empty_string("type", 10, cs)); + item->maybe_null= 1; field_list.push_back(item=new Item_empty_string("possible_keys", NAME_LEN*MAX_KEY, cs)); item->maybe_null=1; @@ -680,7 +682,9 @@ int THD::send_explain_fields(select_result *result) field_list.push_back(item=new Item_empty_string("ref", NAME_LEN*MAX_REF_PARTS, cs)); item->maybe_null=1; - field_list.push_back(new Item_return_int("rows", 10, MYSQL_TYPE_LONGLONG)); + field_list.push_back(item= new Item_return_int("rows", 10, + MYSQL_TYPE_LONGLONG)); + item->maybe_null= 1; field_list.push_back(new Item_empty_string("Extra", 255, cs)); return (result->send_fields(field_list,1)); } -- cgit v1.2.1