Skip to content

Commit

Permalink
Remove MYSQL_TABLESPACES.
Browse files Browse the repository at this point in the history
MySQL 5.7 introduced partial support for user-created shared tablespaces
(for example, import and export are not supported).

MariaDB Server does not support tablespaces at this point of time.
Let us remove most InnoDB code and data structures that is related
to shared tablespaces.
  • Loading branch information
dr-m committed Jan 18, 2017
1 parent 1eabad5 commit 494e4b9
Show file tree
Hide file tree
Showing 36 changed files with 182 additions and 2,155 deletions.
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb/r/innodb-alter-discard.result
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ call mtr.add_suppression("InnoDB: Operating system error number .* in a file ope
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: './test/t.ibd' OS error: .*");
call mtr.add_suppression("InnoDB: Ignoring tablespace `test/t` because it could not be opened.");
call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`.`t` because it could not be opened.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .*");
call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb/t/innodb-alter-discard.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ call mtr.add_suppression("InnoDB: Operating system error number .* in a file ope
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: './test/t.ibd' OS error: .*");
call mtr.add_suppression("InnoDB: Ignoring tablespace `test/t` because it could not be opened.");
call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`.`t` because it could not be opened.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .*");
call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/btr/btr0btr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ btr_root_adjust_on_import(
ulint flags = dict_tf_to_fsp_flags(
table->flags, false);
ulint fsp_flags = fil_space_get_flags(table->space);
err = fsp_flags_are_equal(flags, fsp_flags)
err = flags == fsp_flags
? DB_SUCCESS : DB_CORRUPTION;
}
} else {
Expand Down
79 changes: 1 addition & 78 deletions storage/innobase/dict/dict0crea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,75 +377,6 @@ dict_build_table_def_step(
return(err);
}

/** Build a tablespace to store various objects.
@param[in,out] tablespace Tablespace object describing what to build.
@return DB_SUCCESS or error code. */
dberr_t
dict_build_tablespace(
Tablespace* tablespace)
{
dberr_t err = DB_SUCCESS;
mtr_t mtr;
ulint space = 0;

ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(tablespace);

DBUG_EXECUTE_IF("out_of_tablespace_disk",
return(DB_OUT_OF_FILE_SPACE););
/* Get a new space id. */
dict_hdr_get_new_id(NULL, NULL, &space, NULL, false);
if (space == ULINT_UNDEFINED) {
return(DB_ERROR);
}
tablespace->set_space_id(space);

Datafile* datafile = tablespace->first_datafile();

/* We create a new generic empty tablespace.
We initially let it be 4 pages:
- page 0 is the fsp header and an extent descriptor page,
- page 1 is an ibuf bitmap page,
- page 2 is the first inode page,
- page 3 will contain the root of the clustered index of the
first table we create here. */

err = fil_ibd_create(
space,
tablespace->name(),
datafile->filepath(),
tablespace->flags(),
FIL_IBD_FILE_INITIAL_SIZE,
tablespace->encryption_mode(),
tablespace->key_id());

if (err != DB_SUCCESS) {
return(err);
}

/* Update SYS_TABLESPACES and SYS_DATAFILES */
err = dict_replace_tablespace_and_filepath(
tablespace->space_id(), tablespace->name(),
datafile->filepath(), tablespace->flags());
if (err != DB_SUCCESS) {
os_file_delete(innodb_data_file_key, datafile->filepath());
return(err);
}

mtr_start(&mtr);
mtr.set_named_space(space);

/* Once we allow temporary general tablespaces, we must do this;
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); */
ut_a(!FSP_FLAGS_GET_TEMPORARY(tablespace->flags()));

fsp_header_init(space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);

mtr_commit(&mtr);

return(err);
}

/** Builds a tablespace to contain a table, using file-per-table=1.
@param[in,out] table Table to build in its own tablespace.
@param[in] node Table create node
Expand Down Expand Up @@ -554,15 +485,7 @@ dict_build_tablespace_for_table(
return(DB_ERROR);
}
} else {
/* We do not need to build a tablespace for this table. It
is already built. Just find the correct tablespace ID. */

if (DICT_TF_HAS_SHARED_SPACE(table->flags)) {
ut_ad(table->tablespace != NULL);

ut_ad(table->space == fil_space_get_id_by_name(
table->tablespace()));
} else if (dict_table_is_temporary(table)) {
if (dict_table_is_temporary(table)) {
/* Use the shared temporary tablespace.
Note: The temp tablespace supports all non-Compressed
row formats whereas the system tablespace only
Expand Down
8 changes: 0 additions & 8 deletions storage/innobase/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7268,22 +7268,14 @@ dict_tf_to_fsp_flags(
DICT_TF_HAS_ATOMIC_BLOBS(table_flags);
page_size_t page_size = dict_tf_get_page_size(table_flags);
bool has_data_dir = DICT_TF_HAS_DATA_DIR(table_flags);
bool is_shared = DICT_TF_HAS_SHARED_SPACE(table_flags);
bool page_compression = DICT_TF_GET_PAGE_COMPRESSION(table_flags);
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(table_flags);

ut_ad(!page_size.is_compressed() || has_atomic_blobs);

/* General tablespaces that are not compressed do not get the
flags for dynamic row format (POST_ANTELOPE & ATOMIC_BLOBS) */
if (is_shared && !page_size.is_compressed()) {
has_atomic_blobs = false;
}

ulint fsp_flags = fsp_flags_init(page_size,
has_atomic_blobs,
has_data_dir,
is_shared,
is_temp,
0,
0,
Expand Down

0 comments on commit 494e4b9

Please sign in to comment.