Skip to content

Commit 2f4d368

Browse files
committedJul 13, 2015
Remove MCP_GLOBAL_SCHEMA_LOCK patch
- prepare for upmerge - this functionality is still only supported by Cluster and will not be merged up.
1 parent ceb199d commit 2f4d368

File tree

7 files changed

+0
-184
lines changed

7 files changed

+0
-184
lines changed
 

‎sql/handler.cc

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -5480,91 +5480,6 @@ int ha_binlog_end(THD* thd)
54805480
return 0;
54815481
}
54825482

5483-
5484-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
5485-
/**
5486-
Fill list of htons which are initialized and have the global_schema_func set
5487-
*/
5488-
static my_bool global_schema_func_list(THD *thd, plugin_ref plugin, void *arg)
5489-
{
5490-
hton_list_st *hton_list= (hton_list_st *)arg;
5491-
handlerton *hton= plugin_data<handlerton*>(plugin);
5492-
if (hton->state == SHOW_OPTION_YES && hton->global_schema_func)
5493-
{
5494-
uint sz= hton_list->sz;
5495-
if (sz == MAX_HTON_LIST_ST-1)
5496-
{
5497-
/* list full */
5498-
return FALSE;
5499-
}
5500-
hton_list->hton[sz]= hton;
5501-
hton_list->sz= sz+1;
5502-
}
5503-
return FALSE;
5504-
}
5505-
5506-
5507-
/**
5508-
Lock the global(distributed) schema lock
5509-
*/
5510-
static int ha_global_schema_lock(THD *thd, bool no_lock_queue)
5511-
{
5512-
hton_list_st hton_list;
5513-
uint i, sz, res= 0;
5514-
5515-
hton_list.sz= 0;
5516-
plugin_foreach(thd, global_schema_func_list,
5517-
MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
5518-
5519-
for (i= 0, sz= hton_list.sz; i < sz ; i++)
5520-
res|= hton_list.hton[i]->global_schema_func(thd, true, (void*)no_lock_queue);
5521-
return res;
5522-
}
5523-
5524-
/**
5525-
Unlock the global(distributed) schema lock
5526-
*/
5527-
static int ha_global_schema_unlock(THD *thd)
5528-
{
5529-
hton_list_st hton_list;
5530-
uint i, sz, res= 0;
5531-
5532-
hton_list.sz= 0;
5533-
plugin_foreach(thd, global_schema_func_list,
5534-
MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
5535-
5536-
for (i= 0, sz= hton_list.sz; i < sz ; i++)
5537-
res|= hton_list.hton[i]->global_schema_func(thd, false, NULL);
5538-
return res;
5539-
}
5540-
5541-
Ha_global_schema_lock_guard::Ha_global_schema_lock_guard(THD *thd)
5542-
: m_thd(thd), m_locked(false)
5543-
{
5544-
}
5545-
5546-
Ha_global_schema_lock_guard::~Ha_global_schema_lock_guard()
5547-
{
5548-
if (m_locked)
5549-
ha_global_schema_unlock(m_thd);
5550-
}
5551-
5552-
int Ha_global_schema_lock_guard::lock(bool no_lock_queue)
5553-
{
5554-
/* only one lock call allowed */
5555-
DBUG_ASSERT(!m_locked);
5556-
5557-
/*
5558-
Always set m_locked, even if lock fails. Since the
5559-
lock/unlock calls are reference counted, the number
5560-
of calls to lock and unlock need to match up.
5561-
*/
5562-
m_locked= true;
5563-
5564-
return ha_global_schema_lock(m_thd, no_lock_queue);
5565-
}
5566-
#endif
5567-
55685483
/**
55695484
Calculate cost of 'index only' scan for given index and number of records
55705485

‎sql/handler.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,6 @@ struct handlerton
816816
const char *name);
817817
int (*make_pushed_join)(handlerton *hton, THD* thd,
818818
const AQP::Join_plan* plan);
819-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
820-
int (*global_schema_func)(THD* thd, bool lock, void* args);
821-
#endif
822819

823820
/**
824821
List of all system tables specific to the SE.
@@ -3905,19 +3902,6 @@ void ha_binlog_wait(THD *thd);
39053902
/* It is required by basic binlog features on both MySQL server and libmysqld */
39063903
int ha_binlog_end(THD *thd);
39073904

3908-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
3909-
class Ha_global_schema_lock_guard
3910-
{
3911-
public:
3912-
Ha_global_schema_lock_guard(THD *thd);
3913-
~Ha_global_schema_lock_guard();
3914-
int lock(bool no_lock_queue= false);
3915-
private:
3916-
THD* m_thd;
3917-
bool m_locked;
3918-
};
3919-
#endif
3920-
39213905
const char *ha_legacy_type_name(legacy_db_type legacy_type);
39223906
const char *get_canonical_filename(handler *file, const char *path,
39233907
char *tmp_path);

‎sql/sql_db.cc

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,6 @@ int mysql_create_db(THD *thd, const char *db, HA_CREATE_INFO *create_info,
569569
my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
570570
DBUG_RETURN(-1);
571571
}
572-
573-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
574-
Ha_global_schema_lock_guard global_schema_lock(thd);
575-
(void)global_schema_lock.lock();
576-
#endif
577572

578573
if (lock_schema_name(thd, db))
579574
DBUG_RETURN(-1);
@@ -721,11 +716,6 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
721716
int error= 0;
722717
DBUG_ENTER("mysql_alter_db");
723718

724-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
725-
Ha_global_schema_lock_guard global_schema_lock(thd);
726-
(void)global_schema_lock.lock();
727-
#endif
728-
729719
if (lock_schema_name(thd, db))
730720
DBUG_RETURN(TRUE);
731721

@@ -807,10 +797,6 @@ bool mysql_rm_db(THD *thd,const LEX_CSTRING &db,bool if_exists, bool silent)
807797
Drop_table_error_handler err_handler;
808798
DBUG_ENTER("mysql_rm_db");
809799

810-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
811-
Ha_global_schema_lock_guard global_schema_lock(thd);
812-
(void)global_schema_lock.lock();
813-
#endif
814800

815801
if (lock_schema_name(thd, db.str))
816802
DBUG_RETURN(true);

‎sql/sql_parse.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,12 +2800,6 @@ case SQLCOM_PREPARE:
28002800
goto end_with_restore_list;
28012801
}
28022802

2803-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
2804-
Ha_global_schema_lock_guard global_schema_lock(thd);
2805-
2806-
if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
2807-
(void)global_schema_lock.lock();
2808-
#endif
28092803
if (!(res= open_tables_for_query(thd, all_tables, 0)))
28102804
{
28112805
/* The table already exists */

‎sql/sql_rename.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
4747
char *rename_log_table[2]= {NULL, NULL};
4848
DBUG_ENTER("mysql_rename_tables");
4949

50-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
51-
Ha_global_schema_lock_guard global_schema_lock(thd);
52-
#endif
5350
/*
5451
Avoid problems with a rename on a table that we have locked or
5552
if the user is trying to to do this in a transcation context
@@ -138,10 +135,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
138135
goto err;
139136
}
140137
}
141-
142-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
143-
(void)global_schema_lock.lock();
144-
#endif
145138

146139
if (lock_table_names(thd, table_list, 0, thd->variables.lock_wait_timeout, 0))
147140
goto err;

‎sql/sql_table.cc

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,10 +2091,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
20912091

20922092
DBUG_ENTER("mysql_rm_table");
20932093

2094-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
2095-
Ha_global_schema_lock_guard global_schema_lock(thd);
2096-
#endif
2097-
20982094
/* Disable drop of enabled log tables, must be done before name locking */
20992095
for (table= tables; table; table= table->next_local)
21002096
{
@@ -2118,10 +2114,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
21182114

21192115
if (!drop_temporary)
21202116
{
2121-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
2122-
(void)global_schema_lock.lock();
2123-
#endif
2124-
21252117
if (!thd->locked_tables_mode)
21262118
{
21272119
if (lock_table_names(thd, tables, NULL,
@@ -5247,14 +5239,6 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
52475239
uint not_used;
52485240
DBUG_ENTER("mysql_create_table");
52495241

5250-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
5251-
Ha_global_schema_lock_guard global_schema_lock(thd);
5252-
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
5253-
{
5254-
(void)global_schema_lock.lock();
5255-
}
5256-
#endif
5257-
52585242
/*
52595243
Open or obtain "X" MDL lock on the table being created.
52605244
To check the existence of table, lock of type "S" is obtained on the table
@@ -5505,13 +5489,6 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
55055489
uint not_used;
55065490
DBUG_ENTER("mysql_create_like_table");
55075491

5508-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
5509-
Ha_global_schema_lock_guard global_schema_lock(thd);
5510-
5511-
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
5512-
(void)global_schema_lock.lock();
5513-
#endif
5514-
55155492
/*
55165493
We the open source table to get its description in HA_CREATE_INFO
55175494
and Alter_info objects. This also acquires a shared metadata lock
@@ -8458,32 +8435,6 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name,
84588435
DBUG_RETURN(true);
84598436
}
84608437

8461-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
8462-
Ha_global_schema_lock_guard global_schema_lock_guard(thd);
8463-
if (ha_legacy_type(table->s->db_type()) == DB_TYPE_NDBCLUSTER ||
8464-
ha_legacy_type(create_info->db_type) == DB_TYPE_NDBCLUSTER)
8465-
{
8466-
// From or to engine is NDB
8467-
if (thd->locked_tables_mode)
8468-
{
8469-
/*
8470-
To avoid deadlock in this situation:
8471-
- if other thread has lock do not enter lock queue
8472-
and report an error instead
8473-
*/
8474-
if (global_schema_lock_guard.lock(true))
8475-
{
8476-
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
8477-
DBUG_RETURN(TRUE);
8478-
}
8479-
}
8480-
else
8481-
{
8482-
global_schema_lock_guard.lock();
8483-
}
8484-
}
8485-
#endif
8486-
84878438
Alter_table_ctx alter_ctx(thd, table_list, tables_opened, new_db, new_name);
84888439

84898440
/*

‎sql/sql_truncate.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,6 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
424424
bool binlog_stmt;
425425
DBUG_ENTER("Sql_cmd_truncate_table::truncate_table");
426426

427-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
428-
Ha_global_schema_lock_guard global_schema_lock_guard(thd);
429-
#endif
430427
DBUG_ASSERT((!table_ref->table) ||
431428
(table_ref->table && table_ref->table->s));
432429

@@ -470,10 +467,6 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
470467
}
471468
else /* It's not a temporary table. */
472469
{
473-
#ifndef MCP_GLOBAL_SCHEMA_LOCK
474-
global_schema_lock_guard.lock();
475-
#endif
476-
477470
bool hton_can_recreate;
478471

479472
if (lock_table(thd, table_ref, &hton_can_recreate))

0 commit comments

Comments
 (0)