mirror of
https://github.com/MariaDB/server.git
synced 2025-11-09 23:36:13 +01:00
A consistency check for fil_space_t::name is causing recovery failures
in MDEV-25180 (Atomic ALTER TABLE). So, we'd better remove that field
altogether.
fil_space_t::name was more or less a copy of dict_table_t::name
(except for some special cases), and it was not being used for
anything useful.
There used to be a name_hash, but it had been removed already in
commit a75dbfd718 (MDEV-12266).
We will also remove os_normalize_path(), OS_PATH_SEPARATOR,
OS_PATH_SEPATOR_ALT. On Microsoft Windows, we will treat \ and /
roughly in the same way. The intention is that for per-table
tablespaces, the filenames will always follow the pattern
prefix/databasename/tablename.ibd. (Any \ in the prefix must not
be converted.)
ut_basename_noext(): Remove (unused function).
read_link_file(): Replaces RemoteDatafile::read_link_file().
We will ensure that the last two path component separators are
forward slashes (converting up to 2 trailing backslashes on
Microsoft Windows), so that everywhere else we can
assume that data file names end in "/databasename/tablename.ibd".
Note: On Microsoft Windows, path names that start with \\?\ must
not contain / as path component separators. Previously, such paths
did work in the DATA DIRECTORY argument of InnoDB tables.
Reviewed by: Vladislav Vaintroub
145 lines
4.1 KiB
Text
145 lines
4.1 KiB
Text
/*****************************************************************************
|
|
|
|
Copyright (c) 2015, 2019, MariaDB Corporation.
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program; if not, write to the Free Software Foundation, Inc.,
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
|
|
|
|
*****************************************************************************/
|
|
|
|
/**************************************************//**
|
|
@file include/fil0fil.ic
|
|
The low-level file system support functions
|
|
|
|
Created 31/03/2015 Jan Lindström
|
|
*******************************************************/
|
|
|
|
#ifndef fil0fil_ic
|
|
#define fil0fil_ic
|
|
|
|
/*******************************************************************//**
|
|
Return page type name */
|
|
UNIV_INLINE
|
|
const char*
|
|
fil_get_page_type_name(
|
|
/*===================*/
|
|
ulint page_type) /*!< in: FIL_PAGE_TYPE */
|
|
{
|
|
switch(page_type) {
|
|
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
|
|
return "PAGE_COMPRESSED_ENRYPTED";
|
|
case FIL_PAGE_PAGE_COMPRESSED:
|
|
return "PAGE_COMPRESSED";
|
|
case FIL_PAGE_TYPE_INSTANT:
|
|
case FIL_PAGE_INDEX:
|
|
return "INDEX";
|
|
case FIL_PAGE_RTREE:
|
|
return "RTREE";
|
|
case FIL_PAGE_UNDO_LOG:
|
|
return "UNDO LOG";
|
|
case FIL_PAGE_INODE:
|
|
return "INODE";
|
|
case FIL_PAGE_IBUF_FREE_LIST:
|
|
return "IBUF_FREE_LIST";
|
|
case FIL_PAGE_TYPE_ALLOCATED:
|
|
return "ALLOCATED";
|
|
case FIL_PAGE_IBUF_BITMAP:
|
|
return "IBUF_BITMAP";
|
|
case FIL_PAGE_TYPE_SYS:
|
|
return "SYS";
|
|
case FIL_PAGE_TYPE_TRX_SYS:
|
|
return "TRX_SYS";
|
|
case FIL_PAGE_TYPE_FSP_HDR:
|
|
return "FSP_HDR";
|
|
case FIL_PAGE_TYPE_XDES:
|
|
return "XDES";
|
|
case FIL_PAGE_TYPE_BLOB:
|
|
return "BLOB";
|
|
case FIL_PAGE_TYPE_ZBLOB:
|
|
return "ZBLOB";
|
|
case FIL_PAGE_TYPE_ZBLOB2:
|
|
return "ZBLOB2";
|
|
case FIL_PAGE_TYPE_UNKNOWN:
|
|
return "OLD UNKNOWN PAGE TYPE";
|
|
default:
|
|
return "PAGE TYPE CORRUPTED";
|
|
}
|
|
}
|
|
|
|
#ifdef UNIV_DEBUG
|
|
/** Validate page type.
|
|
@param[in] space Tablespace object
|
|
@param[in] page page to validate
|
|
@return true if valid, false if not */
|
|
UNIV_INLINE
|
|
bool
|
|
fil_page_type_validate(
|
|
fil_space_t* space,
|
|
const byte* page)
|
|
{
|
|
const uint16_t page_type = fil_page_get_type(page);
|
|
|
|
if ((page_type & 1U << FIL_PAGE_COMPRESS_FCRC32_MARKER)
|
|
&& space->full_crc32()
|
|
&& space->is_compressed()) {
|
|
return true;
|
|
}
|
|
|
|
/* Validate page type */
|
|
if (!((page_type == FIL_PAGE_PAGE_COMPRESSED ||
|
|
page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
|
|
page_type == FIL_PAGE_INDEX ||
|
|
page_type == FIL_PAGE_TYPE_INSTANT ||
|
|
page_type == FIL_PAGE_RTREE ||
|
|
page_type == FIL_PAGE_UNDO_LOG ||
|
|
page_type == FIL_PAGE_INODE ||
|
|
page_type == FIL_PAGE_IBUF_FREE_LIST ||
|
|
page_type == FIL_PAGE_TYPE_ALLOCATED ||
|
|
page_type == FIL_PAGE_IBUF_BITMAP ||
|
|
page_type == FIL_PAGE_TYPE_SYS ||
|
|
page_type == FIL_PAGE_TYPE_TRX_SYS ||
|
|
page_type == FIL_PAGE_TYPE_FSP_HDR ||
|
|
page_type == FIL_PAGE_TYPE_XDES ||
|
|
page_type == FIL_PAGE_TYPE_BLOB ||
|
|
page_type == FIL_PAGE_TYPE_ZBLOB ||
|
|
page_type == FIL_PAGE_TYPE_ZBLOB2 ||
|
|
page_type == FIL_PAGE_TYPE_UNKNOWN))) {
|
|
|
|
ulint space_id = mach_read_from_4(
|
|
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
|
|
|
ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
|
|
|
|
ulint key_version = mach_read_from_4(
|
|
page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
|
|
|
|
if (space && space->full_crc32()) {
|
|
key_version = mach_read_from_4(
|
|
page + FIL_PAGE_FCRC32_KEY_VERSION);
|
|
}
|
|
|
|
/* Dump out the page info */
|
|
ib::fatal() << "Page " << space_id << ":" << offset
|
|
<< " name " << (space && space->chain.start
|
|
? space->chain.start->name : "???")
|
|
<< " page_type " << page_type
|
|
<< " key_version " << key_version
|
|
<< " lsn " << mach_read_from_8(page + FIL_PAGE_LSN)
|
|
<< " compressed_len " << mach_read_from_2(page + FIL_PAGE_DATA);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
#endif /* fil0fil_ic */
|