Commit 2daf8121 authored by vasil's avatar vasil

branches/zip:

 
Allow InnoDB I_S plugins to be installed when InnoDB storage engine is
not installed but show empty tables when SELECTing from them in this
case. Set srv_was_started to FALSE at the end of
innobase_shutdown_for_mysql() so the I_S plugins can detect if InnoDB is
uninstalled.
 
This is needed to workaround the MySQL
Bug#36399 Double free bug when INFORMATION_SCHEMA plugin init function fails
and is more flexible as it allows I_S plugins to be installed before the
InnoDB plugin and detects if the latter is uninstalled after this.

Approved by:	Heikki
parent 2a1e67ff
...@@ -33,15 +33,17 @@ static const char plugin_author[] = "Innobase Oy"; ...@@ -33,15 +33,17 @@ static const char plugin_author[] = "Innobase Oy";
DBUG_RETURN(1); \ DBUG_RETURN(1); \
} }
#define FAIL_IF_INNODB_NOT_STARTED(plugin_name) \ #define RETURN_IF_INNODB_NOT_STARTED(plugin_name) \
do { \ do { \
if (!srv_was_started) { \ if (!srv_was_started) { \
sql_print_error("InnoDB: Cannot install the " \ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, \
plugin_name " plugin because " \ ER_CANT_FIND_SYSTEM_REC, \
"the InnoDB storage engine is " \ "InnoDB: SELECTing from " \
"not installed."); \ "INFORMATION_SCHEMA.%s but " \
DBUG_RETURN(1); \ "the InnoDB storage engine " \
} \ "is not installed", plugin_name); \
DBUG_RETURN(0); \
} \
} while (0) } while (0)
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER #if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
...@@ -372,8 +374,6 @@ innodb_trx_init( ...@@ -372,8 +374,6 @@ innodb_trx_init(
DBUG_ENTER("innodb_trx_init"); DBUG_ENTER("innodb_trx_init");
FAIL_IF_INNODB_NOT_STARTED("INNODB_TRX");
schema = (ST_SCHEMA_TABLE*) p; schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_trx_fields_info; schema->fields_info = innodb_trx_fields_info;
...@@ -654,8 +654,6 @@ innodb_locks_init( ...@@ -654,8 +654,6 @@ innodb_locks_init(
DBUG_ENTER("innodb_locks_init"); DBUG_ENTER("innodb_locks_init");
FAIL_IF_INNODB_NOT_STARTED("INNODB_LOCKS");
schema = (ST_SCHEMA_TABLE*) p; schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_locks_fields_info; schema->fields_info = innodb_locks_fields_info;
...@@ -839,8 +837,6 @@ innodb_lock_waits_init( ...@@ -839,8 +837,6 @@ innodb_lock_waits_init(
DBUG_ENTER("innodb_lock_waits_init"); DBUG_ENTER("innodb_lock_waits_init");
FAIL_IF_INNODB_NOT_STARTED("INNODB_LOCK_WAITS");
schema = (ST_SCHEMA_TABLE*) p; schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_lock_waits_fields_info; schema->fields_info = innodb_lock_waits_fields_info;
...@@ -932,6 +928,8 @@ trx_i_s_common_fill_table( ...@@ -932,6 +928,8 @@ trx_i_s_common_fill_table(
table_name = tables->schema_table_name; table_name = tables->schema_table_name;
/* or table_name = tables->schema_table->table_name; */ /* or table_name = tables->schema_table->table_name; */
RETURN_IF_INNODB_NOT_STARTED(table_name);
/* update the cache */ /* update the cache */
trx_i_s_cache_start_write(cache); trx_i_s_cache_start_write(cache);
trx_i_s_possibly_fetch_data_into_cache(cache); trx_i_s_possibly_fetch_data_into_cache(cache);
...@@ -1081,6 +1079,8 @@ i_s_cmp_fill_low( ...@@ -1081,6 +1079,8 @@ i_s_cmp_fill_low(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) { for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) {
page_zip_stat_t* zip_stat = &page_zip_stat[i]; page_zip_stat_t* zip_stat = &page_zip_stat[i];
...@@ -1153,8 +1153,6 @@ i_s_cmp_init( ...@@ -1153,8 +1153,6 @@ i_s_cmp_init(
DBUG_ENTER("i_s_cmp_init"); DBUG_ENTER("i_s_cmp_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
FAIL_IF_INNODB_NOT_STARTED("INNODB_CMP");
schema->fields_info = i_s_cmp_fields_info; schema->fields_info = i_s_cmp_fields_info;
schema->fill_table = i_s_cmp_fill; schema->fill_table = i_s_cmp_fill;
...@@ -1173,8 +1171,6 @@ i_s_cmp_reset_init( ...@@ -1173,8 +1171,6 @@ i_s_cmp_reset_init(
DBUG_ENTER("i_s_cmp_reset_init"); DBUG_ENTER("i_s_cmp_reset_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
FAIL_IF_INNODB_NOT_STARTED("INNODB_CMP_RESET");
schema->fields_info = i_s_cmp_fields_info; schema->fields_info = i_s_cmp_fields_info;
schema->fill_table = i_s_cmp_reset_fill; schema->fill_table = i_s_cmp_reset_fill;
...@@ -1351,6 +1347,8 @@ i_s_cmpmem_fill_low( ...@@ -1351,6 +1347,8 @@ i_s_cmpmem_fill_low(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
buf_pool_mutex_enter(); buf_pool_mutex_enter();
for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) { for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
...@@ -1421,8 +1419,6 @@ i_s_cmpmem_init( ...@@ -1421,8 +1419,6 @@ i_s_cmpmem_init(
DBUG_ENTER("i_s_cmpmem_init"); DBUG_ENTER("i_s_cmpmem_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
FAIL_IF_INNODB_NOT_STARTED("INNODB_CMPMEM");
schema->fields_info = i_s_cmpmem_fields_info; schema->fields_info = i_s_cmpmem_fields_info;
schema->fill_table = i_s_cmpmem_fill; schema->fill_table = i_s_cmpmem_fill;
...@@ -1441,8 +1437,6 @@ i_s_cmpmem_reset_init( ...@@ -1441,8 +1437,6 @@ i_s_cmpmem_reset_init(
DBUG_ENTER("i_s_cmpmem_reset_init"); DBUG_ENTER("i_s_cmpmem_reset_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
FAIL_IF_INNODB_NOT_STARTED("INNODB_CMPMEM_RESET");
schema->fields_info = i_s_cmpmem_fields_info; schema->fields_info = i_s_cmpmem_fields_info;
schema->fill_table = i_s_cmpmem_reset_fill; schema->fill_table = i_s_cmpmem_reset_fill;
......
...@@ -1930,6 +1930,8 @@ innobase_shutdown_for_mysql(void) ...@@ -1930,6 +1930,8 @@ innobase_shutdown_for_mysql(void)
srv_shutdown_lsn); srv_shutdown_lsn);
} }
srv_was_started = FALSE;
return((int) DB_SUCCESS); return((int) DB_SUCCESS);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment