Commit e5f47441 authored by marko's avatar marko

branches/zip: Try to prevent the reuse of tablespace identifiers after

InnoDB has crashed during table creation.  Also, refuse to start if
files with duplicate tablespace identifiers are encountered.

fil_node_create(): Update fil_system->max_assigned_id.  This should
prevent the reuse of a space->id when InnoDB does a full crash
recovery and invokes fil_load_single_table_tablespaces().  Normally,
fil_system->max_assigned_id is initialized from
SELECT MAX(ID) FROM SYS_TABLES.

fil_open_single_table_tablespace(): Return FALSE when
fil_space_create() fails.

fil_load_single_table_tablespace(): Exit if fil_space_create() fails
and innodb_force_recovery=0.

rb://173 approved by Heikki Tuuri.  This addresses Issue #335.
parent 91cf5f39
2009-09-28 The InnoDB Team
* fil/fil0fil.c:
Try to prevent the reuse of tablespace identifiers after InnoDB
has crashed during table creation. Also, refuse to start if files
with duplicate tablespace identifiers are encountered.
2009-09-25 The InnoDB Team
* include/os0file.h, os/os0file.c:
......
......@@ -594,6 +594,11 @@ fil_node_create(
UT_LIST_ADD_LAST(chain, space->chain, node);
if (id < SRV_LOG_SPACE_FIRST_ID && fil_system->max_assigned_id < id) {
fil_system->max_assigned_id = id;
}
mutex_exit(&fil_system->mutex);
}
......@@ -2926,7 +2931,6 @@ fil_open_single_table_tablespace(
byte* page;
ulint space_id;
ulint space_flags;
ibool ret = TRUE;
filepath = fil_make_ibd_name(name, FALSE);
......@@ -3004,7 +3008,7 @@ fil_open_single_table_tablespace(
(ulong) space_id, (ulong) space_flags,
(ulong) id, (ulong) flags);
ret = FALSE;
success = FALSE;
goto func_exit;
}
......@@ -3024,7 +3028,7 @@ func_exit:
os_file_close(file);
mem_free(filepath);
return(ret);
return(success);
}
#endif /* !UNIV_HOTBACKUP */
......@@ -3302,9 +3306,19 @@ fil_load_single_table_tablespace(
if (!success) {
if (srv_force_recovery > 0) {
fprintf(stderr,
"InnoDB: innodb_force_recovery"
" was set to %lu. Continuing crash recovery\n"
"InnoDB: even though the tablespace creation"
" of this table failed.\n",
srv_force_recovery);
goto func_exit;
}
exit(1);
}
/* We do not use the size information we have about the file, because
the rounding formula for extents and pages is somewhat complex; we
let fil_node_open() do that task. */
......
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