=== modified file 'config/ac-macros/plugins.m4' --- config/ac-macros/plugins.m4 2009-04-01 21:36:07 +0000 +++ config/ac-macros/plugins.m4 2009-10-06 10:25:52 +0000 @@ -460,7 +460,11 @@ ]) ]) ]) - mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]" + m4_ifdef([$9],[ + mysql_mandatory_plugins="$mysql_mandatory_plugins [builtin_]$2[_plugin]," + ],[ + mysql_optional_plugins="$mysql_optional_plugins [builtin_]$2[_plugin]," + ]) [with_plugin_]$2=yes AC_MSG_RESULT([yes]) m4_ifdef([$11],[ === modified file 'configure.in' --- configure.in 2009-10-03 08:04:57 +0000 +++ configure.in 2009-10-06 10:25:52 +0000 @@ -2907,8 +2907,8 @@ AC_SUBST(mysql_plugin_dirs) AC_SUBST(mysql_plugin_libs) -AC_SUBST(mysql_plugin_defs) - +AC_SUBST(mysql_optional_plugins) +AC_SUBST(mysql_mandatory_plugins) # Now that sql_client_dirs and sql_server_dirs are stable, determine the union. # Start with the (longer) server list, add each client item not yet present. === modified file 'sql/sql_builtin.cc.in' --- sql/sql_builtin.cc.in 2006-12-31 01:29:11 +0000 +++ sql/sql_builtin.cc.in 2009-10-06 10:25:52 +0000 @@ -18,10 +18,16 @@ typedef struct st_mysql_plugin builtin_plugin[]; extern builtin_plugin - builtin_binlog_plugin@mysql_plugin_defs@; - -struct st_mysql_plugin *mysqld_builtins[]= -{ - builtin_binlog_plugin@mysql_plugin_defs@,(struct st_mysql_plugin *)0 -}; + @mysql_mandatory_plugins@ @mysql_optional_plugins@ builtin_binlog_plugin; + +struct st_mysql_plugin *mysql_optional_plugins[]= +{ + @mysql_optional_plugins@ 0 +}; + +struct st_mysql_plugin *mysql_mandatory_plugins[]= +{ + builtin_binlog_plugin, @mysql_mandatory_plugins@ 0 +}; + === modified file 'sql/sql_plugin.cc' --- sql/sql_plugin.cc 2009-10-05 16:06:28 +0000 +++ sql/sql_plugin.cc 2009-10-06 10:25:52 +0000 @@ -21,7 +21,8 @@ #define REPORT_TO_LOG 1 #define REPORT_TO_USER 2 -extern struct st_mysql_plugin *mysqld_builtins[]; +extern struct st_mysql_plugin *mysql_optional_plugins[]; +extern struct st_mysql_plugin *mysql_mandatory_plugins[]; /** @note The order of the enumeration is critical. @@ -1148,7 +1149,8 @@ struct st_mysql_plugin *plugin; struct st_plugin_int tmp, *plugin_ptr, **reap; MEM_ROOT tmp_root; bool reaped_mandatory_plugin= FALSE; + bool mandatory= true; DBUG_ENTER("plugin_init"); if (initialized) @@ -1184,8 +1186,13 @@ /* First we register builtin plugins */ - for (builtins= mysqld_builtins; *builtins; builtins++) + for (builtins= mysql_mandatory_plugins; *builtins || mandatory; builtins++) { + if (!*builtins) + { + builtins= mysql_optional_plugins; + mandatory= false; + } for (plugin= *builtins; plugin->info; plugin++) { if (opt_ignore_builtin_innodb && @@ -1197,6 +1204,7 @@ tmp.name.str= (char *)plugin->name; tmp.name.length= strlen(plugin->name); tmp.state= 0; + tmp.is_mandatory= mandatory; free_root(&tmp_root, MYF(MY_MARK_BLOCKS_FREE)); if (test_plugin_options(&tmp_root, &tmp, argc, argv)) tmp.state= PLUGIN_IS_DISABLED; @@ -2605,7 +2613,7 @@ /* Free the string from global_system_variables. */ char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL); DBUG_PRINT("plugin", ("freeing value for: '%s' addr: %p", - var->name, valptr)); + var->name.str, valptr)); my_free(*valptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); *valptr= NULL; } @@ -2931,40 +2939,43 @@ DBUG_ENTER("construct_options"); - options[0].name= plugin_name_ptr= (char*) alloc_root(mem_root, - plugin_name_len + 1); + plugin_name_ptr= (char*) alloc_root(mem_root, plugin_name_len + 1); strcpy(plugin_name_ptr, plugin_name); my_casedn_str(&my_charset_latin1, plugin_name_ptr); convert_underscore_to_dash(plugin_name_ptr, plugin_name_len); - /* support --skip-plugin-foo syntax */ - options[1].name= plugin_name_with_prefix_ptr= (char*) alloc_root(mem_root, - plugin_name_len + - plugin_dash.length + 1); + plugin_name_with_prefix_ptr= (char*) alloc_root(mem_root, + plugin_name_len + + plugin_dash.length + 1); strxmov(plugin_name_with_prefix_ptr, plugin_dash.str, options[0].name, NullS); - options[0].id= options[1].id= 256; /* must be >255. dup id ok */ - options[0].var_type= options[1].var_type= GET_ENUM; - options[0].arg_type= options[1].arg_type= OPT_ARG; - options[0].def_value= options[1].def_value= 1; /* ON */ - options[0].typelib= options[1].typelib= &global_plugin_typelib; - - strxnmov(comment, max_comment_len, "Enable or disable ", plugin_name, - " plugin. Possible values are ON, OFF, FORCE (don't start " - "if the plugin fails to load).", NullS); - options[0].comment= comment; - - /* - Allocate temporary space for the value of the tristate. - This option will have a limited lifetime and is not used beyond - server initialization. - GET_ENUM value is a long integer. - */ - options[0].value= options[1].value= (uchar **)alloc_root(mem_root, - sizeof(long)); - *((ulong*) options[0].value)= (ulong) options[0].def_value; - - options+= 2; - + if (!tmp->is_mandatory) + { + /* support --skip-plugin-foo syntax */ + options[0].name= plugin_name_ptr; + options[1].name= plugin_name_with_prefix_ptr; + options[0].id= options[1].id= 0; + options[0].var_type= options[1].var_type= GET_ENUM; + options[0].arg_type= options[1].arg_type= OPT_ARG; + options[0].def_value= options[1].def_value= 1; /* ON */ + options[0].typelib= options[1].typelib= &global_plugin_typelib; + + strxnmov(comment, max_comment_len, "Enable or disable ", plugin_name, + " plugin. Possible values are ON, OFF, FORCE (don't start " + "if the plugin fails to load).", NullS); + options[0].comment= comment; + /* + Allocate temporary space for the value of the tristate. + This option will have a limited lifetime and is not used beyond + server initialization. + GET_ENUM value is a long integer. + */ + options[0].value= options[1].value= (uchar **)alloc_root(mem_root, + sizeof(long)); + *((ulong*) options[0].value)= (ulong) options[0].def_value; + + options+= 2; + } + if (!my_strcasecmp(&my_charset_latin1, plugin_name_ptr, "NDBCLUSTER")) { plugin_name_ptr= const_cast("ndb"); // Use legacy "ndb" prefix @@ -3189,9 +3200,8 @@ int *argc, char **argv) { struct sys_var_chain chain= { NULL, NULL }; - my_bool can_disable; bool disable_plugin; - enum_plugin_load_policy plugin_load_policy= PLUGIN_ON; + enum_plugin_load_policy plugin_load_policy= tmp->is_mandatory ? PLUGIN_FORCE : PLUGIN_ON; MEM_ROOT *mem_root= alloc_root_inited(&tmp->mem_root) ? &tmp->mem_root : &plugin_mem_root; @@ -3236,7 +3246,8 @@ We adjust the default value to account for the hardcoded exceptions we have set for the federated and ndbcluster storage engines. */ - opts[0].def_value= opts[1].def_value= plugin_load_policy; + if (!tmp->is_mandatory) + opts[0].def_value= opts[1].def_value= plugin_load_policy; error= handle_options(argc, &argv, opts, get_one_plugin_option); (*argc)++; /* add back one for the program name */ @@ -3251,24 +3262,12 @@ Set plugin loading policy from option value. First element in the option list is always the option value. */ - plugin_load_policy= (enum_plugin_load_policy)*(ulong*)opts[0].value; + if (!tmp->is_mandatory) + plugin_load_policy= (enum_plugin_load_policy)*(ulong*)opts[0].value; } disable_plugin= (plugin_load_policy == PLUGIN_OFF); - /* - The 'MyISAM' and 'Memory' storage engines currently can't be disabled. - */ - can_disable= - my_strcasecmp(&my_charset_latin1, tmp->name.str, "MyISAM") && - my_strcasecmp(&my_charset_latin1, tmp->name.str, "MEMORY"); - - tmp->is_mandatory= (plugin_load_policy == PLUGIN_FORCE) || !can_disable; - - if (disable_plugin && !can_disable) - { - sql_print_warning("Plugin '%s' cannot be disabled", tmp->name.str); - disable_plugin= FALSE; - } + tmp->is_mandatory= (plugin_load_policy == PLUGIN_FORCE); /* If the plugin is disabled it should not be initialized. @@ -3347,12 +3346,11 @@ { p= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); - if (!p->plugin->system_vars || - !(opt= construct_help_options(mem_root, p))) + if (!(opt= construct_help_options(mem_root, p))) continue; /* Only options with a non-NULL comment are displayed in help text */ - for (;opt->id; opt++) + for (;opt->name; opt++) if (opt->comment) insert_dynamic(options, (uchar*) opt); }