summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-04-09 16:20:48 +0200
committerSergei Golubchik <sergii@pisem.net>2013-04-09 16:20:48 +0200
commit050d7d6d75cbeb2f048dd0786c702452d2d7c18f (patch)
tree6106cc984e739698cab322cf8cf719b09a97fc1c /sql/handler.cc
parent3a8e1a2205b6e4147a484c598d59f01a9c8b720b (diff)
downloadmariadb-git-050d7d6d75cbeb2f048dd0786c702452d2d7c18f.tar.gz
optimize discovery for cases when the storage engine is known in advance
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index b9480e8611d..f890c2c8324 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4162,6 +4162,8 @@ int ha_create_table(THD *thd, const char *path,
else
{
// open an frm file
+ share.db_plugin= ha_lock_engine(thd, create_info->db_type);
+
if (open_table_def(thd, &share))
goto err;
}
@@ -4343,12 +4345,17 @@ static my_bool discover_handlerton(THD *thd, plugin_ref plugin,
int ha_discover_table(THD *thd, TABLE_SHARE *share)
{
DBUG_ENTER("ha_discover_table");
+ int found;
DBUG_ASSERT(share->error == OPEN_FRM_OPEN_ERROR); // share is not OK yet
- DBUG_ASSERT(!share->db_plugin);
- if (!plugin_foreach(thd, discover_handlerton,
- MYSQL_STORAGE_ENGINE_PLUGIN, share))
+ if (share->db_plugin)
+ found= discover_handlerton(thd, share->db_plugin, share);
+ else
+ found= plugin_foreach(thd, discover_handlerton,
+ MYSQL_STORAGE_ENGINE_PLUGIN, share);
+
+ if (!found)
open_table_error(share, OPEN_FRM_OPEN_ERROR, ENOENT); // not found
DBUG_RETURN(share->error != OPEN_FRM_OK);