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