/** Check if two tablespaces have common data file names. @paramother_spaceTablespacetocheckagainstthis.
@return true if they have the same data filenames and paths */ bool
Tablespace::intersection( const Tablespace* other_space)
{ for (files_t::const_iterator it(other_space->begin()),
end(other_space->end()); it != end; ++it) {
if (find(it->m_filename)) {
return(true);
}
}
return(false);
}
/** Frees the memory allocated by the SysTablespace object. */ void
Tablespace::shutdown()
{ for (iterator it = begin(); it != end(); ++it) {
it->shutdown();
}
/** Note that the data file was found.
@param[in,out] file Data file object to set */ void
Tablespace::file_found(Datafile& file)
{ /* Note that the file exists and can be opened
in the appropriate mode. */
file.m_exists = true;
/** Open or Create the data files if they do not exist. @param[in]is_tempwhetherthisisatemporarytablespace
@return DB_SUCCESS or error code */
dberr_t
Tablespace::open_or_create(bool is_temp)
{
fil_space_t* space = NULL;
dberr_t err = DB_SUCCESS;
ut_ad(!m_files.empty());
for (iterator it = begin(); it != end(); ++it) { if (it->m_exists) {
err = it->open_or_create(
m_ignore_read_only
? false : srv_read_only_mode); if (err != DB_SUCCESS) { return err;
}
} else {
err = it->open_or_create(
m_ignore_read_only
? false : srv_read_only_mode);
if (err != DB_SUCCESS) { return err;
}
/* Set the correct open flags now that we have
successfully created the file. */
file_found(*it);
}
/* We can close the handle now and open the tablespace
the proper way. */
it->close();
mysql_mutex_lock(&fil_system.mutex);
if (it == begin()) { /* First data file. */
/* Create the tablespace entry for the multi-file
tablespace in the tablespace manager. */
uint32_t fsp_flags;
switch (srv_checksum_algorithm) { case SRV_CHECKSUM_ALGORITHM_FULL_CRC32: case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32:
fsp_flags = (FSP_FLAGS_FCRC32_MASK_MARKER
| FSP_FLAGS_FCRC32_PAGE_SSIZE()); break; default:
fsp_flags = FSP_FLAGS_PAGE_SSIZE();
}
/** Find a filename in the list of Datafiles for a tablespace
@return true if the filename exists in the data files */ bool
Tablespace::find(constchar* filename) const
{ const Lex_ident_column filename_ident = Lex_cstring_strlen(filename); for (const_iterator it = begin(); it != end(); ++it) {
if (filename_ident.streq(Lex_cstring_strlen(it->m_filename))) { return(true);
}
}
return(false);
}
/** Delete all the data files. */ void
Tablespace::delete_files()
{ for (iterator it = begin(); it != end(); ++it) {
/** Use the ADD DATAFILE path to create a Datafile object and add it to the frontofm_files. Parsethedatafilepathintoapathandafilenamewithextension'ibd'. Thisdatafile_pathprovidedmayormaynotbeanabsolutepath,butit mustendwiththeextension.ibdandhaveabasenameofatleast1byte.
Settablespacem_pathmemberandaddaDatafilewiththefilename.
@param[in] datafile_path full path of the tablespace file. */
dberr_t Tablespace::add_datafile(constchar *filepath)
{ /* The path provided ends in ".ibd". This was assured by
validate_create_tablespace_info() */
ut_d(constchar* dot = strrchr(filepath, '.'));
ut_ad(dot != NULL && 0 == strcmp(dot, DOT_IBD));
/* If the path is an absolute path, separate it onto m_path and a basename.Forrelativepaths,makethewholethingabasenamesothat
it can be appended to the datadir. */ bool is_abs_path = is_absolute_path(filepath);
size_t dirlen = (is_abs_path ? dirname_length(filepath) : 0); constchar* basename = filepath + dirlen;
/* If the pathname contains a directory separator, fill the m_pathmemberwhichisthedefaultdirectoryforfilesinthis
tablespace. Leave it null otherwise. */ if (dirlen > 0) {
set_path(filepath, dirlen);
}
/* Now add a new Datafile and set the filepath
using the m_path created above. */
m_files.push_back(Datafile(m_flags, FIL_IBD_FILE_INITIAL_SIZE, 0));
m_files.back().make_filepath(m_path, {basename, strlen(basename) - 4},
IBD);
return(DB_SUCCESS);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.27 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.