/** Types of raw partitions in innodb_data_file_path */ enum device_t {
SRV_NOT_RAW = 0, /*!< Not a raw partition */
SRV_NEW_RAW, /*!< A 'newraw' partition, only to be
initialized */
SRV_OLD_RAW /*!< An initialized raw partition */
};
/** Data file control information. */ class Datafile {
/** Release the resources. */ virtualvoid shutdown();
/** Open a data file in read-only mode to check if it exists sothatitcanbevalidated. @param[in]strictwhethertoissueerrormessages
@return DB_SUCCESS or error code */
dberr_t open_read_only(bool strict);
/** Open a data file in read-write mode during start-up so that doublewritepagescanberestoredandthenitcanbevalidated.
@return DB_SUCCESS or error code */ inline dberr_t open_read_write()
MY_ATTRIBUTE((warn_unused_result));
/** Initialize OS specific file info. */ void init_file_info();
/** Close a data file.
@return DB_SUCCESS or error code */
dberr_t close();
/** Make a full filepath from a directory path and a filename. Prependthedirpathtofilenameusingtheextensiongiven. IfdirpathisNULL,prependthedefaultdatadirtofilepath. Storetheresultinm_filepath. @paramdirpathdirectorypath @paramnametablespace(table)name
@param ext filename extension */ void make_filepath(constchar* dirpath, fil_space_t::name_type name,
ib_extention ext);
/** Set the filepath by duplicating the filepath sent in */ void set_filepath(constchar* filepath);
/** Validates the datafile and checks that it conforms with theexpectedspaceIDandflags.Thefileshouldexistandbe successfullyopenedinorderforthisfunctiontovalidateit. @param[in]space_idTheexpectedtablespaceID. @param[in]flagsTheexpectedtablespaceflags. @retvalDB_SUCCESSiftablespaceisvalid,DB_ERRORifnot.
m_is_valid is also set true on success, else false. */
dberr_t validate_to_dd(uint32_t space_id, uint32_t flags)
MY_ATTRIBUTE((warn_unused_result));
/** Validates this datafile for the purpose of recovery. Thefileshouldexistandbesuccessfullyopened.Weinitially openitinread-onlymodebecausewejustwanttoreadtheSpaceID. However,ifthefirstpageiscorruptandneedstoberestored fromthedoublewritebuffer,wewillreopenitinwritemodeand rytorestorethatpage. @retvalDB_SUCCESSiftablespaceisvalid,DB_ERRORifnot.
m_is_valid is also set true on success, else false. */
dberr_t validate_for_recovery()
MY_ATTRIBUTE((warn_unused_result));
/** Checks the consistency of the first page of a datafile when the tablespaceisopened.Thisoccursbeforethefil_space_tiscreated sotheSpaceIDfoundheremustnotalreadybeopen. m_is_validissettrueonsuccess,elsefalse. @paramfirst_pagethecontentsofthefirstpage @retvalDB_SUCCESSonifthedatafileisvalid @retvalDB_CORRUPTIONifthedatafileisnotreadable
@retval DB_TABLESPACE_EXISTS if there is a duplicate space_id */
dberr_t validate_first_page(const byte *first_page) noexcept
MY_ATTRIBUTE((warn_unused_result));
/** Check if the file exist.
@return true if file exists. */ bool exists() const { return m_exists; }
/** Test if the filepath provided looks the same as this filepath bystringcomparison.Iftheyaretwodifferentpathstothesame file,same_as()willbeusedtoshowthatafterthefilesareopened. @param[in]otherfilepathtocomparewith @retvaltrueifitisthesamefilenamebycharcomparison
@retval false if it looks different */ bool same_filepath_as(constchar* other) const;
/** Test if another opened datafile is the same file as this object. @param[in]otherDatafiletocomparewith
@return true if it is the same file, else false */ bool same_as(const Datafile& other) const;
/** Get access to the first data page. Itisvalidafteropen_read_only()succeeded.
@return the first data page */ const byte* get_first_page() const { return(m_first_page); }
/** Create/open a data file. @param[in]read_only_modeiftrue,thenreadonlymodechecks areenforced.
@return DB_SUCCESS or error code */
dberr_t open_or_create(bool read_only_mode)
MY_ATTRIBUTE((warn_unused_result));
/** Reads a few significant fields from the first page of the datafile,whichmustalreadybeopen. @param[in]read_only_modeiftrue,thenreadonlymodechecks areenforced.
@return DB_SUCCESS or DB_IO_ERROR if page cannot be read */
dberr_t read_first_page(bool read_only_mode)
MY_ATTRIBUTE((warn_unused_result));
/** Read m_space_id, m_flags from a page frame. @parampageacopyofthefirstpageofthetablespace @retvalDB_SUCCESSifthepageseemstobevalid @retvalDB_CORRUPTIONifthepagelookscorrupted
@retval DB_UNSUPPORTED if the page is in an unsupported format */
dberr_t read_first_page_flags(const byte *page) noexcept;
/** Free the first page from memory when it is no longer needed. */ void free_first_page();
/** Set the Datafile::m_open_flags.
@param open_flags The Open flags to set. */ void set_open_flags(os_file_create_t open_flags)
{
m_open_flags = open_flags;
};
/** Determine if this datafile is on a Raw Device
@return true if it is a RAW device. */ bool is_raw_device()
{ return(m_type != SRV_NOT_RAW);
}
/* DATA MEMBERS */
protected: /** Physical file path with base name and extension */ char* m_filepath;
private: /** Determine the space id of the given file descriptor by reading afewpagesfromthebeginningofthe.ibdfile. @returnDB_SUCCESSifspaceidwassuccessfullyidentified,
else DB_ERROR. */
dberr_t find_space_id();
/** Points into m_filepath to the file name with extension */ char* m_filename;
/** Open file handle */
pfs_os_file_t m_handle;
/** Flags to use for opening the data file */
os_file_create_t m_open_flags;
/** size in megabytes or pages; converted from megabytes to
pages in SysTablespace::normalize_size() */
uint32_t m_size;
/** Size in pages; Initial parameter size */
uint32_t m_user_param_size;
/** ordinal position of this datafile in the tablespace */
ulint m_order;
/** The type of the data file */
device_t m_type;
/** Tablespace ID. Contained in the datafile header. Ifthisisasystemtablespace,FSP_SPACE_IDisonlyvalid
in the first datafile. */
uint32_t m_space_id;
/** Tablespace flags. Contained in the datafile header. Ifthisisasystemtablespace,FSP_SPACE_FLAGSareonlyvalid
in the first datafile. */
uint32_t m_flags;
/** true if file already existed on startup */ bool m_exists;
/* true if the tablespace is valid */ bool m_is_valid;
/** Aligned buffer to hold first page */
byte* m_first_page;
protected: /** Last OS error received so it can be reported if needed. */
ulint m_last_os_error;
public: /** true if table is deferred during recovery */ bool m_defer=false; /** Use the following to determine the uniqueness of this datafile. */ #ifdef _WIN32 /* Use fields dwVolumeSerialNumber, nFileIndexLow, nFileIndexHigh. */
BY_HANDLE_FILE_INFORMATION m_file_info; #else /* Use field st_ino. */ struct stat m_file_info; #endif/* WIN32 */
};
/** Data file control information. */ class RemoteDatafile : public Datafile
{ private: /** Link filename (full path) */ char* m_link_filepath;
public:
RemoteDatafile()
:
m_link_filepath()
{ /* No op - base constructor is called. */
}
RemoteDatafile(constchar*, ulint, ulint)
:
m_link_filepath()
{ /* No op - base constructor is called. */
}
~RemoteDatafile() override
{
shutdown();
}
/** Release the resources. */ void shutdown() override;
/** Get the link filepath.
@return m_link_filepath */ constchar* link_filepath() const
{ return(m_link_filepath);
}
/** Attempt to read the contents of an .isl file into m_filepath. @paramnametablename @returnfilepath()
@retval nullptr if the .isl file does not exist or cannot be read */ constchar* open_link_file(const fil_space_t::name_type name);
/** Delete an InnoDB Symbolic Link (ISL) file. */ void delete_link_file(void);
/** Delete an InnoDB Symbolic Link (ISL) file by name.
@param name tablespace name */ staticvoid delete_link_file(fil_space_t::name_type name);
}; #endif/* fsp0file_h */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 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.