From 48450d8a2b7a4e50d8642c1f6fb9415eac5f2e12 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 10 Dec 2005 18:02:36 +0400 Subject: [PATCH 1/8] Fix for bug #15225 (ANALYZE temporary has no effect) mysql-test/r/analyze.result: test result fixed mysql-test/t/analyze.test: test case added sql/sql_table.cc: we don't need to remove temporary table from the cache, but we need to reload it's info --- mysql-test/r/analyze.result | 9 +++++++++ mysql-test/t/analyze.test | 9 +++++++++ sql/sql_table.cc | 13 +++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result index 796b382f5d6..bded22c4859 100644 --- a/mysql-test/r/analyze.result +++ b/mysql-test/r/analyze.result @@ -37,3 +37,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_ execute stmt1; Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype deallocate prepare stmt1; +create temporary table t1(a int, index(a)); +insert into t1 values('1'),('2'),('3'),('4'),('5'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +show index 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 A 5 NULL NULL YES BTREE +drop table t1; diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test index 5d653b65579..a4694c32d3c 100644 --- a/mysql-test/t/analyze.test +++ b/mysql-test/t/analyze.test @@ -48,4 +48,13 @@ execute stmt1; execute stmt1; deallocate prepare stmt1; +# +# bug#15225 (ANALYZE temporary has no effect) +# +create temporary table t1(a int, index(a)); +insert into t1 values('1'),('2'),('3'),('4'),('5'); +analyze table t1; +show index from t1; +drop table t1; + # End of 4.1 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 294c59af90f..d582c36a4f4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2140,10 +2140,15 @@ send_result_message: table->table->version=0; // Force close of table else if (open_for_modify) { - pthread_mutex_lock(&LOCK_open); - remove_table_from_cache(thd, table->table->table_cache_key, - table->table->real_name, RTFC_NO_FLAG); - pthread_mutex_unlock(&LOCK_open); + if (table->table->tmp_table) + table->table->file->info(HA_STATUS_CONST); + else + { + pthread_mutex_lock(&LOCK_open); + remove_table_from_cache(thd, table->table->table_cache_key, + table->table->real_name, RTFC_NO_FLAG); + pthread_mutex_unlock(&LOCK_open); + } /* May be something modified consequently we have to invalidate cache */ query_cache_invalidate3(thd, table->table, 0); } From 4de90ee7c13d6991a1df8a3dadb4b8446665634e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Apr 2006 17:41:40 +0500 Subject: [PATCH 2/8] bug $17756 (sp_notembedded.test unstable) mysql-test/r/sp_notembedded.result: result fixed mysql-test/t/sp_notembedded.test: test case fixed so as the previous test won't affect the result of SHOW PROCESSLIST command --- mysql-test/r/sp_notembedded.result | 2 ++ mysql-test/t/sp_notembedded.test | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index d434f5c32ce..1faf8834980 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -1,3 +1,4 @@ +drop table if exists t1,t3; drop procedure if exists bug4902| create procedure bug4902() begin @@ -204,3 +205,4 @@ drop procedure bug10100pv| drop procedure bug10100pd| drop procedure bug10100pc| drop view v1| +drop table t3; diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 3854297ec0c..ead33ff9968 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -1,6 +1,10 @@ # Can't test with embedded server -- source include/not_embedded.inc +--sleep 2 +--disable_warnings +drop table if exists t1,t3; +--enable_warnings delimiter |; # @@ -260,3 +264,4 @@ drop procedure bug10100pc| drop view v1| delimiter ;| +drop table t3; From 57ecf2b4b417f9f100d56b65413a7133d405809a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Apr 2006 15:01:21 +0500 Subject: [PATCH 3/8] bug #15442 (mysqltest.test doesn't work with the embedded server) mysql-test/mysql-test-run.pl: no ndbcluster needed here mysql-test/mysql-test-run.sh: no ndbcluster needed here mysql-test/t/mysqltest.test: this test shouldn't work with the embedded server --- mysql-test/mysql-test-run.pl | 1 + mysql-test/mysql-test-run.sh | 1 + mysql-test/t/mysqltest.test | 1 + 3 files changed, 3 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 20bb6e0117a..3fcc5b554d8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -678,6 +678,7 @@ sub command_line_setup () { $glob_use_embedded_server= 1; push(@glob_test_mode, "embedded"); $opt_skip_rpl= 1; # We never run replication with embedded + $opt_skip_ndbcluster= 1; if ( $opt_extern ) { diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index c8d54d7e86c..e74a5ac82d0 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -279,6 +279,7 @@ while test $# -gt 0; do USE_EMBEDDED_SERVER=1 USE_MANAGER=0 NO_SLAVE=1 USE_RUNNING_SERVER="" + USE_NDBCLUSTER="" TEST_MODE="$TEST_MODE embedded" ;; --purify) USE_PURIFY=1 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index f5c6a7617c5..a15a143e9f4 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1,3 +1,4 @@ +-- source include/not_embedded.inc # ============================================================================ # From f01b0ac2212a8e8c4192842ddba123198353c591 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Apr 2006 22:05:23 +0500 Subject: [PATCH 4/8] bug #15860 (SPATIAL keys in INNODB) mysql-test/r/innodb.result: result added mysql-test/t/innodb.test: testcase sql/ha_myisam.cc: HA_CAN_RTREEKEYS added to ha_myisam sql/handler.h: HA_CAN_RTREEKEYS defined sql/share/errmsg.txt: error message added sql/sql_table.cc: check that the handler allows SPATIAL keys --- mysql-test/r/innodb.result | 2 ++ mysql-test/t/innodb.test | 7 +++++++ sql/ha_myisam.cc | 2 +- sql/handler.h | 1 + sql/share/errmsg.txt | 2 ++ sql/sql_table.cc | 6 ++++++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 9a190557211..1e6793c39db 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -3241,3 +3241,5 @@ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; a a 2005-10-01 2005-10-01 drop table t1, t2; +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; +ERROR HY000: The used table type doesn't support SPATIAL indexes diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index b0835cd8419..b95a6a25f28 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -2139,3 +2139,10 @@ insert into t2 values('2005-10-01'); select * from t1, t2 where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; drop table t1, t2; + +# +# Bug #15680 (SPATIAL key in innodb) +# +--error 1461 +create table t1 (g geometry not null, spatial gk(g)) engine=innodb; + diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index ff6431fa0f3..128cc191434 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -165,7 +165,7 @@ ha_myisam::ha_myisam(TABLE *table_arg) int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME | - HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD), + HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS), can_enable_indexes(1) {} diff --git a/sql/handler.h b/sql/handler.h index 977bd77a54e..056b11f2526 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -80,6 +80,7 @@ */ #define HA_CAN_INSERT_DELAYED (1 << 14) #define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15) +#define HA_CAN_RTREEKEYS (1 << 17) #define HA_NOT_DELETE_WITH_CACHE (1 << 18) #define HA_NO_PREFIX_CHAR_KEYS (1 << 20) #define HA_CAN_FULLTEXT (1 << 21) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 37487c245a9..5de070faeb5 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5611,3 +5611,5 @@ ER_TABLE_NEEDS_UPGRADE eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!" ER_SP_NO_AGGREGATE 42000 eng "AGGREGATE is not supported for stored functions" +ER_TABLE_CANT_HANDLE_SPKEYS + eng "The used table type doesn't support SPATIAL indexes" diff --git a/sql/sql_table.cc b/sql/sql_table.cc index cb556acd5c7..f57fb4715d2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1130,6 +1130,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, /* TODO: Add proper checks if handler supports key_type and algorithm */ if (key_info->flags & HA_SPATIAL) { + if (!(file->table_flags() & HA_CAN_RTREEKEYS)) + { + my_message(ER_TABLE_CANT_HANDLE_SPKEYS, ER(ER_TABLE_CANT_HANDLE_SPKEYS), + MYF(0)); + DBUG_RETURN(-1); + } if (key_info->key_parts != 1) { my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX"); From 651c0c18f04e5c6831402916b66777817dd57c75 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Apr 2006 13:07:53 +0500 Subject: [PATCH 5/8] bug #16892 (mysql_client_test fails in embedded server) mysql-test/t/mysql_client_test.test: test disabled in embedded server --- mysql-test/t/mysql_client_test.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 66b57dd5fb7..1225bf73009 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -1,3 +1,6 @@ +# This test should work in embedded server after we fix mysqltest +-- source include/not_embedded.inc + # We run with different binaries for normal and --embedded-server # # If this test fails with "command "$MYSQL_CLIENT_TEST" failed", From 82e938f681c85043386c72a28f85dd23fe930275 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Apr 2006 15:58:27 +0500 Subject: [PATCH 6/8] bug #18455 (embedded server Win32 build) VC++Files/libmysqld/libmysqld.dsp: my_user.c file added VC++Files/libmysqld/libmysqld.vcproj: my_user.c file added VC++Files/libmysqld/libmysqld_ia64.dsp: my_user.c added --- VC++Files/libmysqld/libmysqld.dsp | 4 +++ VC++Files/libmysqld/libmysqld.vcproj | 36 ++++++++++++++++++++++++++ VC++Files/libmysqld/libmysqld_ia64.dsp | 4 +++ 3 files changed, 44 insertions(+) diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp index 87a88333a2a..8c1a5271656 100644 --- a/VC++Files/libmysqld/libmysqld.dsp +++ b/VC++Files/libmysqld/libmysqld.dsp @@ -363,6 +363,10 @@ SOURCE=..\mysys\my_getopt.c SOURCE=..\sql-common\my_time.c # End Source File # Begin Source File + +SOURCE=..\sql-common\my_user.c +# End Source File +# Begin Source File SOURCE=..\sql\net_serv.cpp # End Source File diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj index 47fb660bb7a..fe791d702a3 100644 --- a/VC++Files/libmysqld/libmysqld.vcproj +++ b/VC++Files/libmysqld/libmysqld.vcproj @@ -2009,6 +2009,42 @@ PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/> + + + + + + + + + + + + + + Date: Wed, 3 May 2006 17:43:32 +0500 Subject: [PATCH 7/8] merging fix --- sql/sql_table.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f6de9e34785..e9be44d7f24 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2570,7 +2570,7 @@ send_result_message: table->table->s->version=0; // Force close of table else if (open_for_modify) { - if (table->table->tmp_table) + if (table->table->s->tmp_table) table->table->file->info(HA_STATUS_CONST); else { From a1e9539b62bdda3651e5b152db21586bc7a3e47e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 May 2006 19:01:29 +0500 Subject: [PATCH 8/8] merging fix --- mysql-test/t/innodb.test | 6 ------ mysql-test/t/sp_notembedded.test | 1 - 2 files changed, 7 deletions(-) diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 703e3b311b9..e4c8bf89cca 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -2190,12 +2190,6 @@ SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; drop table t2, t1; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 - where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -drop table t1, t2; # # Bug #15680 (SPATIAL key in innodb) diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 893884b302f..0adbeb2d98b 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -265,4 +265,3 @@ drop view v1| drop table t3| delimiter ;| -drop table t3;