3406 magnus.blaudd@stripped 2011-11-14
WL#5881
- remove MCP patch for global schema lock
modified:
sql/handler.cc
sql/handler.h
sql/sql_db.cc
sql/sql_parse.cc
sql/sql_rename.cc
sql/sql_table.cc
sql/sql_truncate.cc
storage/ndb/CMakeLists.txt
3405 magnus.blaudd@stripped 2011-11-14
WL#5881
- cherrypick support for compiling without global schema lock
from 5.5-cluster
modified:
sql/ndb_global_schema_lock.cc
3404 magnus.blaudd@stripped 2011-11-14
WL#5881
- remove MCP patch for WL#3627(aka WL#5961)
modified:
mysql-test/r/tablespace.result
mysql-test/t/tablespace.test
sql/field.h
sql/handler.h
sql/lex.h
sql/sql_show.cc
sql/sql_yacc.yy
sql/table.cc
sql/unireg.cc
storage/ndb/CMakeLists.txt
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-11-14 10:18:52 +0000
+++ b/sql/handler.cc 2011-11-14 14:25:51 +0000
@@ -4324,6 +4324,7 @@ int ha_table_exists_in_engine(THD* thd,
DBUG_RETURN(args.err);
}
+#ifdef HAVE_NDB_BINLOG
/*
TODO: change this into a dynamic struct
List<handlerton> does not work as
@@ -4337,7 +4338,6 @@ struct hton_list_st
uint sz;
};
-#ifdef HAVE_NDB_BINLOG
struct binlog_func_st
{
enum_binlog_func fn;
@@ -4462,91 +4462,6 @@ void ha_binlog_log_query(THD *thd, handl
}
#endif
-
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
-/**
- Fill list of htons which are initialized and have the global_schema_func set
-*/
-static my_bool global_schema_func_list(THD *thd, plugin_ref plugin, void *arg)
-{
- hton_list_st *hton_list= (hton_list_st *)arg;
- handlerton *hton= plugin_data(plugin, handlerton *);
- if (hton->state == SHOW_OPTION_YES && hton->global_schema_func)
- {
- uint sz= hton_list->sz;
- if (sz == MAX_HTON_LIST_ST-1)
- {
- /* list full */
- return FALSE;
- }
- hton_list->hton[sz]= hton;
- hton_list->sz= sz+1;
- }
- return FALSE;
-}
-
-
-/**
- Lock the global(distributed) schema lock
-*/
-static int ha_global_schema_lock(THD *thd, bool no_lock_queue)
-{
- hton_list_st hton_list;
- uint i, sz, res= 0;
-
- hton_list.sz= 0;
- plugin_foreach(thd, global_schema_func_list,
- MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
-
- for (i= 0, sz= hton_list.sz; i < sz ; i++)
- res|= hton_list.hton[i]->global_schema_func(thd, true, (void*)no_lock_queue);
- return res;
-}
-
-/**
- Unlock the global(distributed) schema lock
-*/
-static int ha_global_schema_unlock(THD *thd)
-{
- hton_list_st hton_list;
- uint i, sz, res= 0;
-
- hton_list.sz= 0;
- plugin_foreach(thd, global_schema_func_list,
- MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
-
- for (i= 0, sz= hton_list.sz; i < sz ; i++)
- res|= hton_list.hton[i]->global_schema_func(thd, false, NULL);
- return res;
-}
-
-Ha_global_schema_lock_guard::Ha_global_schema_lock_guard(THD *thd)
- : m_thd(thd), m_locked(false)
-{
-}
-
-Ha_global_schema_lock_guard::~Ha_global_schema_lock_guard()
-{
- if (m_locked)
- ha_global_schema_unlock(m_thd);
-}
-
-int Ha_global_schema_lock_guard::lock(bool no_lock_queue)
-{
- /* only one lock call allowed */
- DBUG_ASSERT(!m_locked);
-
- /*
- Always set m_locked, even if lock fails. Since the
- lock/unlock calls are reference counted, the number
- of calls to lock and unlock need to match up.
- */
- m_locked= true;
-
- return ha_global_schema_lock(m_thd, no_lock_queue);
-}
-#endif
-
/**
Calculate cost of 'index only' scan for given index and number of records
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-11-14 13:01:55 +0000
+++ b/sql/handler.h 2011-11-14 14:25:51 +0000
@@ -800,11 +800,6 @@ struct handlerton
const char *wild, bool dir, List<LEX_STRING> *files);
int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db,
const char *name);
-
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- int (*global_schema_func)(THD* thd, bool lock, void* args);
-#endif
-
uint32 license; /* Flag for Engine License */
void *data; /* Location for engines to keep personal structures */
};
@@ -2579,19 +2574,6 @@ int ha_binlog_end(THD *thd);
#define ha_binlog_end(a) do {} while (0)
#endif
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
-class Ha_global_schema_lock_guard
-{
-public:
- Ha_global_schema_lock_guard(THD *thd);
- ~Ha_global_schema_lock_guard();
- int lock(bool no_lock_queue= false);
-private:
- THD* m_thd;
- bool m_locked;
-};
-#endif
-
const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path);
bool mysql_xa_recover(THD *thd);
=== modified file 'sql/ndb_global_schema_lock.cc'
--- a/sql/ndb_global_schema_lock.cc 2011-09-22 14:00:22 +0000
+++ b/sql/ndb_global_schema_lock.cc 2011-11-14 14:22:27 +0000
@@ -353,6 +353,8 @@ ndbcluster_global_schema_unlock(THD *thd
DBUG_RETURN(0);
}
+
+#ifndef NDB_WITHOUT_GLOBAL_SCHEMA_LOCK
static
int
ndbcluster_global_schema_func(THD *thd, bool lock, void* args)
@@ -362,9 +364,11 @@ ndbcluster_global_schema_func(THD *thd,
bool no_lock_queue = (bool)args;
return ndbcluster_global_schema_lock(thd, no_lock_queue, true);
}
-
+
return ndbcluster_global_schema_unlock(thd);
}
+#endif
+
#include "ndb_global_schema_lock.h"
@@ -376,7 +380,9 @@ void ndbcluster_global_schema_lock_init(
gsl_initialized= true;
pthread_mutex_init(&gsl_mutex, MY_MUTEX_INIT_FAST);
+#ifndef NDB_WITHOUT_GLOBAL_SCHEMA_LOCK
hton->global_schema_func= ndbcluster_global_schema_func;
+#endif
}
@@ -393,6 +399,11 @@ void ndbcluster_global_schema_lock_deini
bool
Thd_ndb::has_required_global_schema_lock(const char* func)
{
+#ifdef NDB_WITHOUT_GLOBAL_SCHEMA_LOCK
+ // The global schema lock hook is not installed ->
+ // no thd has gsl
+ return true;
+#else
if (global_schema_lock_error)
{
// An error occured while locking, either because
@@ -415,6 +426,7 @@ Thd_ndb::has_required_global_schema_lock
(int)query->length, query->str, func);
abort();
return false;
+#endif
}
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2011-09-22 14:00:22 +0000
+++ b/sql/sql_db.cc 2011-11-14 14:25:51 +0000
@@ -559,11 +559,6 @@ int mysql_create_db(THD *thd, char *db,
my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
DBUG_RETURN(-1);
}
-
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
- (void)global_schema_lock.lock();
- #endif
if (lock_schema_name(thd, db))
DBUG_RETURN(-1);
@@ -697,11 +692,6 @@ bool mysql_alter_db(THD *thd, const char
int error= 0;
DBUG_ENTER("mysql_alter_db");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
- (void)global_schema_lock.lock();
-#endif
-
if (lock_schema_name(thd, db))
DBUG_RETURN(TRUE);
@@ -783,10 +773,6 @@ bool mysql_rm_db(THD *thd,char *db,bool
Drop_table_error_handler err_handler;
DBUG_ENTER("mysql_rm_db");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
- (void)global_schema_lock.lock();
- #endif
if (lock_schema_name(thd, db))
DBUG_RETURN(true);
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-09-27 12:11:16 +0000
+++ b/sql/sql_parse.cc 2011-11-14 14:25:51 +0000
@@ -2657,13 +2657,6 @@ case SQLCOM_PREPARE:
goto end_with_restore_list;
}
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
-
- if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
- (void)global_schema_lock.lock();
-#endif
-
if (!(res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0)))
{
/* The table already exists */
=== modified file 'sql/sql_rename.cc'
--- a/sql/sql_rename.cc 2011-09-22 14:00:22 +0000
+++ b/sql/sql_rename.cc 2011-11-14 14:25:51 +0000
@@ -48,9 +48,6 @@ bool mysql_rename_tables(THD *thd, TABLE
char *rename_log_table[2]= {NULL, NULL};
DBUG_ENTER("mysql_rename_tables");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
-#endif
/*
Avoid problems with a rename on a table that we have locked or
if the user is trying to to do this in a transcation context
@@ -141,10 +138,6 @@ bool mysql_rename_tables(THD *thd, TABLE
goto err;
}
}
-
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- (void)global_schema_lock.lock();
-#endif
if (lock_table_names(thd, table_list, 0, thd->variables.lock_wait_timeout, 0))
goto err;
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-09-23 13:06:41 +0000
+++ b/sql/sql_table.cc 2011-11-14 14:25:51 +0000
@@ -2043,10 +2043,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST
DBUG_ENTER("mysql_rm_table");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
-#endif
-
/* Disable drop of enabled log tables, must be done before name locking */
for (table= tables; table; table= table->next_local)
{
@@ -2060,10 +2056,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST
if (!drop_temporary)
{
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- (void)global_schema_lock.lock();
-#endif
-
if (!thd->locked_tables_mode)
{
if (lock_table_names(thd, tables, NULL,
@@ -4543,15 +4535,6 @@ bool mysql_create_table(THD *thd, TABLE_
bool is_trans= FALSE;
DBUG_ENTER("mysql_create_table");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
- if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
- !create_info->frm_only)
- {
- (void)global_schema_lock.lock();
- }
-#endif
-
/*
Open or obtain an exclusive metadata lock on table being created.
*/
@@ -4750,12 +4733,6 @@ bool mysql_create_like_table(THD* thd, T
uint not_used;
DBUG_ENTER("mysql_create_like_table");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock(thd);
-
- if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
- (void)global_schema_lock.lock();
-#endif
/*
We the open source table to get its description in HA_CREATE_INFO
@@ -6127,32 +6104,6 @@ bool mysql_alter_table(THD *thd,char *ne
DBUG_RETURN(TRUE);
}
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock_guard(thd);
- if (ha_legacy_type(table->s->db_type()) == DB_TYPE_NDBCLUSTER ||
- ha_legacy_type(create_info->db_type) == DB_TYPE_NDBCLUSTER)
- {
- // From or to engine is NDB
- if (thd->locked_tables_mode)
- {
- /*
- To avoid deadlock in this situation:
- - if other thread has lock do not enter lock queue
- and report an error instead
- */
- if (global_schema_lock_guard.lock(true))
- {
- my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
- DBUG_RETURN(TRUE);
- }
- }
- else
- {
- global_schema_lock_guard.lock();
- }
- }
-#endif
-
/* Check that we are not trying to rename to an existing table */
if (new_name)
{
=== modified file 'sql/sql_truncate.cc'
--- a/sql/sql_truncate.cc 2011-09-28 09:01:08 +0000
+++ b/sql/sql_truncate.cc 2011-11-14 14:25:51 +0000
@@ -392,9 +392,6 @@ bool Sql_cmd_truncate_table::truncate_ta
bool binlog_stmt;
DBUG_ENTER("Sql_cmd_truncate_table::truncate_table");
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ha_global_schema_lock_guard global_schema_lock_guard(thd);
-#endif
DBUG_ASSERT((!table_ref->table) ||
(table_ref->table && table_ref->table->s));
@@ -437,10 +434,6 @@ bool Sql_cmd_truncate_table::truncate_ta
}
else /* It's not a temporary table. */
{
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
- global_schema_lock_guard.lock();
-#endif
-
bool hton_can_recreate;
if (lock_table(thd, table_ref, &hton_can_recreate))
=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt 2011-11-14 13:01:55 +0000
+++ b/storage/ndb/CMakeLists.txt 2011-11-14 14:25:51 +0000
@@ -94,6 +94,8 @@ IF(NOT MYSQL_CLUSTER_VERSION)
ADD_DEFINITIONS(-DNDB_WITHOUT_JOIN_PUSHDOWN)
# COLUMN_FORMAT not supported in non MySQL Cluster version yet
ADD_DEFINITIONS(-DNDB_WITHOUT_COLUMN_FORMAT)
+ # Global schema lock hook not available, compile without
+ ADD_DEFINITIONS(-DNDB_WITHOUT_GLOBAL_SCHEMA_LOCK)
ENDIF()
# NDB is DEFAULT plugin in MySQL Cluster
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-cluster branch (magnus.blaudd:3404 to 3406) WL#5881 | magnus.blaudd | 14 Nov |