Commit 8dafbcef authored by marko's avatar marko

branches/zip: Pass the tablespace flags correctly when creating or opening

single-table tablespaces.  This bug was reported by Sunny as Mantis issue #26.

fil_space_create(), fil_create_new_single_table_tablespace(),
fil_open_single_table_tablespace(), fsp_header_init_fields():
Add ut_a(flags != DICT_TF_COMPACT).

dict_build_table_def_step(), row_import_tablespace_for_mysql(),
row_truncate_table_for_mysql(): Pass correct flags to
fil_create_new_single_table_tablespace() or fil_open_single_table_tablespace().
parent 09b38fab
......@@ -263,7 +263,7 @@ dict_build_table_def_step(
error = fil_create_new_single_table_tablespace(
&space, path_or_name, is_path,
table->flags,
table->flags == DICT_TF_COMPACT ? 0 : table->flags,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = (unsigned int) space;
......
......@@ -1079,6 +1079,13 @@ fil_space_create(
{
fil_system_t* system = fil_system;
fil_space_t* space;
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
format, the tablespace flags should equal table->flags. */
ut_a(flags != DICT_TF_COMPACT);
try_again:
/*printf(
"InnoDB: Adding tablespace %lu of name %s, purpose %lu\n", id, name,
......@@ -2606,8 +2613,7 @@ fil_create_new_single_table_tablespace(
table */
ibool is_temp, /* in: TRUE if a table created with
CREATE TEMPORARY TABLE */
ulint flags, /* in: compressed page size and
file format version, or 0 */
ulint flags, /* in: tablespace flags */
ulint size) /* in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
......@@ -2621,6 +2627,11 @@ fil_create_new_single_table_tablespace(
char* path;
ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
format, the tablespace flags should equal table->flags. */
ut_a(flags != DICT_TF_COMPACT);
path = fil_make_ibd_name(tablename, is_temp);
......@@ -2988,6 +2999,12 @@ fil_open_single_table_tablespace(
filepath = fil_make_ibd_name(name, FALSE);
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
format, the tablespace flags should equal table->flags. */
ut_a(flags != DICT_TF_COMPACT);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
......
......@@ -909,9 +909,15 @@ fsp_header_init_fields(
/*===================*/
page_t* page, /* in/out: first page in the space */
ulint space_id, /* in: space id */
ulint flags) /* in: compressed page size and
file format version, or 0 */
ulint flags) /* in: tablespace flags (FSP_SPACE_FLAGS):
0, or table->flags if newer than COMPACT */
{
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
format, the tablespace flags should equal table->flags. */
ut_a(flags != DICT_TF_COMPACT);
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page,
space_id);
mach_write_to_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page,
......
......@@ -422,8 +422,7 @@ fil_create_new_single_table_tablespace(
table */
ibool is_temp, /* in: TRUE if a table created with
CREATE TEMPORARY TABLE */
ulint flags, /* in: compressed page size and
file format version, or 0 */
ulint flags, /* in: tablespace flags */
ulint size); /* in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
......
......@@ -108,8 +108,8 @@ fsp_header_init_fields(
/*===================*/
page_t* page, /* in/out: first page in the space */
ulint space_id, /* in: space id */
ulint flags); /* in: compressed page size and
file format version, or 0 */
ulint flags); /* in: tablespace flags (FSP_SPACE_FLAGS):
0, or table->flags if newer than COMPACT */
/**************************************************************************
Initializes the space header of a new created space and creates also the
insert buffer tree root if space == 0. */
......
......@@ -2558,8 +2558,10 @@ row_import_tablespace_for_mysql(
ibuf_delete_for_discarded_space(table->space);
success = fil_open_single_table_tablespace(TRUE, table->space,
table->flags, table->name);
success = fil_open_single_table_tablespace(
TRUE, table->space,
table->flags == DICT_TF_COMPACT ? 0 : table->flags,
table->name);
if (success) {
table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE;
......@@ -2741,9 +2743,9 @@ row_truncate_table_for_mysql(
if (table->space && !table->dir_path_of_temp_table) {
/* Discard and create the single-table tablespace. */
ulint space = table->space;
ulint zip_size= fil_space_get_zip_size(space);
ulint flags = fil_space_get_flags(space);
if (zip_size != ULINT_UNDEFINED
if (flags != ULINT_UNDEFINED
&& fil_discard_tablespace(space)) {
dict_index_t* index;
......@@ -2751,7 +2753,7 @@ row_truncate_table_for_mysql(
space = 0;
if (fil_create_new_single_table_tablespace(
&space, table->name, FALSE, zip_size,
&space, table->name, FALSE, flags,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_print_timestamp(stderr);
fprintf(stderr,
......
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