summaryrefslogtreecommitdiff
path: root/sql/sql_udf.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-02-25 16:04:35 +0100
committerSergei Golubchik <sergii@pisem.net>2014-02-25 16:04:35 +0100
commit0b9a0a3517ca2b75655f3af5c372cf333d3d5fe2 (patch)
tree5c67457ff8abbb89b203a7f55cda776b738c385b /sql/sql_udf.cc
parent6324c36bd703a0f55dcd49dd721af262f73cf7aa (diff)
parentff2e82f4a175b7b023cd167b2fa6e6fcd1bd192e (diff)
downloadmariadb-git-0b9a0a3517ca2b75655f3af5c372cf333d3d5fe2.tar.gz
5.5 merge
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r--sql/sql_udf.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index c792dca873c..fdc932957b2 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -352,6 +352,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
if (!initialized)
DBUG_RETURN(NULL);
+ DEBUG_SYNC(current_thd, "find_udf_before_lock");
/* TODO: This should be changed to reader locks someday! */
if (mark_used)
mysql_rwlock_wrlock(&THR_LOCK_udf); /* Called during fix_fields */
@@ -458,7 +459,12 @@ int mysql_create_function(THD *thd,udf_func *udf)
DBUG_RETURN(1);
}
+ tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
+ "func", TL_WRITE);
+ table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
+
mysql_rwlock_wrlock(&THR_LOCK_udf);
+ DEBUG_SYNC(current_thd, "mysql_create_function_after_lock");
if ((my_hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length)))
{
my_error(ER_UDF_EXISTS, MYF(0), udf->name.str);
@@ -502,9 +508,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
/* create entry in mysql.func table */
- tables.init_one_table("mysql", 5, "func", 4, "func", TL_WRITE);
/* Allow creation of functions even if we can't open func table */
- if (!(table = open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
+ if (!table)
goto err;
table->use_all_columns();
restore_record(table, s->default_values); // Default values for fields
@@ -555,7 +560,12 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
DBUG_RETURN(1);
}
+ tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
+ "func", TL_WRITE);
+ table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
+
mysql_rwlock_wrlock(&THR_LOCK_udf);
+ DEBUG_SYNC(current_thd, "mysql_drop_function_after_lock");
if (!(udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) udf_name->str,
(uint) udf_name->length)))
{
@@ -572,9 +582,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
if (udf->dlhandle && !find_udf_dl(udf->dl))
dlclose(udf->dlhandle);
- tables.init_one_table("mysql", 5, "func", 4, "func", TL_WRITE);
-
- if (!(table = open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
+ if (!table)
goto err;
table->use_all_columns();
table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin);