Commit 03a3d076 authored by vasil's avatar vasil

branches/zip:

 
Fix Mantis issue#34 https://svn.innodb.com/mantis/view.php?id=34
"I_S plugins should refuse to load if the storage engine plugin is not loaded"
and MySQL Bug#36310 http://bugs.mysql.com/36310
"InnoDB plugin crash"

* Make srv_was_started public
* Set srv_was_started at the end of innobase_start_or_create_for_mysql()
  so it is not set to TRUE if innodb encounters some startup error
* Refuse to start any of the I_S plugins if srv_was_started is not TRUE

Approved by:	Heikki
parent a5b8b883
......@@ -23,6 +23,7 @@ extern "C" {
#include "buf0buddy.h" /* for i_s_cmpmem */
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */
#include "ha_prototypes.h" /* for innobase_convert_name() */
#include "srv0start.h" /* for srv_was_started */
}
static const char plugin_author[] = "Innobase Oy";
......@@ -32,6 +33,17 @@ static const char plugin_author[] = "Innobase Oy";
DBUG_RETURN(1); \
}
#define FAIL_IF_INNODB_NOT_STARTED(plugin_name) \
do { \
if (!srv_was_started) { \
sql_print_error("InnoDB: Refusing to start the "\
plugin_name " plugin when the " \
"InnoDB storage engine plugin " \
"is not started."); \
DBUG_RETURN(1); \
} \
} while (0)
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
#define STRUCT_FLD(name, value) name: value
#else
......@@ -360,6 +372,8 @@ innodb_trx_init(
DBUG_ENTER("innodb_trx_init");
FAIL_IF_INNODB_NOT_STARTED("INNODB_TRX");
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_trx_fields_info;
......@@ -640,6 +654,8 @@ innodb_locks_init(
DBUG_ENTER("innodb_locks_init");
FAIL_IF_INNODB_NOT_STARTED("INNODB_LOCKS");
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_locks_fields_info;
......@@ -823,6 +839,8 @@ innodb_lock_waits_init(
DBUG_ENTER("innodb_lock_waits_init");
FAIL_IF_INNODB_NOT_STARTED("INNODB_LOCK_WAITS");
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_lock_waits_fields_info;
......@@ -1135,6 +1153,8 @@ i_s_cmp_init(
DBUG_ENTER("i_s_cmp_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
FAIL_IF_INNODB_NOT_STARTED("INNODB_CMP");
schema->fields_info = i_s_cmp_fields_info;
schema->fill_table = i_s_cmp_fill;
......@@ -1153,6 +1173,8 @@ i_s_cmp_reset_init(
DBUG_ENTER("i_s_cmp_reset_init");
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->fill_table = i_s_cmp_reset_fill;
......@@ -1399,6 +1421,8 @@ i_s_cmpmem_init(
DBUG_ENTER("i_s_cmpmem_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
FAIL_IF_INNODB_NOT_STARTED("INNODB_CMPMEM");
schema->fields_info = i_s_cmpmem_fields_info;
schema->fill_table = i_s_cmpmem_fill;
......@@ -1417,6 +1441,8 @@ i_s_cmpmem_reset_init(
DBUG_ENTER("i_s_cmpmem_reset_init");
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->fill_table = i_s_cmpmem_reset_fill;
......
......@@ -91,6 +91,7 @@ extern ibool srv_have_fullfsync;
#endif
extern ibool srv_is_being_started;
extern ibool srv_was_started;
extern ibool srv_startup_is_before_trx_rollback_phase;
extern ibool srv_is_being_shut_down;
......
......@@ -70,9 +70,9 @@ UNIV_INTERN ibool srv_start_raw_disk_in_use = FALSE;
UNIV_INTERN ibool srv_startup_is_before_trx_rollback_phase = FALSE;
UNIV_INTERN ibool srv_is_being_started = FALSE;
UNIV_INTERN ibool srv_was_started = FALSE;
#ifndef UNIV_HOTBACKUP
static ibool srv_start_has_been_called = FALSE;
static ibool srv_was_started = FALSE;
#endif /* !UNIV_HOTBACKUP */
/* At a shutdown the value first climbs to SRV_SHUTDOWN_CLEANUP
......@@ -1550,7 +1550,6 @@ innobase_start_or_create_for_mysql(void)
/* Create the thread which warns of long semaphore waits */
os_thread_create(&srv_error_monitor_thread, NULL,
thread_ids + 3 + SRV_MAX_N_IO_THREADS);
srv_was_started = TRUE;
srv_is_being_started = FALSE;
if (trx_doublewrite == NULL) {
......@@ -1736,6 +1735,8 @@ innobase_start_or_create_for_mysql(void)
srv_file_per_table = srv_file_per_table_original_value;
srv_was_started = TRUE;
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