summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorHe Zhenxing <zhenxing.he@sun.com>2009-10-02 13:59:42 +0800
committerHe Zhenxing <zhenxing.he@sun.com>2009-10-02 13:59:42 +0800
commitebca60c1ff07ecb57cd2852052534640322ca576 (patch)
tree3daa6750467ce113f607820f425cf3304b89461e /sql/handler.cc
parent737910fb11e0fe8d2628bf8091c3a7b0de194db2 (diff)
downloadmariadb-git-ebca60c1ff07ecb57cd2852052534640322ca576.tar.gz
Backport BUG#41013 main.bootstrap coredumps in 6.0-rpl
When a storage engine failed to initialize before allocated slot number, the slot number would be 0, and when later finalizing this plugin, it would accidentally unplug the storage engine currently uses slot 0. This patch fixed this problem by add a new macro value HA_SLOT_UNDEF to distinguish undefined slot number from slot 0.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index f966a9099ee..ac959cb62f2 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -413,7 +413,13 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
reuse an array slot. Otherwise the number of uninstall/install
cycles would be limited.
*/
- hton2plugin[hton->slot]= NULL;
+ if (hton->slot != HA_SLOT_UNDEF)
+ {
+ /* Make sure we are not unpluging another plugin */
+ DBUG_ASSERT(hton2plugin[hton->slot] == plugin);
+ DBUG_ASSERT(hton->slot < MAX_HA);
+ hton2plugin[hton->slot]= NULL;
+ }
my_free((uchar*)hton, MYF(0));
@@ -438,6 +444,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
goto err_no_hton_memory;
}
+ hton->slot= HA_SLOT_UNDEF;
/* Historical Requirement */
plugin->data= hton; // shortcut for the future
if (plugin->plugin->init && plugin->plugin->init(hton))