summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-08-09 22:33:47 +0400
committerKonstantin Osipov <kostja@sun.com>2010-08-09 22:33:47 +0400
commitf8bfa3287ded5212a28c6d4bbf2d4afee8e5c403 (patch)
tree220bf71a69ee638da7cfd2c542d73122422a8c2f /sql/handler.cc
parent9862f8c7561aa34acb71e8e34444fef7086718e5 (diff)
downloadmariadb-git-f8bfa3287ded5212a28c6d4bbf2d4afee8e5c403.tar.gz
A fix for Bug#41158 "DROP TABLE holds LOCK_open during unlink()".
Remove acquisition of LOCK_open around file system operations, since such operations are now protected by metadata locks. Rework table discovery algorithm to not require LOCK_open. No new tests added since all MDL locking operations are covered in lock.test and mdl_sync.test, and as long as these tests pass despite the increased concurrency, consistency must be unaffected.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 9893b3cac16..567dbe6ea49 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3670,6 +3670,34 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
DBUG_RETURN(error != 0);
}
+
+/**
+ Try to find a table in a storage engine.
+
+ @param db Normalized table schema name
+ @param name Normalized table name.
+ @param[out] exists Only valid if the function succeeded.
+
+ @retval TRUE An error is found
+ @retval FALSE Success, check *exists
+*/
+
+bool
+ha_check_if_table_exists(THD* thd, const char *db, const char *name,
+ bool *exists)
+{
+ uchar *frmblob= NULL;
+ size_t frmlen;
+ DBUG_ENTER("ha_check_if_table_exists");
+
+ *exists= ! ha_discover(thd, db, name, &frmblob, &frmlen);
+ if (*exists)
+ my_free(frmblob);
+
+ DBUG_RETURN(FALSE);
+}
+
+
void st_ha_check_opt::init()
{
flags= sql_flags= 0;