List:Commits« Previous MessageNext Message »
From:antony Date:January 21 2008 9:01pm
Subject:bk commit into 5.1 tree (acurtis:1.2655) BUG#33358
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of acurtis.  When acurtis does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-01-21 12:01:21-08:00, acurtis@stripped +4 -0
  Bug#33358
    "Plugin enum variables can't be set from command line"
    fix crash of LOCK_plugins mutex when loading plug-ins from command line.
    fix off-by-one bug when loading multiple plug-ins from the command line.
    initialize command line handling for ENUM and SET plugin variable types.

  mysql-test/r/plugin_bug33358.result@stripped, 2008-01-21 12:01:15-08:00, acurtis@stripped
+3 -0
    New BitKeeper file ``mysql-test/r/plugin_bug33358.result''

  mysql-test/r/plugin_bug33358.result@stripped, 2008-01-21 12:01:15-08:00, acurtis@stripped
+0 -0

  mysql-test/t/plugin_bug33358-master.opt@stripped, 2008-01-21 12:01:15-08:00,
acurtis@stripped +3 -0
    New BitKeeper file ``mysql-test/t/plugin_bug33358-master.opt''

  mysql-test/t/plugin_bug33358-master.opt@stripped, 2008-01-21 12:01:15-08:00,
acurtis@stripped +0 -0

  mysql-test/t/plugin_bug33358.test@stripped, 2008-01-21 12:01:15-08:00, acurtis@stripped +3
-0
    New BitKeeper file ``mysql-test/t/plugin_bug33358.test''

  mysql-test/t/plugin_bug33358.test@stripped, 2008-01-21 12:01:15-08:00, acurtis@stripped +0
-0

  sql/sql_plugin.cc@stripped, 2008-01-21 12:01:15-08:00, acurtis@stripped +39 -18
    bug33358
      fix use of LOCK_plugins mutex when loading plug-ins from command line,
      fix loading of multiple plug-ins from the command line,
      fix command line handling of ENUM and SET plugin variable types.

diff -Nrup a/mysql-test/r/plugin_bug33358.result b/mysql-test/r/plugin_bug33358.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/r/plugin_bug33358.result	2008-01-21 12:01:15 -08:00
@@ -0,0 +1,3 @@
+SELECT @@global.example_enum_var = 'e2';
+@@global.example_enum_var = 'e2'
+1
diff -Nrup a/mysql-test/t/plugin_bug33358-master.opt
b/mysql-test/t/plugin_bug33358-master.opt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/plugin_bug33358-master.opt	2008-01-21 12:01:15 -08:00
@@ -0,0 +1,3 @@
+$EXAMPLE_PLUGIN_OPT
+--plugin-load=EXAMPLE=ha_example.so::
+--plugin-example-enum-var=e2
diff -Nrup a/mysql-test/t/plugin_bug33358.test b/mysql-test/t/plugin_bug33358.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/plugin_bug33358.test	2008-01-21 12:01:15 -08:00
@@ -0,0 +1,3 @@
+--source include/have_example_plugin.inc
+
+SELECT @@global.example_enum_var = 'e2';
diff -Nrup a/sql/sql_plugin.cc b/sql/sql_plugin.cc
--- a/sql/sql_plugin.cc	2007-12-13 03:49:55 -08:00
+++ b/sql/sql_plugin.cc	2008-01-21 12:01:15 -08:00
@@ -1412,7 +1412,11 @@ static bool plugin_load_list(MEM_ROOT *t
   while (list)
   {
     if (p == buffer + sizeof(buffer) - 1)
-      break;
+	{
+      sql_print_error("plugin-load parameter too long");
+      DBUG_RETURN(TRUE);
+	}
+
     switch ((*(p++)= *(list++))) {
     case '\0':
       list= NULL; /* terminate the loop */
@@ -1421,10 +1425,14 @@ static bool plugin_load_list(MEM_ROOT *t
     case ':':     /* can't use this as delimiter as it may be drive letter */
 #endif
     case ';':
-      name.str[name.length]= '\0';
-      if (str != &dl)  // load all plugins in named module
+      str->str[str->length]= '\0';
+      if (str == &name)  // load all plugins in named module
       {
+	    if (!name.length)
+		  continue;
+
         dl= name;
+        pthread_mutex_lock(&LOCK_plugin);
         if ((plugin_dl= plugin_dl_add(&dl, REPORT_TO_LOG)))
         {
           for (plugin= plugin_dl->plugins; plugin->info; plugin++)
@@ -1442,9 +1450,11 @@ static bool plugin_load_list(MEM_ROOT *t
       else
       {
         free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
+        pthread_mutex_lock(&LOCK_plugin);
         if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
           goto error;
       }
+      pthread_mutex_unlock(&LOCK_plugin);
       name.length= dl.length= 0;
       dl.str= NULL; name.str= p= buffer;
       str= &name;
@@ -1453,6 +1463,7 @@ static bool plugin_load_list(MEM_ROOT *t
     case '#':
       if (str == &name)
       {
+        name.str[name.length]= '\0';
         str= &dl;
         str->str= p;
         continue;
@@ -1464,6 +1475,7 @@ static bool plugin_load_list(MEM_ROOT *t
   }
   DBUG_RETURN(FALSE);
 error:
+  pthread_mutex_unlock(&LOCK_plugin);
   sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
                   name.str, dl.str);
   DBUG_RETURN(TRUE);
@@ -2999,7 +3011,8 @@ static int construct_options(MEM_ROOT *m
       DBUG_RETURN(-1);
     }
 
-    if (opt->flags & PLUGIN_VAR_NOCMDOPT)
+    if ((opt->flags & (PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_THDLOCAL))
+                    == PLUGIN_VAR_NOCMDOPT)
       continue;
 
     if (!opt->name)
@@ -3009,7 +3022,7 @@ static int construct_options(MEM_ROOT *m
       DBUG_RETURN(-1);
     }
 
-    if (!(v= find_bookmark(name, opt->name, opt->flags)))
+    if (!(opt->flags & PLUGIN_VAR_THDLOCAL))
     {
       optnamelen= strlen(opt->name);
       optname= (char*) alloc_root(mem_root, namelen + optnamelen + 2);
@@ -3017,7 +3030,22 @@ static int construct_options(MEM_ROOT *m
       optnamelen= namelen + optnamelen + 1;
     }
     else
-      optname= (char*) memdup_root(mem_root, v->key + 1, (optnamelen= v->name_len)
+ 1);
+    {
+      if (!(v= find_bookmark(name, opt->name, opt->flags)))
+      {
+        sql_print_error("Thread local variable '%s' not allocated "
+                        "in plugin '%s'.", opt->name, plugin_name);
+    	DBUG_RETURN(-1);
+      }
+
+      *(int*)(opt + 1)= offset= v->offset;
+
+      if (opt->flags & PLUGIN_VAR_NOCMDOPT)
+        continue;
+
+      optname= (char*) memdup_root(mem_root, v->key + 1, 
+                                   (optnamelen= v->name_len) + 1);
+    }
 
     /* convert '_' to '-' */
     for (p= optname; *p; p++)
@@ -3029,20 +3057,13 @@ static int construct_options(MEM_ROOT *m
     options->app_type= opt;
     options->id= (options-1)->id + 1;
 
-    if (opt->flags & PLUGIN_VAR_THDLOCAL)
-      *(int*)(opt + 1)= offset= v->offset;
-
     plugin_opt_set_limits(options, opt);
 
-    if ((opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_ENUM &&
-        (opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_SET)
-    {
-      if (opt->flags & PLUGIN_VAR_THDLOCAL)
-        options->value= options->u_max_value= (uchar**)
-          (global_system_variables.dynamic_variables_ptr + offset);
-      else
-        options->value= options->u_max_value= *(uchar***) (opt + 1);
-    }
+    if (opt->flags & PLUGIN_VAR_THDLOCAL)
+      options->value= options->u_max_value= (uchar**)
+        (global_system_variables.dynamic_variables_ptr + offset);
+    else
+      options->value= options->u_max_value= *(uchar***) (opt + 1);
 
     options[1]= options[0];
     options[1].name= p= (char*) alloc_root(mem_root, optnamelen + 8);
Thread
bk commit into 5.1 tree (acurtis:1.2655) BUG#33358antony21 Jan
  • Re: bk commit into 5.1 tree (acurtis:1.2655) BUG#33358Sergei Golubchik22 Jan
    • Re: bk commit into 5.1 tree (acurtis:1.2655) BUG#33358Antony T Curtis23 Jan
      • Re: bk commit into 5.1 tree (acurtis:1.2655) BUG#33358Sergei Golubchik25 Jan
        • Re: bk commit into 5.1 tree (acurtis:1.2655) BUG#33358Antony T Curtis25 Jan