diff options
author | unknown <antony@ppcg5.local> | 2007-03-02 08:43:45 -0800 |
---|---|---|
committer | unknown <antony@ppcg5.local> | 2007-03-02 08:43:45 -0800 |
commit | 1fc7f2117bddfcf91e1220f22714beb86d26c544 (patch) | |
tree | 23fe49e9ab83f6badb4e173587f9e194490a3859 /sql/sql_plugin.h | |
parent | 1eb71c68cb1b2f335a8e6b393cdb3e724ea65a0a (diff) | |
download | mariadb-git-1fc7f2117bddfcf91e1220f22714beb86d26c544.tar.gz |
WL#2936
"Server Variables for Plugins"
Implement support for plugins to declare server variables.
Demonstrate functionality by removing InnoDB specific code from sql/*
New feature for HASH - HASH_UNIQUE flag
New feature for DYNAMIC_ARRAY - initializer accepts preallocated ptr.
Completed support for plugin reference counting.
include/hash.h:
New flag for HASH
HASH_UNIQUE
include/my_getopt.h:
New data types for options: ENUM and SET.
Use typelib to enumerate possible values.
New flag variable:
my_getopt_skip_unknown
include/my_sys.h:
change to DYNAMIC_ARRAY init functions to support pre-allocated buffers
include/mysql.h:
relocate inclusion of typelib due to longlong requirement
include/mysql/plugin.h:
wl2936
New declarations for plugin server variable support.
New functions for use by plugins
include/mysys_err.h:
new my_getopt return value: EXIT_ARGUMENT_INVALID
include/typelib.h:
new typelib function: find_typeset(), returns an int which is a SET of
the elements in the typelib
mysql-test/r/im_utils.result:
change to more specific command line settings
--skip-innodb => --skip-plugin-innodb
etc.
mysql-test/r/log_tables.result:
set default storage engine to MEMORY so that test will succeed even
when some of the other named storage engines are not present
mysql-test/r/ndb_dd_basic.result:
change in error message
mysql-test/r/partition_innodb.result:
change in results
mysql-test/r/ps_1general.result:
bdb doesn't exist, use myisam for a non-transactional engine
mysql-test/r/variables.result:
information schema doesn't sort row results for server variables.
mysql-test/t/log_tables.test:
set default storage engine to MEMORY so that test will succeed even
when some of the other named storage engines are not present
mysql-test/t/ndb_dd_basic.test:
ALTER LOGFILE GROUP no longer silently fail here
mysql-test/t/partition_innodb.test:
ALTER TABLE no longer silently fails for unknown storage engine
mysql-test/t/ps_1general.test:
remove unneccessary parts
use myisam as it is an always present non-transactional engine
mysql-test/t/variables.test:
information schema doesn't sort row results for server variables.
mysql-test/t/warnings_engine_disabled-master.opt:
use the new style command line option
mysys/array.c:
change to DYNAMIC_ARRAY init functions to support pre-allocated buffers
mysys/hash.c:
New flag for HASH
HASH_UNIQUE
Implement HASH_UNIQUE functionality by performing a hash_search
mysys/my_getopt.c:
New data types for options: ENUM and SET.
Use typelib to enumerate possible values.
New flag variable:
my_getopt_skip_unknown
mysys/typelib.c:
new typelib function: find_typeset(), returns an int which is a SET of
the elements in the typelib
sql/ha_ndbcluster.cc:
use ha_statistic_increment() method instead of
statistic_increment() function
ha_ndbcluster variable has gone away.
sql/ha_partition.cc:
fix for reference counting
sql/ha_partition.h:
fix for reference counting
sql/handler.cc:
fixes for reference counting
sql/handler.h:
fixes for reference counting
some new methods to aid storage engine writers
sql/item_func.cc:
find_sys_var() function now requires thd
sql/item_sum.cc:
fixes for ref counting
sql/mysql_priv.h:
remove unneccessary globals.
new lock: LOCK_system_variables_hash
sql/mysqld.cc:
Remove InnoBase specific code.
Support plugin command line processing.
sql/set_var.cc:
Remove InnoBase specific declarations
Remove redundant declarations
changes to permit new variables at run time
changes for ref counting
sql/set_var.h:
changes to permit new variables at run time
changes for ref counting
sql/sql_base.cc:
changes for ref counting
sql/sql_cache.cc:
mark code as needing work in the future
sql/sql_class.cc:
new functions to aid plugin authors
initialize variables for dynamic plugin variables
sql/sql_class.h:
remove InnoBase specific declarations
New declarations for plugin variables.
sql/sql_connect.cc:
initialization and cleanup of plugin variables
sql/sql_delete.cc:
change for ref counting
sql/sql_insert.cc:
change for ref counting
sql/sql_lex.cc:
changes for ref counting and plugin variables
sql/sql_lex.h:
add properties for plugin ref counting,
add to distructor to clean up
sql/sql_partition.cc:
changes for ref counting
sql/sql_plugin.cc:
WL2936
Plugin Variables
New methods and code to support server variables for plugins.
New code to complete plugin reference counting
Debug code adds further indirection so that malloc debugging can be
used to aid finding plugin ref count leaks
sql/sql_plugin.h:
WL2936
Plugin Variables
New methods and code to support server variables for plugins.
New code to complete plugin reference counting
Debug code adds further indirection so that malloc debugging can be
used to aid finding plugin ref count leaks
sql/sql_repl.cc:
replication system variables moved here from set_var.cc
sql/sql_repl.h:
new function to initialise replication server variables
sql/sql_select.cc:
changes for ref counting
sql/sql_show.cc:
changes for ref counting
sql/sql_table.cc:
changes for ref counting
sql/sql_tablespace.cc:
use supplied functions instead of digging into data structures manually
sql/sql_yacc.yy:
changes for ref counting
find_sys_var() now requires thd parameter
changes on reporting errors to keep user-visible behaviour the same.
sql/structs.h:
changes for ref counting
sql/table.cc:
changes for ref counting
sql/table.h:
changes for ref counting
storage/federated/ha_federated.cc:
use ha_statistic_increment() method instead of statistic_increment()
function
storage/heap/ha_heap.cc:
use ha_statistic_increment() method instead of statistic_increment()
function
storage/innobase/handler/ha_innodb.cc:
use ha_statistic_increment() method instead of statistic_increment()
function
WL2936
Move InnoBase specific code out of mysqld.cc and into here
Declare all required server variables for InnoBase
storage/innobase/include/trx0trx.h:
store a bit more state so that InnoBase does not have to dig into
mysqld internal data structures.
storage/myisam/ha_myisam.cc:
use ha_statistic_increment() method instead of statistic_increment()
function
storage/myisammrg/ha_myisammrg.cc:
use ha_statistic_increment() method instead of statistic_increment()
function
Diffstat (limited to 'sql/sql_plugin.h')
-rw-r--r-- | sql/sql_plugin.h | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index d86d9332a92..b3293f3ebda 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -16,6 +16,17 @@ #ifndef _sql_plugin_h #define _sql_plugin_h +class sys_var; + +/* + the following flags are valid for plugin_init() +*/ +#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1 +#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2 +#define PLUGIN_INIT_SKIP_INITIALIZATION 4 + +#define INITIAL_LEX_PLUGIN_LIST_SIZE 16 + /* the following #define adds server-only members to enum_mysql_show_type, that is defined in plugin.h @@ -41,6 +52,7 @@ typedef struct st_mysql_show_var SHOW_VAR; #define PLUGIN_IS_DELETED 2 #define PLUGIN_IS_UNINITIALIZED 4 #define PLUGIN_IS_READY 8 +#define PLUGIN_IS_DYING 16 /* A handle for the dynamic library containing a plugin or plugins. */ @@ -63,25 +75,57 @@ struct st_plugin_int uint state; uint ref_count; /* number of threads using the plugin */ void *data; /* plugin type specific, e.g. handlerton */ + MEM_ROOT mem_root; /* memory for dynamic plugin structures */ + sys_var *system_vars; /* server variables for this plugin */ }; +#ifdef DBUG_OFF +typedef struct st_plugin_int *plugin_ref; +#define plugin_decl(pi) ((pi)->plugin) +#define plugin_dlib(pi) ((pi)->plugin_dl) +#define plugin_data(pi,cast) ((cast)((pi)->data)) +#define plugin_name(pi) (&((pi)->name)) +#define plugin_state(pi) ((pi)->state) +#else +typedef struct st_plugin_int **plugin_ref; +#define plugin_decl(pi) ((pi)[0]->plugin) +#define plugin_dlib(pi) ((pi)[0]->plugin_dl) +#define plugin_data(pi,cast) ((cast)((pi)[0]->data)) +#define plugin_name(pi) (&((pi)[0]->name)) +#define plugin_state(pi) ((pi)[0]->state) +#endif + typedef int (*plugin_type_init)(struct st_plugin_int *); +extern char *opt_plugin_load; extern char *opt_plugin_dir_ptr; extern char opt_plugin_dir[FN_REFLEN]; extern const LEX_STRING plugin_type_names[]; -extern int plugin_init(int); + +extern int plugin_init(int *argc, char **argv, int init_flags); extern void plugin_shutdown(void); -extern my_bool plugin_is_ready(const LEX_STRING *name, int type); -extern st_plugin_int *plugin_lock(const LEX_STRING *name, int type); -extern void plugin_unlock(struct st_plugin_int *plugin); -extern my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl); -extern my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name); +extern void my_print_help_inc_plugins(struct my_option *options, uint size); +extern bool plugin_is_ready(const LEX_STRING *name, int type); +#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO) +#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO) +#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO) +#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO) +extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO); +extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, + int type CALLER_INFO_PROTO); +extern void plugin_unlock(THD *thd, plugin_ref plugin); +extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count); +extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name, + const LEX_STRING *dl); +extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name); +extern bool plugin_register_builtin(struct st_mysql_plugin *plugin); +extern void plugin_thdvar_init(THD *thd, bool lock_locals); +extern void plugin_thdvar_cleanup(THD *thd); typedef my_bool (plugin_foreach_func)(THD *thd, - st_plugin_int *plugin, + plugin_ref plugin, void *arg); #define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D) -extern my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, - int type, uint state_mask, void *arg); +extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, + int type, uint state_mask, void *arg); #endif |