From 72a6c71d08bb18a540a3c463a98bfefc44bb8658 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Fri, 22 Jul 2005 16:18:34 -0700 Subject: [PATCH 1/6] Fix value returned from SELECT of unsigned long system variables. (Bug #10351) --- mysql-test/r/variables.result | 12 ++++++++++++ mysql-test/t/variables.test | 10 ++++++++++ sql/item.h | 1 + sql/mysqld.cc | 2 +- sql/set_var.cc | 4 ++-- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 5468508165c..8ab591e18d0 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -525,3 +525,15 @@ set @@warning_count=1; ERROR HY000: Variable 'warning_count' is a read only variable set @@global.error_count=1; ERROR HY000: Variable 'error_count' is a read only variable +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; +@@max_heap_table_size +4294967296 +set global max_heap_table_size= 4294967296; +select @@max_heap_table_size; +@@max_heap_table_size +4294967296 +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; +@@max_heap_table_size +4294967296 diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index c3ffdc79c16..e6efb86e325 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -406,3 +406,13 @@ drop table t1; set @@warning_count=1; --error 1238 set @@global.error_count=1; + +# +# Bug #10351: Setting max_heap_table_size to 4G fails +# +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; +set global max_heap_table_size= 4294967296; +select @@max_heap_table_size; +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; diff --git a/sql/item.h b/sql/item.h index 5a1cf193806..69ec9d84eef 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1142,6 +1142,7 @@ class Item_uint :public Item_int public: Item_uint(const char *str_arg, uint length); Item_uint(uint32 i) :Item_int((ulonglong) i, 10) {} + Item_uint(ulong i) :Item_int((ulonglong) i, 10) {} Item_uint(const char *str_arg, longlong i, uint length); double val_real() { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 798bd25fa7c..7afb70c32a8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5371,7 +5371,7 @@ The minimum value for this variable is 4096.", "Limit assumed max number of seeks when looking up rows based on a key", (gptr*) &global_system_variables.max_seeks_for_key, (gptr*) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, - REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0 }, + REQUIRED_ARG, UINT_MAX32, 1, UINT_MAX32, 0, 1, 0 }, {"max_sort_length", OPT_MAX_SORT_LENGTH, "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", (gptr*) &global_system_variables.max_sort_length, diff --git a/sql/set_var.cc b/sql/set_var.cc index 09581aed217..5cdd4081614 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1679,7 +1679,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) pthread_mutex_lock(&LOCK_global_system_variables); value= *(uint*) value_ptr(thd, var_type, base); pthread_mutex_unlock(&LOCK_global_system_variables); - return new Item_uint((int32) value); + return new Item_uint((uint32) value); } case SHOW_LONG: { @@ -1687,7 +1687,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) pthread_mutex_lock(&LOCK_global_system_variables); value= *(ulong*) value_ptr(thd, var_type, base); pthread_mutex_unlock(&LOCK_global_system_variables); - return new Item_uint((int32) value); + return new Item_uint(value); } case SHOW_LONGLONG: { From bcace631ee92deb3b6f5b269809fa863cc9afa36 Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Wed, 27 Jul 2005 13:01:48 +0200 Subject: [PATCH 2/6] Fix shortcircuit of 127.0.0.1 -> localhost lookup on little-endian machines. (Bug #11822) (Originally: 1.1891 05/07/25 12:07:47 jimw@mysql.com ) --- configure.in | 2 +- sql/hostname.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 12293ecf5ec..3ed1cfe6054 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_PREREQ(2.57)dnl Minimum Autoconf version required. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # Don't forget to also update the NDB lines below. -AM_INIT_AUTOMAKE(mysql, 5.0.10-beta) +AM_INIT_AUTOMAKE(mysql, 5.0.10a-beta) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/sql/hostname.cc b/sql/hostname.cc index 12b69a97859..3b1eeb63d37 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -143,8 +143,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) *errors=0; /* We always treat the loopback address as "localhost". */ - if (in->s_addr == INADDR_LOOPBACK) - return (char *)my_localhost; + if (in->s_addr == htonl(INADDR_LOOPBACK)) // is expanded inline by gcc + DBUG_RETURN((char *)my_localhost); /* Check first if we have name in cache */ if (!(specialflag & SPECIAL_NO_HOST_CACHE)) From ef2c7812f35e1a9bc15cf290c52b6b1ca5c4a1a1 Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Wed, 27 Jul 2005 16:17:05 +0500 Subject: [PATCH 3/6] Fix for bug#12127 triggers do not show in info_schema before they are used if set to the database(2nd version) use db name of table which trigger belongs to instead of thd->db name during trigger body parsing --- mysql-test/r/information_schema.result | 9 +++++++++ mysql-test/t/information_schema.test | 11 +++++++++++ sql/sql_trigger.cc | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 89b3df0a83b..5c95d7b39d8 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -940,3 +940,12 @@ f5 19 NULL f6 1 NULL f7 64 NULL drop table t1; +create table t1 (f1 integer); +create trigger tr1 after insert on t1 for each row set @test_var=42; +use information_schema; +select trigger_schema, trigger_name from triggers where +trigger_name='tr1'; +trigger_schema trigger_name +test tr1 +use test; +drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index f13a29f07ad..a8fc75f8aa4 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -622,3 +622,14 @@ select column_name, NUMERIC_PRECISION, NUMERIC_SCALE from information_schema.columns where table_name='t1'; drop table t1; + +# +# Bug #12127 triggers do not show in info_schema before they are used if set to the database +# +create table t1 (f1 integer); +create trigger tr1 after insert on t1 for each row set @test_var=42; +use information_schema; +select trigger_schema, trigger_name from triggers where +trigger_name='tr1'; +use test; +drop table t1; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index a7aee95197e..a69ae8064c7 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -520,6 +520,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, char path_buff[FN_REFLEN]; LEX_STRING path; File_parser *parser; + LEX_STRING save_db; DBUG_ENTER("Table_triggers_list::check_n_load"); @@ -581,6 +582,10 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, thd->lex= &lex; + save_db.str= thd->db; + save_db.length= thd->db_length; + thd->db_length= strlen(db); + thd->db= (char *) db; while ((trg_create_str= it++)) { lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length); @@ -623,6 +628,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, lex_end(&lex); } + thd->db= save_db.str; + thd->db_length= save_db.length; thd->lex= old_lex; DBUG_RETURN(0); @@ -631,6 +638,8 @@ err_with_lex_cleanup: // QQ: anything else ? lex_end(&lex); thd->lex= old_lex; + thd->db= save_db.str; + thd->db_length= save_db.length; DBUG_RETURN(1); } From 4b0d6a3877fa71d954bbc1d809bbe75bdff6942a Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Thu, 28 Jul 2005 12:30:52 +0300 Subject: [PATCH 4/6] row_sel_store_mysql_rec(): Convert NULL true VARCHAR columns correctly. --- innobase/row/row0sel.c | 12 ++++++++++-- mysql-test/r/innodb.result | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 602f5855171..9234c4aeb26 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2524,11 +2524,19 @@ row_sel_store_mysql_rec( (byte) (templ->mysql_null_bit_mask); switch (templ->type) { case DATA_VARCHAR: - case DATA_CHAR: case DATA_BINARY: + case DATA_VARMYSQL: + if (templ->mysql_type + == DATA_MYSQL_TRUE_VARCHAR) { + /* This is a >= 5.0.3 type + true VARCHAR. Zero the field. */ + pad_char = 0x00; + break; + } + /* Fall through */ + case DATA_CHAR: case DATA_FIXBINARY: case DATA_MYSQL: - case DATA_VARMYSQL: /* MySQL pads all non-BLOB and non-TEXT string types with space ' ' */ if (UNIV_UNLIKELY(templ->mbminlen == 2)) { diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 2c73cbeeea4..2bdec5125dd 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1452,16 +1452,16 @@ Error 1146 Table 'test.t4' doesn't exist checksum table t1, t2, t3, t4; Table Checksum test.t1 2948697075 -test.t2 1157260244 -test.t3 1157260244 +test.t2 3835700799 +test.t3 3835700799 test.t4 NULL Warnings: Error 1146 Table 'test.t4' doesn't exist checksum table t1, t2, t3, t4 extended; Table Checksum test.t1 3092701434 -test.t2 1157260244 -test.t3 1157260244 +test.t2 3835700799 +test.t3 3835700799 test.t4 NULL Warnings: Error 1146 Table 'test.t4' doesn't exist From f0f2738c4ce378ab7c044bebeb4807a2818ce55b Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Thu, 28 Jul 2005 13:15:36 +0300 Subject: [PATCH 5/6] row0sel.c: row_sel_store_mysql_rec(): Make comment about space padding more accurate. --- innobase/row/row0sel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 9234c4aeb26..0b563eb147e 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2537,8 +2537,8 @@ row_sel_store_mysql_rec( case DATA_CHAR: case DATA_FIXBINARY: case DATA_MYSQL: - /* MySQL pads all non-BLOB and non-TEXT - string types with space ' ' */ + /* MySQL pads all string types (except + BLOB, TEXT and true VARCHAR) with space. */ if (UNIV_UNLIKELY(templ->mbminlen == 2)) { /* Treat UCS2 as a special case. */ data = mysql_rec From 6289ba157033cf9c3db08ae51c51913d52a86288 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Fri, 29 Jul 2005 00:32:03 +0000 Subject: [PATCH 6/6] [Patch from Konstantin] Enable InnoDB cursor view functionality. --- sql/ha_innodb.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 1c3bca08037..d40e58aa4cb 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -216,10 +216,10 @@ static handlerton innobase_hton = { innobase_xa_recover, /* recover */ innobase_commit_by_xid, /* commit_by_xid */ innobase_rollback_by_xid, /* rollback_by_xid */ - NULL, - NULL, - NULL, - HTON_CLOSE_CURSORS_AT_COMMIT + innobase_create_cursor_view, + innobase_set_cursor_view, + innobase_close_cursor_view, + HTON_NO_FLAGS }; /*********************************************************************