From f8f2d51aadda1f04ed368ed0b50df7bf05eb40e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Dec 2005 15:09:12 +0100 Subject: bug#15682 - ndb incorrect handling of varchar in position/rnd_pos Commit for 5.0.17 release clone mysql-test/r/ndb_basic.result: bug#15682 mysql-test/t/ndb_basic.test: bug#15682 sql/ha_ndbcluster.cc: bug#15682 --- mysql-test/r/ndb_basic.result | 16 ++++++++++++++++ mysql-test/t/ndb_basic.test | 11 +++++++++++ sql/ha_ndbcluster.cc | 21 +++++++++++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 55cbbd89b3c..9dd75f1390c 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -677,3 +677,19 @@ select * from atablewithareallylongandirritatingname; a 2 drop table atablewithareallylongandirritatingname; +create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB; +insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1); +insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2); +select * from t1 order by f1; +f1 f2 f3 +111111 aaaaaa 1 +222222 bbbbbb 2 +select * from t1 order by f2; +f1 f2 f3 +111111 aaaaaa 1 +222222 bbbbbb 2 +select * from t1 order by f3; +f1 f2 f3 +111111 aaaaaa 1 +222222 bbbbbb 2 +drop table t1; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index 0510651a417..12aca73d82b 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -623,3 +623,14 @@ create table atablewithareallylongandirritatingname (a int); insert into atablewithareallylongandirritatingname values (2); select * from atablewithareallylongandirritatingname; drop table atablewithareallylongandirritatingname; + +# +# Bug#15682 +# +create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB; +insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1); +insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2); +select * from t1 order by f1; +select * from t1 order by f2; +select * from t1 order by f3; +drop table t1; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 1156ba1317f..7beda755f9d 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -2812,8 +2812,25 @@ void ha_ndbcluster::position(const byte *record) } *buff++= 0; } - memcpy(buff, record + key_part->offset, key_part->length); - buff += key_part->length; + size_t len = key_part->length; + const byte * ptr = record + key_part->offset; + Field *field = key_part->field; + if ((field->type() == MYSQL_TYPE_VARCHAR) && + ((Field_varstring*)field)->length_bytes == 1) + { + /** + * Keys always use 2 bytes length + */ + buff[0] = ptr[0]; + buff[1] = 0; + memcpy(buff+2, ptr + 1, len); + len += 2; + } + else + { + memcpy(buff, ptr, len); + } + buff += len; } } else -- cgit v1.2.1 From e1a25cb9d62b00263bcb75d2aee1095441d7a45d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Dec 2005 16:29:56 +0100 Subject: Fix to make ndb_multi.test (Bug #15401 NDB lock problems) more predictable --- mysql-test/r/ndb_multi.result | 1 + mysql-test/t/ndb_multi.test | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/r/ndb_multi.result b/mysql-test/r/ndb_multi.result index 2080be241e8..bd3af223a65 100644 --- a/mysql-test/r/ndb_multi.result +++ b/mysql-test/r/ndb_multi.result @@ -30,6 +30,7 @@ create table t1 (a int) engine=ndbcluster; insert into t1 value (2); select * from t1; ERROR HY000: Got error 241 'Invalid schema object version' from ndbcluster +flush table t1; select * from t1; a 2 diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test index 760150c6f6a..1183f2b283f 100644 --- a/mysql-test/t/ndb_multi.test +++ b/mysql-test/t/ndb_multi.test @@ -40,6 +40,7 @@ connection server1; # Currently a retry is required remotely --error 1296 select * from t1; +flush table t1; select * from t1; # Connect to server2 and use the tables from there -- cgit v1.2.1 From 348efa52204e005abbf8d3c2610819c454fde9f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Dec 2005 21:42:08 +0400 Subject: Fix for bug #15623: Test case rpl000001 and rpl_error_ignored_table failure on MacOSX and bug #15668: Test 'sp-error' crashes server on Mac OS X. mysql-test/r/rpl000001.result: Fix for bug #15623: Test case rpl000001 and rpl_error_ignored_table failure on MacOSX and bug #15668: Test 'sp-error' crashes server on Mac OS X. - accept 2013 error as well. mysql-test/t/flush_read_lock_kill.test: Fix for bug #15623: Test case rpl000001 and rpl_error_ignored_table failure on MacOSX and bug #15668: Test 'sp-error' crashes server on Mac OS X. - accept 2013 error as well. mysql-test/t/rpl000001.test: Fix for bug #15623: Test case rpl000001 and rpl_error_ignored_table failure on MacOSX and bug #15668: Test 'sp-error' crashes server on Mac OS X. - accept 2013 error as well. mysql-test/t/rpl_error_ignored_table.test: Fix for bug #15623: Test case rpl000001 and rpl_error_ignored_table failure on MacOSX and bug #15668: Test 'sp-error' crashes server on Mac OS X. - accept 2013 error as well. sql/sql_class.cc: Fix for bug #15623: Test case rpl000001 and rpl_error_ignored_table failure on MacOSX and bug #15668: Test 'sp-error' crashes server on Mac OS X. - don't call the close_active_vio() in case of KILL_QUERY. --- mysql-test/r/rpl000001.result | 2 +- mysql-test/t/flush_read_lock_kill.test | 2 +- mysql-test/t/rpl000001.test | 2 +- mysql-test/t/rpl_error_ignored_table.test | 2 +- sql/sql_class.cc | 4 +++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result index 450e728090e..de9f6f16b2a 100644 --- a/mysql-test/r/rpl000001.result +++ b/mysql-test/r/rpl000001.result @@ -50,7 +50,7 @@ select (@id := id) - id from t2; 0 kill @id; drop table t2; -ERROR 08S01: Server shutdown in progress +Got one of the listed errors set global sql_slave_skip_counter=1; start slave; select count(*) from t1; diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test index de2576300dc..19a47b2893a 100644 --- a/mysql-test/t/flush_read_lock_kill.test +++ b/mysql-test/t/flush_read_lock_kill.test @@ -42,7 +42,7 @@ connection con1; # debug build running without our --debug=make_global..., will be # error 0 (no error). The only important thing to test is that on # debug builds with our --debug=make_global... we don't hang forever. ---error 0,1053 +--error 0,1053,2013 reap; connection con2; diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index 3d03823d474..45d621b730f 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -92,7 +92,7 @@ kill @id; # We don't drop t3 as this is a temporary table drop table t2; connection master; ---error 1053 +--error 1053,2013 reap; connection slave; # The SQL slave thread should now have stopped because the query was killed on diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_error_ignored_table.test index cb4137c49e0..339d966dbb3 100644 --- a/mysql-test/t/rpl_error_ignored_table.test +++ b/mysql-test/t/rpl_error_ignored_table.test @@ -45,7 +45,7 @@ select (@id := id) - id from t3; kill @id; drop table t2,t3; connection master; ---error 0,1053 +--error 0,1053,2013 reap; connection master1; --replace_column 2 # 5 # diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 989b8142202..035018c91bc 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -473,10 +473,12 @@ void THD::awake(THD::killed_state state_to_set) killed= state_to_set; if (state_to_set != THD::KILL_QUERY) + { thr_alarm_kill(real_id); #ifdef SIGNAL_WITH_VIO_CLOSE - close_active_vio(); + close_active_vio(); #endif + } if (mysys_var) { pthread_mutex_lock(&mysys_var->mutex); -- cgit v1.2.1