| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 1995, 2026, Oracle and/or its affiliates. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or modify it under |
| 6 |
the terms of the GNU General Public License, version 2.0, as published by the |
| 7 |
Free Software Foundation. |
| 8 |
|
| 9 |
This program is designed to work with certain software (including |
| 10 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
as designated in a particular file or component or in included license |
| 12 |
documentation. The authors of MySQL hereby grant you an additional |
| 13 |
permission to link the program and your derivative works with the |
| 14 |
separately licensed software that they have either included with |
| 15 |
the program or referenced in the documentation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 |
for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License along with |
| 23 |
this program; if not, write to the Free Software Foundation, Inc., |
| 24 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
*****************************************************************************/ |
| 27 |
|
| 28 |
/****************************************************** |
| 29 |
@file include/fsp0types.h |
| 30 |
File space management types |
| 31 |
|
| 32 |
Created May 26, 2009 Vasil Dimov |
| 33 |
*******************************************************/ |
| 34 |
|
| 35 |
#ifndef fsp0types_h |
| 36 |
#define fsp0types_h |
| 37 |
|
| 38 |
#include "fil0types.h" |
| 39 |
#include "univ.i" |
| 40 |
|
| 41 |
/** @name Flags for inserting records in order |
| 42 |
If records are inserted in order, there are the following |
| 43 |
flags to tell this (their type is made byte for the compiler |
| 44 |
to warn if direction and hint parameters are switched in |
| 45 |
fseg_alloc_free_page) */ |
| 46 |
/** @{ */ |
| 47 |
/** alphabetically upwards */ |
| 48 |
constexpr byte FSP_UP = 111; |
| 49 |
/** alphabetically downwards */ |
| 50 |
constexpr byte FSP_DOWN = 112; |
| 51 |
/** no order */ |
| 52 |
constexpr byte FSP_NO_DIR = 113; |
| 53 |
/** @} */ |
| 54 |
|
| 55 |
/** File space extent size in pages |
| 56 |
page size | file space extent size |
| 57 |
----------+----------------------- |
| 58 |
4 KiB | 256 pages = 1 MiB |
| 59 |
8 KiB | 128 pages = 1 MiB |
| 60 |
16 KiB | 64 pages = 1 MiB |
| 61 |
32 KiB | 64 pages = 2 MiB |
| 62 |
64 KiB | 64 pages = 4 MiB |
| 63 |
*/ |
| 64 |
#define FSP_EXTENT_SIZE \ |
| 65 |
static_cast<page_no_t>( \ |
| 66 |
((UNIV_PAGE_SIZE <= (16384) \ |
| 67 |
? (1048576 / UNIV_PAGE_SIZE) \ |
| 68 |
: ((UNIV_PAGE_SIZE <= (32768)) ? (2097152 / UNIV_PAGE_SIZE) \ |
| 69 |
: (4194304 / UNIV_PAGE_SIZE))))) |
| 70 |
|
| 71 |
/** File space extent size (four megabyte) in pages for MAX page size */ |
| 72 |
constexpr size_t FSP_EXTENT_SIZE_MAX = 4194304 / UNIV_PAGE_SIZE_MAX; |
| 73 |
|
| 74 |
/** File space extent size (one megabyte) in pages for MIN page size */ |
| 75 |
constexpr size_t FSP_EXTENT_SIZE_MIN = 1048576 / UNIV_PAGE_SIZE_MIN; |
| 76 |
|
| 77 |
/** On a page of any file segment, data |
| 78 |
may be put starting from this offset */ |
| 79 |
constexpr uint32_t FSEG_PAGE_DATA = FIL_PAGE_DATA; |
| 80 |
|
| 81 |
/** @name File segment header |
| 82 |
The file segment header points to the inode describing the file segment. */ |
| 83 |
/** @{ */ |
| 84 |
/** Data type for file segment header */ |
| 85 |
typedef byte fseg_header_t; |
| 86 |
|
| 87 |
/** space id of the inode */ |
| 88 |
constexpr uint32_t FSEG_HDR_SPACE = 0; |
| 89 |
/** page number of the inode */ |
| 90 |
constexpr uint32_t FSEG_HDR_PAGE_NO = 4; |
| 91 |
/** byte offset of the inode */ |
| 92 |
constexpr uint32_t FSEG_HDR_OFFSET = 8; |
| 93 |
/** Length of the file system header, in bytes */ |
| 94 |
constexpr uint32_t FSEG_HEADER_SIZE = 10; |
| 95 |
/** @} */ |
| 96 |
|
| 97 |
#ifdef UNIV_DEBUG |
| 98 |
|
| 99 |
struct mtr_t; |
| 100 |
|
| 101 |
/** A wrapper class to print the file segment header information. */ |
| 102 |
class fseg_header { |
| 103 |
public: |
| 104 |
/** Constructor of fseg_header. |
| 105 |
@param[in] header Underlying file segment header object |
| 106 |
@param[in] mtr Mini-transaction. No redo logs are |
| 107 |
generated, only latches are checked within |
| 108 |
mini-transaction */ |
| 109 |
fseg_header(const fseg_header_t *header, mtr_t *mtr) |
| 110 |
: m_header(header), m_mtr(mtr) {} |
| 111 |
|
| 112 |
/** Print the file segment header to the given output stream. |
| 113 |
@param[in] out the output stream into which the object is printed. |
| 114 |
@retval the output stream into which the object was printed. */ |
| 115 |
std::ostream &to_stream(std::ostream &out) const; |
| 116 |
|
| 117 |
private: |
| 118 |
/** The underlying file segment header */ |
| 119 |
const fseg_header_t *m_header; |
| 120 |
|
| 121 |
/** The mini-transaction, which is used mainly to check whether |
| 122 |
appropriate latches have been taken by the calling thread. */ |
| 123 |
mtr_t *m_mtr; |
| 124 |
}; |
| 125 |
|
| 126 |
/* Overloading the global output operator to print a file segment header |
| 127 |
@param[in,out] out the output stream into which object will be printed |
| 128 |
@param[in] header the file segment header to be printed |
| 129 |
@retval the output stream */ |
| 130 |
inline std::ostream &operator<<(std::ostream &out, const fseg_header &header) { |
| 131 |
return (header.to_stream(out)); |
| 132 |
} |
| 133 |
#endif /* UNIV_DEBUG */ |
| 134 |
|
| 135 |
/** Flags for fsp_reserve_free_extents */ |
| 136 |
enum fsp_reserve_t { |
| 137 |
FSP_NORMAL, /* reservation during normal B-tree operations */ |
| 138 |
FSP_UNDO, /* reservation done for undo logging */ |
| 139 |
FSP_CLEANING, /* reservation done during purge operations */ |
| 140 |
FSP_BLOB /* reservation being done for BLOB insertion */ |
| 141 |
}; |
| 142 |
|
| 143 |
/* Number of pages described in a single descriptor page: currently each page |
| 144 |
description takes less than 1 byte; a descriptor page is repeated every |
| 145 |
this many file pages */ |
| 146 |
/* #define XDES_DESCRIBED_PER_PAGE UNIV_PAGE_SIZE */ |
| 147 |
/* This has been replaced with either UNIV_PAGE_SIZE or page_zip->size. */ |
| 148 |
|
| 149 |
/** @name The space low address page map |
| 150 |
The pages at FSP_XDES_OFFSET and FSP_IBUF_BITMAP_OFFSET are repeated |
| 151 |
every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */ |
| 152 |
/** @{ */ |
| 153 |
/*--------------------------------------*/ |
| 154 |
/** extent descriptor */ |
| 155 |
constexpr uint32_t FSP_XDES_OFFSET = 0; |
| 156 |
/** insert buffer bitmap; The ibuf bitmap pages are the ones whose page number |
| 157 |
is the number above plus a multiple of XDES_DESCRIBED_PER_PAGE */ |
| 158 |
constexpr uint32_t FSP_IBUF_BITMAP_OFFSET = 1; |
| 159 |
/** in every tablespace */ |
| 160 |
constexpr uint32_t FSP_FIRST_INODE_PAGE_NO = 2; |
| 161 |
|
| 162 |
/** The following pages exist in the system tablespace (space 0). */ |
| 163 |
/** insert buffer header page, in tablespace 0 */ |
| 164 |
constexpr uint32_t FSP_IBUF_HEADER_PAGE_NO = 3; |
| 165 |
/** insert buffer B-tree root page in tablespace 0; |
| 166 |
The ibuf tree root page number in tablespace 0; its fseg inode is on the page |
| 167 |
number FSP_FIRST_INODE_PAGE_NO */ |
| 168 |
constexpr uint32_t FSP_IBUF_TREE_ROOT_PAGE_NO = 4; |
| 169 |
/** transaction system header, in tablespace 0 */ |
| 170 |
constexpr uint32_t FSP_TRX_SYS_PAGE_NO = 5; |
| 171 |
/** first rollback segment page, in tablespace 0 */ |
| 172 |
constexpr uint32_t FSP_FIRST_RSEG_PAGE_NO = 6; |
| 173 |
/** data dictionary header page, in tablespace 0 */ |
| 174 |
constexpr uint32_t FSP_DICT_HDR_PAGE_NO = 7; |
| 175 |
|
| 176 |
/* The following page exists in each v8 Undo Tablespace. |
| 177 |
(space_id = SRV_LOG_SPACE_FIRST_ID - undo_space_num) |
| 178 |
(undo_space_num = rseg_array_slot_num + 1) */ |
| 179 |
|
| 180 |
/** rollback segment directory page number in each undo tablespace */ |
| 181 |
constexpr uint32_t FSP_RSEG_ARRAY_PAGE_NO = 3; |
| 182 |
/*--------------------------------------*/ |
| 183 |
/** @} */ |
| 184 |
|
| 185 |
/** Validate the tablespace flags. |
| 186 |
These flags are stored in the tablespace header at offset FSP_SPACE_FLAGS. |
| 187 |
They should be 0 for ROW_FORMAT=COMPACT and ROW_FORMAT=REDUNDANT. |
| 188 |
The newer row formats, COMPRESSED and DYNAMIC, will have at least |
| 189 |
the DICT_TF_COMPACT bit set. |
| 190 |
@param[in] flags Tablespace flags |
| 191 |
@return true if valid, false if not */ |
| 192 |
[[nodiscard]] bool fsp_flags_is_valid(uint32_t flags); |
| 193 |
|
| 194 |
/** Check if tablespace is system temporary. |
| 195 |
@param[in] space_id tablespace ID |
| 196 |
@return true if tablespace is system temporary. */ |
| 197 |
bool fsp_is_system_temporary(space_id_t space_id); |
| 198 |
|
| 199 |
/** Check if the tablespace is session temporary. |
| 200 |
@param[in] space_id tablespace ID |
| 201 |
@return true if tablespace is a session temporary tablespace. */ |
| 202 |
bool fsp_is_session_temporary(space_id_t space_id); |
| 203 |
|
| 204 |
/** Check if tablespace is global temporary. |
| 205 |
@param[in] space_id tablespace ID |
| 206 |
@return true if tablespace is global temporary. */ |
| 207 |
bool fsp_is_global_temporary(space_id_t space_id); |
| 208 |
|
| 209 |
/** Check if checksum is disabled for the given space. |
| 210 |
@param[in] space_id tablespace ID |
| 211 |
@return true if checksum is disabled for given space. */ |
| 212 |
bool fsp_is_checksum_disabled(space_id_t space_id); |
| 213 |
|
| 214 |
#ifdef UNIV_DEBUG |
| 215 |
/** Skip some of the sanity checks that are time consuming even in debug mode |
| 216 |
and can affect frequent verification runs that are done to ensure stability of |
| 217 |
the product. |
| 218 |
@return true if check should be skipped for given space. */ |
| 219 |
bool fsp_skip_sanity_check(space_id_t space_id); |
| 220 |
#endif /* UNIV_DEBUG */ |
| 221 |
|
| 222 |
/** @defgroup fsp_flags InnoDB Tablespace Flag Constants |
| 223 |
@{ */ |
| 224 |
|
| 225 |
/** Width of the POST_ANTELOPE flag */ |
| 226 |
constexpr uint32_t FSP_FLAGS_WIDTH_POST_ANTELOPE = 1; |
| 227 |
/** Number of flag bits used to indicate the tablespace zip page size */ |
| 228 |
constexpr uint32_t FSP_FLAGS_WIDTH_ZIP_SSIZE = 4; |
| 229 |
/** Width of the ATOMIC_BLOBS flag. The ability to break up a long |
| 230 |
column into an in-record prefix and an externally stored part is available |
| 231 |
to ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT. */ |
| 232 |
constexpr uint32_t FSP_FLAGS_WIDTH_ATOMIC_BLOBS = 1; |
| 233 |
/** Number of flag bits used to indicate the tablespace page size */ |
| 234 |
constexpr uint32_t FSP_FLAGS_WIDTH_PAGE_SSIZE = 4; |
| 235 |
/** Width of the DATA_DIR flag. This flag indicates that the tablespace |
| 236 |
is found in a remote location, not the default data directory. */ |
| 237 |
constexpr uint32_t FSP_FLAGS_WIDTH_DATA_DIR = 1; |
| 238 |
/** Width of the SHARED flag. This flag indicates that the tablespace |
| 239 |
was created with CREATE TABLESPACE and can be shared by multiple tables. */ |
| 240 |
constexpr uint32_t FSP_FLAGS_WIDTH_SHARED = 1; |
| 241 |
/** Width of the TEMPORARY flag. This flag indicates that the tablespace |
| 242 |
is a temporary tablespace and everything in it is temporary, meaning that |
| 243 |
it is for a single client and should be deleted upon startup if it exists. */ |
| 244 |
constexpr uint32_t FSP_FLAGS_WIDTH_TEMPORARY = 1; |
| 245 |
/** Width of the encryption flag. This flag indicates that the tablespace |
| 246 |
is a tablespace with encryption. */ |
| 247 |
constexpr uint32_t FSP_FLAGS_WIDTH_ENCRYPTION = 1; |
| 248 |
/** Width of the SDI flag. This flag indicates the presence of |
| 249 |
tablespace dictionary.*/ |
| 250 |
constexpr uint32_t FSP_FLAGS_WIDTH_SDI = 1; |
| 251 |
|
| 252 |
/** Width of all the currently known tablespace flags */ |
| 253 |
constexpr uint32_t FSP_FLAGS_WIDTH = |
| 254 |
FSP_FLAGS_WIDTH_POST_ANTELOPE + FSP_FLAGS_WIDTH_ZIP_SSIZE + |
| 255 |
FSP_FLAGS_WIDTH_ATOMIC_BLOBS + FSP_FLAGS_WIDTH_PAGE_SSIZE + |
| 256 |
FSP_FLAGS_WIDTH_DATA_DIR + FSP_FLAGS_WIDTH_SHARED + |
| 257 |
FSP_FLAGS_WIDTH_TEMPORARY + FSP_FLAGS_WIDTH_ENCRYPTION + |
| 258 |
FSP_FLAGS_WIDTH_SDI; |
| 259 |
|
| 260 |
/** A mask of all the known/used bits in tablespace flags */ |
| 261 |
constexpr uint32_t FSP_FLAGS_MASK = ~(~0U << FSP_FLAGS_WIDTH); |
| 262 |
|
| 263 |
/** Zero relative shift position of the POST_ANTELOPE field */ |
| 264 |
constexpr uint32_t FSP_FLAGS_POS_POST_ANTELOPE = 0; |
| 265 |
/** Zero relative shift position of the ZIP_SSIZE field */ |
| 266 |
constexpr uint32_t FSP_FLAGS_POS_ZIP_SSIZE = |
| 267 |
FSP_FLAGS_POS_POST_ANTELOPE + FSP_FLAGS_WIDTH_POST_ANTELOPE; |
| 268 |
/** Zero relative shift position of the ATOMIC_BLOBS field */ |
| 269 |
constexpr uint32_t FSP_FLAGS_POS_ATOMIC_BLOBS = |
| 270 |
FSP_FLAGS_POS_ZIP_SSIZE + FSP_FLAGS_WIDTH_ZIP_SSIZE; |
| 271 |
/** Zero relative shift position of the PAGE_SSIZE field */ |
| 272 |
constexpr uint32_t FSP_FLAGS_POS_PAGE_SSIZE = |
| 273 |
FSP_FLAGS_POS_ATOMIC_BLOBS + FSP_FLAGS_WIDTH_ATOMIC_BLOBS; |
| 274 |
/** Zero relative shift position of the start of the DATA_DIR bit */ |
| 275 |
constexpr uint32_t FSP_FLAGS_POS_DATA_DIR = |
| 276 |
FSP_FLAGS_POS_PAGE_SSIZE + FSP_FLAGS_WIDTH_PAGE_SSIZE; |
| 277 |
/** Zero relative shift position of the start of the SHARED bit */ |
| 278 |
constexpr uint32_t FSP_FLAGS_POS_SHARED = |
| 279 |
FSP_FLAGS_POS_DATA_DIR + FSP_FLAGS_WIDTH_DATA_DIR; |
| 280 |
/** Zero relative shift position of the start of the TEMPORARY bit */ |
| 281 |
constexpr uint32_t FSP_FLAGS_POS_TEMPORARY = |
| 282 |
FSP_FLAGS_POS_SHARED + FSP_FLAGS_WIDTH_SHARED; |
| 283 |
/** Zero relative shift position of the start of the ENCRYPTION bit */ |
| 284 |
constexpr uint32_t FSP_FLAGS_POS_ENCRYPTION = |
| 285 |
FSP_FLAGS_POS_TEMPORARY + FSP_FLAGS_WIDTH_TEMPORARY; |
| 286 |
/** Zero relative shift position of the start of the SDI bits */ |
| 287 |
constexpr uint32_t FSP_FLAGS_POS_SDI = |
| 288 |
FSP_FLAGS_POS_ENCRYPTION + FSP_FLAGS_WIDTH_ENCRYPTION; |
| 289 |
|
| 290 |
/** Zero relative shift position of the start of the UNUSED bits */ |
| 291 |
constexpr uint32_t FSP_FLAGS_POS_UNUSED = |
| 292 |
FSP_FLAGS_POS_SDI + FSP_FLAGS_WIDTH_SDI; |
| 293 |
|
| 294 |
/** Bit mask of the POST_ANTELOPE field */ |
| 295 |
constexpr uint32_t FSP_FLAGS_MASK_POST_ANTELOPE = |
| 296 |
(~(~0U << FSP_FLAGS_WIDTH_POST_ANTELOPE)) << FSP_FLAGS_POS_POST_ANTELOPE; |
| 297 |
/** Bit mask of the ZIP_SSIZE field */ |
| 298 |
constexpr uint32_t FSP_FLAGS_MASK_ZIP_SSIZE = |
| 299 |
(~(~0U << FSP_FLAGS_WIDTH_ZIP_SSIZE)) << FSP_FLAGS_POS_ZIP_SSIZE; |
| 300 |
/** Bit mask of the ATOMIC_BLOBS field */ |
| 301 |
constexpr uint32_t FSP_FLAGS_MASK_ATOMIC_BLOBS = |
| 302 |
(~(~0U << FSP_FLAGS_WIDTH_ATOMIC_BLOBS)) << FSP_FLAGS_POS_ATOMIC_BLOBS; |
| 303 |
/** Bit mask of the PAGE_SSIZE field */ |
| 304 |
constexpr uint32_t FSP_FLAGS_MASK_PAGE_SSIZE = |
| 305 |
(~(~0U << FSP_FLAGS_WIDTH_PAGE_SSIZE)) << FSP_FLAGS_POS_PAGE_SSIZE; |
| 306 |
/** Bit mask of the DATA_DIR field */ |
| 307 |
constexpr uint32_t FSP_FLAGS_MASK_DATA_DIR = |
| 308 |
(~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) << FSP_FLAGS_POS_DATA_DIR; |
| 309 |
/** Bit mask of the SHARED field */ |
| 310 |
constexpr uint32_t FSP_FLAGS_MASK_SHARED = (~(~0U << FSP_FLAGS_WIDTH_SHARED)) |
| 311 |
<< FSP_FLAGS_POS_SHARED; |
| 312 |
/** Bit mask of the TEMPORARY field */ |
| 313 |
constexpr uint32_t FSP_FLAGS_MASK_TEMPORARY = |
| 314 |
(~(~0U << FSP_FLAGS_WIDTH_TEMPORARY)) << FSP_FLAGS_POS_TEMPORARY; |
| 315 |
/** Bit mask of the ENCRYPTION field */ |
| 316 |
constexpr uint32_t FSP_FLAGS_MASK_ENCRYPTION = |
| 317 |
(~(~0U << FSP_FLAGS_WIDTH_ENCRYPTION)) << FSP_FLAGS_POS_ENCRYPTION; |
| 318 |
/** Bit mask of the SDI field */ |
| 319 |
constexpr uint32_t FSP_FLAGS_MASK_SDI = (~(~0U << FSP_FLAGS_WIDTH_SDI)) |
| 320 |
<< FSP_FLAGS_POS_SDI; |
| 321 |
|
| 322 |
/** Return the value of the POST_ANTELOPE field */ |
| 323 |
constexpr uint32_t FSP_FLAGS_GET_POST_ANTELOPE(uint32_t flags) { |
| 324 |
return (flags & FSP_FLAGS_MASK_POST_ANTELOPE) >> FSP_FLAGS_POS_POST_ANTELOPE; |
| 325 |
} |
| 326 |
/** Return the value of the ZIP_SSIZE field */ |
| 327 |
constexpr uint32_t FSP_FLAGS_GET_ZIP_SSIZE(uint32_t flags) { |
| 328 |
return (flags & FSP_FLAGS_MASK_ZIP_SSIZE) >> FSP_FLAGS_POS_ZIP_SSIZE; |
| 329 |
} |
| 330 |
/** Return the value of the ATOMIC_BLOBS field */ |
| 331 |
constexpr uint32_t FSP_FLAGS_HAS_ATOMIC_BLOBS(uint32_t flags) { |
| 332 |
return (flags & FSP_FLAGS_MASK_ATOMIC_BLOBS) >> FSP_FLAGS_POS_ATOMIC_BLOBS; |
| 333 |
} |
| 334 |
/** Return the value of the PAGE_SSIZE field */ |
| 335 |
constexpr uint32_t FSP_FLAGS_GET_PAGE_SSIZE(uint32_t flags) { |
| 336 |
return (flags & FSP_FLAGS_MASK_PAGE_SSIZE) >> FSP_FLAGS_POS_PAGE_SSIZE; |
| 337 |
} |
| 338 |
/** Return the value of the DATA_DIR field */ |
| 339 |
constexpr uint32_t FSP_FLAGS_HAS_DATA_DIR(uint32_t flags) { |
| 340 |
return (flags & FSP_FLAGS_MASK_DATA_DIR) >> FSP_FLAGS_POS_DATA_DIR; |
| 341 |
} |
| 342 |
/** Return the contents of the SHARED field */ |
| 343 |
constexpr uint32_t FSP_FLAGS_GET_SHARED(uint32_t flags) { |
| 344 |
return (flags & FSP_FLAGS_MASK_SHARED) >> FSP_FLAGS_POS_SHARED; |
| 345 |
} |
| 346 |
/** Return the contents of the TEMPORARY field */ |
| 347 |
constexpr uint32_t FSP_FLAGS_GET_TEMPORARY(uint32_t flags) { |
| 348 |
return (flags & FSP_FLAGS_MASK_TEMPORARY) >> FSP_FLAGS_POS_TEMPORARY; |
| 349 |
} |
| 350 |
/** Return the contents of the ENCRYPTION field */ |
| 351 |
constexpr uint32_t FSP_FLAGS_GET_ENCRYPTION(uint32_t flags) { |
| 352 |
return (flags & FSP_FLAGS_MASK_ENCRYPTION) >> FSP_FLAGS_POS_ENCRYPTION; |
| 353 |
} |
| 354 |
/** Return the value of the SDI field */ |
| 355 |
constexpr uint32_t FSP_FLAGS_HAS_SDI(uint32_t flags) { |
| 356 |
return (flags & FSP_FLAGS_MASK_SDI) >> FSP_FLAGS_POS_SDI; |
| 357 |
} |
| 358 |
/** Return the contents of the UNUSED bits */ |
| 359 |
constexpr uint32_t FSP_FLAGS_GET_UNUSED(uint32_t flags) { |
| 360 |
return flags >> FSP_FLAGS_POS_UNUSED; |
| 361 |
} |
| 362 |
/** Return true if flags are not set */ |
| 363 |
constexpr bool FSP_FLAGS_ARE_NOT_SET(uint32_t flags) { |
| 364 |
return (flags & FSP_FLAGS_MASK) == 0; |
| 365 |
} |
| 366 |
|
| 367 |
/** Set ENCRYPTION bit in tablespace flags */ |
| 368 |
constexpr void fsp_flags_set_encryption(uint32_t &flags) { |
| 369 |
flags |= FSP_FLAGS_MASK_ENCRYPTION; |
| 370 |
} |
| 371 |
|
| 372 |
/** Set ENCRYPTION bit in tablespace flags */ |
| 373 |
constexpr void fsp_flags_unset_encryption(uint32_t &flags) { |
| 374 |
flags &= ~FSP_FLAGS_MASK_ENCRYPTION; |
| 375 |
} |
| 376 |
|
| 377 |
/** Set SDI Index bit in tablespace flags */ |
| 378 |
constexpr void fsp_flags_set_sdi(uint32_t &flags) { |
| 379 |
flags |= FSP_FLAGS_MASK_SDI; |
| 380 |
} |
| 381 |
|
| 382 |
/** Set SDI Index bit in tablespace flags */ |
| 383 |
constexpr void fsp_flags_unset_sdi(uint32_t &flags) { |
| 384 |
flags &= ~FSP_FLAGS_MASK_SDI; |
| 385 |
} |
| 386 |
|
| 387 |
/** Use an alias in the code for FSP_FLAGS_GET_SHARED() */ |
| 388 |
constexpr uint32_t fsp_is_shared_tablespace(uint32_t flags) { |
| 389 |
return FSP_FLAGS_GET_SHARED(flags); |
| 390 |
} |
| 391 |
/** @} */ |
| 392 |
|
| 393 |
/** Max number of rollback segments: the number of segment specification slots |
| 394 |
in the transaction system array; rollback segment id must fit in one (signed) |
| 395 |
byte, therefore 128; each slot is currently 8 bytes in size. If you want |
| 396 |
to raise the level to 256 then you will need to fix some assertions that |
| 397 |
impose the 7 bit restriction. e.g., mach_write_to_3() */ |
| 398 |
constexpr size_t TRX_SYS_N_RSEGS = 128; |
| 399 |
|
| 400 |
/** Minimum and Maximum number of implicit undo tablespaces. This kind |
| 401 |
of undo tablespace is always created and found in --innodb-undo-directory. */ |
| 402 |
constexpr size_t FSP_MIN_UNDO_TABLESPACES = 2; |
| 403 |
constexpr size_t FSP_MAX_UNDO_TABLESPACES = TRX_SYS_N_RSEGS - 1; |
| 404 |
constexpr size_t FSP_IMPLICIT_UNDO_TABLESPACES = 2; |
| 405 |
constexpr size_t FSP_MAX_ROLLBACK_SEGMENTS = TRX_SYS_N_RSEGS; |
| 406 |
|
| 407 |
#endif /* fsp0types_h */ |