summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysys/hash.c9
-rw-r--r--sql/handler.cc1
-rw-r--r--sql/sql_plugin.cc15
3 files changed, 21 insertions, 4 deletions
diff --git a/mysys/hash.c b/mysys/hash.c
index ab875848989..964ba6b1ca3 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -315,9 +315,12 @@ my_bool my_hash_insert(HASH *info,const byte *record)
LINT_INIT(gpos); LINT_INIT(gpos2);
LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
- if (HASH_UNIQUE & info->flags &&
- hash_search(info, hash_key(info, record, &idx, 1), idx))
- return(TRUE); /* Duplicate entry */
+ if (HASH_UNIQUE & info->flags)
+ {
+ byte *key= (byte*) hash_key(info, record, &idx, 1);
+ if (hash_search(info, key, idx))
+ return(TRUE); /* Duplicate entry */
+ }
flag=0;
if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array)))
diff --git a/sql/handler.cc b/sql/handler.cc
index 07ca6de5023..73cadb1f7f4 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -416,6 +416,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
{
handlerton *hton;
DBUG_ENTER("ha_initialize_handlerton");
+ DBUG_PRINT("plugin", ("initialize plugin: '%s'", plugin->name.str));
hton= (handlerton *)my_malloc(sizeof(handlerton),
MYF(MY_WME | MY_ZEROFILL));
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index bc545f23428..c7ca879e9b4 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -649,7 +649,7 @@ plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type
LEX *lex= thd ? thd->lex : 0;
plugin_ref rc= NULL;
st_plugin_int *plugin;
- DBUG_ENTER("plugin_lock");
+ DBUG_ENTER("plugin_lock_by_name");
pthread_mutex_lock(&LOCK_plugin);
if ((plugin= plugin_find_internal(name, type)))
rc= my_intern_plugin_lock_ci(lex, plugin_int_to_ref(plugin));
@@ -2679,11 +2679,14 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
st_mysql_sys_var *opt, **plugin_option;
st_bookmark *v;
DBUG_ENTER("construct_options");
+ DBUG_PRINT("plugin", ("plugin: '%s' enabled: %d can_disable: %d",
+ tmp->plugin->name, **enabled, can_disable));
/* support --skip-plugin-foo syntax */
memcpy(name, plugin_name, namelen + 1);
my_casedn_str(&my_charset_latin1, name);
strxmov(name + namelen + 1, "plugin-", name, NullS);
+ /* Now we have namelen + 1 + 7 + namelen + 1 == namelen * 2 + 9. */
for (p= name + namelen*2 + 8; p > name; p--)
if (*p == '_')
@@ -2693,10 +2696,18 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
{
strxmov(name + namelen*2 + 10, "Enable ", plugin_name, " plugin. "
"Disable with --skip-", name," (will save memory).", NullS);
+ /*
+ Now we have namelen * 2 + 10 (one char unused) + 7 + namelen + 9 +
+ 20 + namelen + 20 + 1 == namelen * 4 + 67.
+ */
options[0].comment= name + namelen*2 + 10;
}
+ /*
+ NOTE: 'name' is one char above the allocated buffer!
+ NOTE: This code assumes that 'my_bool' and 'char' are of same size.
+ */
*((my_bool *)(name -1))= **enabled;
*enabled= (my_bool *)(name - 1);
@@ -2880,6 +2891,8 @@ static my_option *construct_help_options(MEM_ROOT *mem_root,
bzero(opts, sizeof(my_option) * count);
+ dummy= TRUE; /* plugin is enabled. */
+
can_disable=
my_strcasecmp(&my_charset_latin1, p->name.str, "MyISAM") &&
my_strcasecmp(&my_charset_latin1, p->name.str, "MEMORY");