167
167
static plugin::XaStorageEngine* innodb_engine_ptr= NULL;
168
168
static plugin::TableFunction* status_table_function_ptr= NULL;
169
static plugin::TableFunction* cmp_tool= NULL;
170
static plugin::TableFunction* cmp_reset_tool= NULL;
171
static plugin::TableFunction* cmp_mem_tool= NULL;
172
static plugin::TableFunction* cmp_mem_reset_tool= NULL;
173
static plugin::TableFunction* innodb_trx_tool= NULL;
174
static plugin::TableFunction* innodb_locks_tool= NULL;
175
static plugin::TableFunction* innodb_lock_waits_tool= NULL;
170
177
static const long AUTOINC_OLD_STYLE_LOCKING = 0;
171
178
static const long AUTOINC_NEW_STYLE_LOCKING = 1;
339
346
/*********************************************************************
340
347
Removes all tables in the named database inside InnoDB. */
344
350
/*===================*/
345
351
/* out: error number */
346
char* path); /* in: database path; inside InnoDB the name
352
const std::string &schema_name); /* in: database path; inside InnoDB the name
347
353
of the last directory in the path is used as
348
354
the database name: for example, in 'mysql/data/test'
349
355
the database name is 'test' */
1947
1953
pthread_cond_init(&commit_cond, NULL);
1948
1954
innodb_inited= 1;
1951
if (innodb_locks_init() ||
1952
innodb_trx_init() ||
1953
innodb_lock_waits_init() ||
1955
i_s_cmp_reset_init() ||
1956
i_s_cmpmem_init() ||
1957
i_s_cmpmem_reset_init())
1961
1956
status_table_function_ptr= new InnodbStatusTool;
1963
1958
registry.add(innodb_engine_ptr);
1965
1960
registry.add(status_table_function_ptr);
1968
registry.add(innodb_trx_schema_table);
1969
registry.add(innodb_locks_schema_table);
1970
registry.add(innodb_lock_waits_schema_table);
1971
registry.add(innodb_cmp_schema_table);
1972
registry.add(innodb_cmp_reset_schema_table);
1973
registry.add(innodb_cmpmem_schema_table);
1974
registry.add(innodb_cmpmem_reset_schema_table);
1962
cmp_tool= new(std::nothrow)CmpTool(false);
1963
registry.add(cmp_tool);
1965
cmp_reset_tool= new(std::nothrow)CmpTool(true);
1966
registry.add(cmp_reset_tool);
1968
cmp_mem_tool= new(std::nothrow)CmpmemTool(false);
1969
registry.add(cmp_mem_tool);
1971
cmp_mem_reset_tool= new(std::nothrow)CmpmemTool(true);
1972
registry.add(cmp_mem_reset_tool);
1974
innodb_trx_tool= new(std::nothrow)InnodbTrxTool("INNODB_TRX");
1975
registry.add(innodb_trx_tool);
1977
innodb_locks_tool= new(std::nothrow)InnodbTrxTool("INNODB_LOCKS");
1978
registry.add(innodb_locks_tool);
1980
innodb_lock_waits_tool= new(std::nothrow)InnodbTrxTool("INNODB_LOCK_WAITS");
1981
registry.add(innodb_lock_waits_tool);
1977
1983
/* Get the current high water mark format. */
1978
1984
innobase_file_format_check = (char*) trx_sys_file_format_max_get();
1990
1996
innobase_deinit(plugin::Registry ®istry)
1994
i_s_common_deinit(registry);
1997
2000
registry.remove(status_table_function_ptr);
1998
2001
delete status_table_function_ptr;
2003
registry.remove(cmp_tool);
2006
registry.remove(cmp_reset_tool);
2007
delete cmp_reset_tool;
2009
registry.remove(cmp_mem_tool);
2010
delete cmp_mem_tool;
2012
registry.remove(cmp_mem_reset_tool);
2013
delete cmp_mem_reset_tool;
2015
registry.remove(innodb_trx_tool);
2016
delete innodb_trx_tool;
2018
registry.remove(innodb_locks_tool);
2019
delete innodb_locks_tool;
2021
registry.remove(innodb_lock_waits_tool);
2022
delete innodb_lock_waits_tool;
2000
2024
registry.remove(innodb_engine_ptr);
2001
2025
delete innodb_engine_ptr;
5970
5994
/*****************************************************************//**
5971
5995
Removes all tables in the named database inside InnoDB. */
5973
InnobaseEngine::drop_database(
5997
InnobaseEngine::doDropSchema(
5974
5998
/*===================*/
5975
char* path) /*!< in: database path; inside InnoDB the name
5999
const std::string &schema_name)
6000
/*!< in: database path; inside InnoDB the name
5976
6001
of the last directory in the path is used as
5977
6002
the database name: for example, in 'mysql/data/test'
5978
6003
the database name is 'test' */
6007
string schema_path(schema_name);
5985
6008
Session* session = current_session;
5987
6010
/* Get the transaction associated with the current session, or create one
6000
6023
trx_search_latch_release_if_reserved(parent_trx);
6003
ptr = strchr(path, '\0') - 2;
6005
while (ptr >= path && *ptr != '\\' && *ptr != '/') {
6011
namebuf = (char*) malloc((uint) len + 2);
6013
memcpy(namebuf, ptr, len);
6015
namebuf[len + 1] = '\0';
6017
innobase_casedn_str(namebuf);
6019
#if defined __WIN__ && !defined MYSQL_SERVER
6020
/* In the Windows plugin, thd = current_thd is always NULL */
6021
trx = trx_allocate_for_mysql();
6022
trx->mysql_thd = NULL;
6023
trx->mysql_query_str = NULL;
6026
schema_path.append("/");
6025
6027
trx = innobase_trx_allocate(session);
6027
error = row_drop_database_for_mysql(namebuf, trx);
6028
error = row_drop_database_for_mysql(schema_path.c_str(), trx);
6030
6030
/* Flush the log to reduce probability that the .frm files and
6031
6031
the InnoDB data dictionary get out-of-sync if the user runs