#At file:///home/kgeorge/mysql/work/B37428-4.1/ based on
revid:timothy.smith@stripped
2709 Georgi Kodinov 2008-12-04
Backport of bug #37428 to 4.1
modified:
sql/Makefile.am
sql/mysql_priv.h
sql/mysqld.cc
sql/set_var.cc
sql/sql_udf.cc
sql/unireg.h
per-file messages:
sql/Makefile.am
Backport of bug #37428 to 4.1
sql/mysql_priv.h
Backport of bug #37428 to 4.1
sql/mysqld.cc
Backport of bug #37428 to 4.1
sql/set_var.cc
Backport of bug #37428 to 4.1
sql/sql_udf.cc
Backport of bug #37428 to 4.1
sql/unireg.h
Backport of bug #37428 to 4.1
=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am 2007-05-30 20:11:53 +0000
+++ b/sql/Makefile.am 2008-12-04 16:17:11 +0000
@@ -149,7 +149,7 @@ lex_hash.h: gen_lex_hash.cc lex.h
# For testing of udf_example.so; Works on platforms with gcc
# (This is not part of our build process but only provided as an example)
udf_example.so: udf_example.cc
- $(CXXCOMPILE) -shared -o $@ $<
+ $(CXXCOMPILE) -fPIC -shared -o $@ $<
distclean-local:
rm -f lex_hash.h
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2008-07-26 09:39:31 +0000
+++ b/sql/mysql_priv.h 2008-12-04 16:17:11 +0000
@@ -973,6 +973,9 @@ extern char *shared_memory_base_name, *m
extern bool opt_enable_shared_memory;
extern char *default_tz_name;
+extern char *opt_plugin_dir_ptr;
+extern char opt_plugin_dir[FN_REFLEN];
+
extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern FILE *bootstrap_file;
extern FILE *stderror_file;
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-07-26 09:39:31 +0000
+++ b/sql/mysqld.cc 2008-12-04 16:17:11 +0000
@@ -287,6 +287,9 @@ bool opt_using_transactions, using_updat
bool volatile abort_loop, select_thread_in_use, signal_thread_in_use;
bool volatile ready_to_exit, shutdown_in_progress, grant_option;
+char opt_plugin_dir[FN_REFLEN];
+char *opt_plugin_dir_ptr;
+
my_bool opt_skip_slave_start = 0; // If set, slave is not autostarted
my_bool opt_reckless_slave = 0;
my_bool opt_enable_named_pipe= 0, opt_debugging= 0;
@@ -4420,6 +4423,7 @@ enum options_mysqld
OPT_LOG_QUERIES_NOT_USING_INDEXES,
OPT_DEFAULT_TIME_ZONE,
OPT_LOG_SLOW_ADMIN_STATEMENTS,
+ OPT_PLUGIN_DIR,
OPT_MERGE
};
@@ -4856,6 +4860,10 @@ Disable with --skip-ndbcluster (will sav
{"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.",
(gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"plugin_dir", OPT_PLUGIN_DIR,
+ "Directory for plugins.",
+ (gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &mysqld_port,
(gptr*) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log", OPT_RELAY_LOG,
@@ -6908,6 +6916,9 @@ static void fix_paths(void)
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
(void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
+ (void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr :
+ "", "");
+ opt_plugin_dir_ptr= opt_plugin_dir;
char *sharedir=get_relative_path(SHAREDIR);
if (test_if_hard_path(sharedir))
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2007-12-17 08:42:55 +0000
+++ b/sql/set_var.cc 2008-12-04 16:17:11 +0000
@@ -853,6 +853,7 @@ struct show_var_st init_vars[]= {
{sys_old_passwords.name, (char*) &sys_old_passwords, SHOW_SYS},
{"open_files_limit", (char*) &open_files_limit, SHOW_LONG},
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
+ {"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR},
{"port", (char*) &mysqld_port, SHOW_INT},
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
{"protocol_version", (char*) &protocol_version, SHOW_INT},
=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc 2005-07-04 14:05:20 +0000
+++ b/sql/sql_udf.cc 2008-12-04 16:17:11 +0000
@@ -213,7 +213,18 @@ void udf_init()
void *dl = find_udf_dl(tmp->dl);
if (dl == NULL)
{
- if (!(dl = dlopen(tmp->dl, RTLD_NOW)))
+ char dlpath[FN_REFLEN];
+ if (*opt_plugin_dir)
+ strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl,
+ NullS);
+ else
+ {
+ strxnmov(dlpath, sizeof(dlpath)-1, tmp->dl, NullS);
+ push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+ "plugin_dir was not specified");
+ }
+ DBUG_PRINT("info", ("Calling dlopen, udf->dl: %s", dlpath));
+ if (!(dl = dlopen(dlpath, RTLD_NOW)))
{
/* Print warning to log */
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl,errno,dlerror());
=== modified file 'sql/unireg.h'
--- a/sql/unireg.h 2006-04-12 19:05:38 +0000
+++ b/sql/unireg.h 2008-12-04 16:17:11 +0000
@@ -36,6 +36,9 @@
#ifndef SHAREDIR
#define SHAREDIR "share/"
#endif
+#ifndef PLUGINDIR
+#define PLUGINDIR "lib/plugin"
+#endif
#define ER(X) errmesg[(X)-1000]
#define ER_SAFE(X) (((X) >= 1000 && (X) < ER_ERROR_MESSAGES + 1000) ? ER(X)
: "Invalid error code")
| Thread |
|---|
| • bzr commit into mysql-4.1 branch (kgeorge:2709) Bug#37428 | Georgi Kodinov | 4 Dec |