From 8ee6d33bdd49978b68a78126653d3b4aaa60a4ca Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Sat, 30 Apr 2005 20:23:40 +0400 Subject: [PATCH 1/5] Fix for Bug #9913 "udf_deinit is not called after execution of PS" (aka "deinit is not called when calling udf from trigger"). We should call udf_deinit() function during cleanup phase after prepared (or ordinary) statement execution instead of calling it from Item's desctructor. No test case is provided since it is hard to test UDF's from our test suite. --- sql/item_func.cc | 15 +++++++++++++++ sql/item_func.h | 1 + sql/item_sum.cc | 11 +++++++++++ sql/item_sum.h | 1 + sql/sql_udf.h | 1 + 5 files changed, 29 insertions(+) diff --git a/sql/item_func.cc b/sql/item_func.cc index 2b38584fe23..d1d89b70d10 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1617,6 +1617,13 @@ longlong Item_func_bit_count::val_int() #ifdef HAVE_DLOPEN udf_handler::~udf_handler() +{ + /* Everything should be properly cleaned up by this moment. */ + DBUG_ASSERT(not_original || !(initialized || buffers)); +} + + +void udf_handler::cleanup() { if (!not_original) { @@ -1629,9 +1636,11 @@ udf_handler::~udf_handler() (*deinit)(&initid); } free_udf(u_d); + initialized= FALSE; } if (buffers) // Because of bug in ecc delete [] buffers; + buffers= 0; } } @@ -1871,6 +1880,12 @@ String *udf_handler::val_str(String *str,String *save_str) } +void Item_udf_func::cleanup() +{ + udf.cleanup(); + Item_func::cleanup(); +} + double Item_func_udf_float::val() { diff --git a/sql/item_func.h b/sql/item_func.h index 3a309f4ae99..7244fc73a42 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -786,6 +786,7 @@ public: fixed= 1; return res; } + void cleanup(); Item_result result_type () const { return udf.result_type(); } table_map not_null_tables() const { return 0; } }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7e9c5d09136..dd4cda4ff91 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1449,6 +1449,17 @@ bool Item_udf_sum::add() DBUG_RETURN(0); } +void Item_udf_sum::cleanup() +{ + /* + udf_handler::cleanup() nicely handles case when we have not + original item but one created by copy_or_same() method. + */ + udf.cleanup(); + Item_sum::cleanup(); +} + + Item *Item_sum_udf_float::copy_or_same(THD* thd) { return new (thd->mem_root) Item_sum_udf_float(thd, this); diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..040d9395e3a 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -550,6 +550,7 @@ public: bool add(); void reset_field() {}; void update_field() {}; + void cleanup(); }; diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..acb04e949a3 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc bool get_arguments(); bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, uint arg_count,Item **args); + void cleanup(); double val(my_bool *null_value) { if (get_arguments()) From b8a94814c9f7b49973e1315e8ab4551c7e806415 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 9 May 2005 00:35:48 +0200 Subject: [PATCH 2/5] - added cmd-line-utils/libedit/vis.h to the source distribution --- cmd-line-utils/libedit/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index 9ff005c7156..03f3eb65fbc 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ - search.h tty.h libedit_term.h + search.h tty.h libedit_term.h vis.h EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c From 1b198a78b21e639af4f77641abf85dfd40845b0e Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 9 May 2005 00:47:47 +0200 Subject: [PATCH 3/5] - fix the range test to pass when InnoDB is note enabled (e.g. in the "-classic" build) --- mysql-test/t/range.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 3d3d4748fe3..b8412b6624e 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc + # # Problem with range optimizer # From b1edf499520e0dbce658ebab13ba2ef4e99a7eba Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mylan" <> Date: Mon, 9 May 2005 09:24:05 +0200 Subject: [PATCH 4/5] don't use tmp file for such a triviality --- scripts/mysql_install_db.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 0b82e02761e..8dd95da11e3 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -11,7 +11,6 @@ in_rpm=0 windows=0 defaults="" user="" -tmp_file=/tmp/mysql_install_db.$$ case "$1" in --no-defaults|--defaults-file=*|--defaults-extra-file=*) @@ -223,10 +222,8 @@ then then echo "Fill help tables" fi - echo "use mysql;" > $tmp_file - cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line" + (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line" res=$? - rm $tmp_file if test $res != 0 then echo "" From 5cdf15a919a13ab0f0655b2caf16b550b9bfff14 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 9 May 2005 09:25:47 +0200 Subject: [PATCH 5/5] - added "--skip-comments" to the "mysqldump" test to avoid printing comments that include version-dependent information (which causes test failures when running the test with a different version string) --- mysql-test/r/mysqldump.result | 28 ---------------------------- mysql-test/t/mysqldump.test | 4 ++-- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index bcd690bf681..80c6cad5bbf 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -563,11 +563,6 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(240, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); --- MySQL dump 10.9 --- --- Host: localhost Database: test --- ------------------------------------------------------ --- Server version 4.1.12-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -577,20 +572,11 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `t1` --- - DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` decimal(240,20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Dumping data for table `t1` --- - /*!40000 ALTER TABLE `t1` DISABLE KEYS */; LOCK TABLES `t1` WRITE; @@ -606,11 +592,6 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- MySQL dump 10.9 --- --- Host: localhost Database: test --- ------------------------------------------------------ --- Server version 4.1.12-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -620,20 +601,11 @@ UNLOCK TABLES; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `t1` --- - DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` decimal(240,20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Dumping data for table `t1` --- - /*!40000 ALTER TABLE `t1` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 98ed45f98f6..b89b482a0f9 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -192,6 +192,6 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(240, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); ---exec $MYSQL_DUMP --insert-ignore test t1 ---exec $MYSQL_DUMP --insert-ignore --delayed-insert test t1 +--exec $MYSQL_DUMP --insert-ignore --skip-comments test t1 +--exec $MYSQL_DUMP --insert-ignore --skip-comments --delayed-insert test t1 DROP TABLE t1;