| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | Copyright (c) 2013, 2023, MariaDB Corporation. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify it under |
| 7 | the terms of the GNU General Public License as published by the Free Software |
| 8 | Foundation; version 2 of the License. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License along with |
| 15 | this program; if not, write to the Free Software Foundation, Inc., |
| 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 17 | |
| 18 | *****************************************************************************/ |
| 19 | |
| 20 | /**************************************************//** |
| 21 | @file include/fil0fil.h |
| 22 | The low-level file system |
| 23 | |
| 24 | Created 10/25/1995 Heikki Tuuri |
| 25 | *******************************************************/ |
| 26 | |
| 27 | #pragma once |
| 28 | |
| 29 | #include "fsp0types.h"cxx . . $ `<file>/storage/innobase/include/fsp0types.h`/ |
| 30 | #include "mach0data.h"cxx . . $ `<file>/storage/innobase/include/mach0data.h`/ |
| 31 | #include "assume_aligned.h"cxx . . $ `<file>/include/assume_aligned.h`/ |
| 32 | |
| 33 | #ifndef UNIV_INNOCHECKSUMcxx . . $ `<built-in>:481:9`! |
| 34 | |
| 35 | #include "srw_lock.h"cxx . . $ `<file>/storage/innobase/include/srw_lock.h`/ |
| 36 | #include "buf0dblwr.h"cxx . . $ `<file>/storage/innobase/include/buf0dblwr.h`/ |
| 37 | #include "hash0hash.h"cxx . . $ `<file>/storage/innobase/include/hash0hash.h`/ |
| 38 | #include "log0recv.h"cxx . . $ `<file>/storage/innobase/include/log0recv.h`/ |
| 39 | #include "dict0types.h"cxx . . $ `<file>/storage/innobase/include/dict0types.h`/ |
| 40 | #include "ilist.h"cxx . . $ `<file>/include/ilist.h`/ |
| 41 | #include <set> |
| 42 | #include <mutex> |
| 43 | |
| 44 | struct unflushed_spaces_tag_tcxx . . $ unflushed_spaces_tag_t#; |
| 45 | struct default_encrypt_tag_tcxx . . $ default_encrypt_tag_t#; |
| 46 | struct space_list_tag_tcxx . . $ space_list_tag_t#; |
| 47 | struct named_spaces_tag_tcxx . . $ named_spaces_tag_t#; |
| 48 | |
| 49 | using space_list_tcxx . . $ space_list_t#= ilistcxx . . $ ilist#<fil_space_tcxx . . $ fil_space_t#, space_list_tag_tcxx . . $ space_list_tag_t#>; |
| 50 | |
| 51 | /** Possible values of innodb_linux_aio */ |
| 52 | #ifdef __linux__cxx . . $ `<built-in>:465:9`! |
| 53 | enum srv_linux_aio_tcxx . . $ srv_linux_aio_t# |
| 54 | { |
| 55 | /** auto, io_uring first and then aio */ |
| 56 | SRV_LINUX_AIO_AUTOcxx . . $ SRV_LINUX_AIO_AUTO., |
| 57 | /** io_uring */ |
| 58 | SRV_LINUX_AIO_IO_URINGcxx . . $ SRV_LINUX_AIO_IO_URING., |
| 59 | /** aio (libaio interface) */ |
| 60 | SRV_LINUX_AIO_LIBAIOcxx . . $ SRV_LINUX_AIO_LIBAIO. |
| 61 | }; |
| 62 | #endif |
| 63 | |
| 64 | /** innodb_flush_method */ |
| 65 | extern ulong srv_file_flush_methodcxx . . $ srv_file_flush_method.; |
| 66 | |
| 67 | /** Undo tablespaces starts with space_id. */ |
| 68 | extern uint32_tcxx . . $ uint32_t# srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.; |
| 69 | /** The number of UNDO tablespaces that are open and ready to use. */ |
| 70 | extern uint32_tcxx . . $ uint32_t# srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.; |
| 71 | |
| 72 | /** Check whether given space id is undo tablespace id |
| 73 | @param[in] space_id space id to check |
| 74 | @return true if it is undo tablespace else false. */ |
| 75 | inline bool srv_is_undo_tablespacecxx . . $ srv_is_undo_tablespace(dfa6e707f7696010).(uint32_tcxx . . $ uint32_t# space_id) |
| 76 | { |
| 77 | return srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. > 0 && |
| 78 | space_id >= srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. && |
| 79 | space_id < srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. + srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.; |
| 80 | } |
| 81 | |
| 82 | class page_id_tcxx . . $ page_id_t#; |
| 83 | |
| 84 | /** Structure containing encryption specification */ |
| 85 | struct fil_space_crypt_tcxx . . $ fil_space_crypt_t#; |
| 86 | |
| 87 | struct fil_node_tcxx . . $ fil_node_t#; |
| 88 | |
| 89 | /** Structure to store first and last value of range */ |
| 90 | struct range_tcxx . . $ range_t# |
| 91 | { |
| 92 | uint32_tcxx . . $ uint32_t# firstcxx . . $ range_t#first.; |
| 93 | uint32_tcxx . . $ uint32_t# lastcxx . . $ range_t#last.; |
| 94 | }; |
| 95 | |
| 96 | /** Sort the range based on first value of the range */ |
| 97 | struct range_comparecxx . . $ range_compare# |
| 98 | { |
| 99 | bool operatorcxx . . $ range_compare#`operator()`(eb90df139d2f04a1).() (const range_tcxx . . $ range_t# lhs, const range_tcxx . . $ range_t# rhs) const |
| 100 | { |
| 101 | return lhs.firstcxx . . $ range_t#first. < rhs.firstcxx . . $ range_t#first.; |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | using range_set_tcxx . . $ range_set_t#= stdcxx . . $ std/::setcxx . . $ std/set#<range_tcxx . . $ range_t#, range_comparecxx . . $ range_compare#>; |
| 106 | /** Range to store the set of ranges of integers */ |
| 107 | class range_setcxx . . $ range_set# |
| 108 | { |
| 109 | private: |
| 110 | range_set_tcxx . . $ range_set_t# rangescxx . . $ range_set#ranges.; |
| 111 | |
| 112 | range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# findcxx . . $ range_set#find(a8ab509452734fe7).(uint32_tcxx . . $ uint32_t# value) const |
| 113 | { |
| 114 | auto r_offset= rangescxx . . $ range_set#ranges..lower_boundcxx . . $ std/set#lower_bound(5d7b472851d10a0f).({value, value}); |
| 115 | const auto r_end= rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).(); |
| 116 | if (r_offset !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). r_end); |
| 117 | else if (emptycxx . . $ range_set#empty(50ce9a9e25b4a850).()) |
| 118 | return r_end; |
| 119 | else |
| 120 | r_offset=cxx . . $ std/_Rb_tree_const_iterator#`operator=`(3e894a8f9b319902). stdcxx . . $ std/::prevcxx . . $ std/prev(31d62cd24490f169).(r_end); |
| 121 | if (r_offset->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. <= value && r_offset->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last. >= value) |
| 122 | return r_offset; |
| 123 | return r_end; |
| 124 | } |
| 125 | public: |
| 126 | /** Merge the current range with previous range. |
| 127 | @param[in] range range to be merged |
| 128 | @param[in] prev_range range to be merged with next */ |
| 129 | void merge_rangecxx . . $ range_set#merge_range(a659c7b9a23795dc).(range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# range, |
| 130 | range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# prev_range) |
| 131 | { |
| 132 | if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. != prev_range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last. + 1) |
| 133 | return; |
| 134 | |
| 135 | /* Merge the current range with previous range */ |
| 136 | range_tcxx . . $ range_t# new_range {prev_range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first., range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last.}; |
| 137 | rangescxx . . $ range_set#ranges..erasecxx . . $ std/set#erase(36a7984e631cd3e9).(prev_range); |
| 138 | rangescxx . . $ range_set#ranges..erasecxx . . $ std/set#erase(36a7984e631cd3e9).(range); |
| 139 | rangescxx . . $ range_set#ranges..emplacecxx . . $ std/set#emplace(f53bd0b00b9290a8).(new_range); |
| 140 | } |
| 141 | |
| 142 | /** Split the range and add two more ranges |
| 143 | @param[in] range range to be split |
| 144 | @param[in] value Value to be removed from range */ |
| 145 | void split_rangecxx . . $ range_set#split_range(7bfb09ac0a34e530).(range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# range, uint32_tcxx . . $ uint32_t# value) |
| 146 | { |
| 147 | range_tcxx . . $ range_t# split1{range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first., value - 1}; |
| 148 | range_tcxx . . $ range_t# split2{value + 1, range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last.}; |
| 149 | |
| 150 | /* Remove the existing element */ |
| 151 | rangescxx . . $ range_set#ranges..erasecxx . . $ std/set#erase(36a7984e631cd3e9).(range); |
| 152 | |
| 153 | /* Insert the two elements */ |
| 154 | rangescxx . . $ range_set#ranges..emplacecxx . . $ std/set#emplace(f53bd0b00b9290a8).(split1); |
| 155 | rangescxx . . $ range_set#ranges..emplacecxx . . $ std/set#emplace(f53bd0b00b9290a8).(split2); |
| 156 | } |
| 157 | |
| 158 | /** Remove the value with the given range |
| 159 | @param[in,out] range range to be changed |
| 160 | @param[in] value value to be removed */ |
| 161 | void remove_within_rangecxx . . $ range_set#remove_within_range(7bfb09ac0a34e530).(range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# range, uint32_tcxx . . $ uint32_t# value) |
| 162 | { |
| 163 | range_tcxx . . $ range_t# new_range{range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first., range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last.}; |
| 164 | if (value == range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first.) |
| 165 | { |
| 166 | if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. == range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last.) |
| 167 | { |
| 168 | rangescxx . . $ range_set#ranges..erasecxx . . $ std/set#erase(36a7984e631cd3e9).(range); |
| 169 | return; |
| 170 | } |
| 171 | else |
| 172 | new_range.firstcxx . . $ range_t#first.++; |
| 173 | } |
| 174 | else if (value == range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last.) |
| 175 | new_range.lastcxx . . $ range_t#last.--; |
| 176 | else if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. < value && range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last. > value) |
| 177 | return split_rangecxx . . $ range_set#split_range(7bfb09ac0a34e530).(range, value); |
| 178 | |
| 179 | rangescxx . . $ range_set#ranges..erasecxx . . $ std/set#erase(36a7984e631cd3e9).(range); |
| 180 | rangescxx . . $ range_set#ranges..emplacecxx . . $ std/set#emplace(f53bd0b00b9290a8).(new_range); |
| 181 | } |
| 182 | |
| 183 | /** Remove the value from the ranges. |
| 184 | @param[in] value Value to be removed. */ |
| 185 | void remove_valuecxx . . $ range_set#remove_value(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# value) |
| 186 | { |
| 187 | if (emptycxx . . $ range_set#empty(50ce9a9e25b4a850).()) |
| 188 | return; |
| 189 | range_tcxx . . $ range_t# new_range {value, value}; |
| 190 | range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# range= rangescxx . . $ range_set#ranges..lower_boundcxx . . $ std/set#lower_bound(f8922f46a681e6cc).(new_range); |
| 191 | if (range ==cxx . . $ std/`operator==`(a84eb84a7a5e8237). rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).()) |
| 192 | return remove_within_rangecxx . . $ range_set#remove_within_range(7bfb09ac0a34e530).(stdcxx . . $ std/::prevcxx . . $ std/prev(31d62cd24490f169).(range), value); |
| 193 | |
| 194 | if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. > value && range !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). rangescxx . . $ range_set#ranges..begincxx . . $ std/set#begin(3220b82c0db6d2a1).()) |
| 195 | /* Iterate the previous ranges to delete */ |
| 196 | return remove_within_rangecxx . . $ range_set#remove_within_range(7bfb09ac0a34e530).(stdcxx . . $ std/::prevcxx . . $ std/prev(31d62cd24490f169).(range), value); |
| 197 | return remove_within_rangecxx . . $ range_set#remove_within_range(7bfb09ac0a34e530).(range, value); |
| 198 | } |
| 199 | /** Add the value within the existing range |
| 200 | @param[in] range range to be modified |
| 201 | @param[in] value value to be added */ |
| 202 | range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# add_within_rangecxx . . $ range_set#add_within_range(d00544960b4dede3).(range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# range, |
| 203 | uint32_tcxx . . $ uint32_t# value) |
| 204 | { |
| 205 | if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. <= value && range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last. >= value) |
| 206 | return range; |
| 207 | |
| 208 | range_tcxx . . $ range_t# new_range{range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first., range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last.}; |
| 209 | if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).lastcxx . . $ range_t#last. + 1 == value) |
| 210 | new_range.lastcxx . . $ range_t#last.++; |
| 211 | else if (range->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. - 1 == value) |
| 212 | new_range.firstcxx . . $ range_t#first.--; |
| 213 | else return rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).(); |
| 214 | rangescxx . . $ range_set#ranges..erasecxx . . $ std/set#erase(36a7984e631cd3e9).(range); |
| 215 | return rangescxx . . $ range_set#ranges..emplacecxx . . $ std/set#emplace(f53bd0b00b9290a8).(new_range).firstcxx . . $ std/pair#first.; |
| 216 | } |
| 217 | /** Add the range in the ranges set |
| 218 | @param[in] new_range range to be added */ |
| 219 | void add_rangecxx . . $ range_set#add_range(1e1b818b5131e79f).(range_tcxx . . $ range_t# new_range) |
| 220 | { |
| 221 | auto r_offset= rangescxx . . $ range_set#ranges..lower_boundcxx . . $ std/set#lower_bound(f8922f46a681e6cc).(new_range); |
| 222 | auto r_begin= rangescxx . . $ range_set#ranges..begincxx . . $ std/set#begin(3220b82c0db6d2a1).(); |
| 223 | auto r_end= rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).(); |
| 224 | if (!rangescxx . . $ range_set#ranges..sizecxx . . $ std/set#size(fa801f5ac5d26b4e).()) |
| 225 | { |
| 226 | new_range: |
| 227 | rangescxx . . $ range_set#ranges..emplacecxx . . $ std/set#emplace(f53bd0b00b9290a8).(new_range); |
| 228 | return; |
| 229 | } |
| 230 | |
| 231 | if (r_offset ==cxx . . $ std/`operator==`(a84eb84a7a5e8237). r_end) |
| 232 | { |
| 233 | /* last range */ |
| 234 | if (add_within_rangecxx . . $ range_set#add_within_range(d00544960b4dede3).(stdcxx . . $ std/::prevcxx . . $ std/prev(31d62cd24490f169).(r_offset), new_range.firstcxx . . $ range_t#first.) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237). r_end) |
| 235 | goto new_range; |
| 236 | } |
| 237 | else if (r_offset ==cxx . . $ std/`operator==`(a84eb84a7a5e8237). r_begin) |
| 238 | { |
| 239 | /* First range */ |
| 240 | if (add_within_rangecxx . . $ range_set#add_within_range(d00544960b4dede3).(r_offset, new_range.firstcxx . . $ range_t#first.) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237). r_end) |
| 241 | goto new_range; |
| 242 | } |
| 243 | else if (r_offset->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ range_t#first. - 1 == new_range.firstcxx . . $ range_t#first.) |
| 244 | { |
| 245 | /* Change starting of the existing range */ |
| 246 | auto r_value= add_within_rangecxx . . $ range_set#add_within_range(d00544960b4dede3).(r_offset, new_range.firstcxx . . $ range_t#first.); |
| 247 | if (r_value !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). rangescxx . . $ range_set#ranges..begincxx . . $ std/set#begin(3220b82c0db6d2a1).()) |
| 248 | merge_rangecxx . . $ range_set#merge_range(a659c7b9a23795dc).(r_value, stdcxx . . $ std/::prevcxx . . $ std/prev(31d62cd24490f169).(r_value)); |
| 249 | } |
| 250 | else |
| 251 | { |
| 252 | /* previous range last_value alone */ |
| 253 | if (add_within_rangecxx . . $ range_set#add_within_range(d00544960b4dede3).(stdcxx . . $ std/::prevcxx . . $ std/prev(31d62cd24490f169).(r_offset), new_range.firstcxx . . $ range_t#first.) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237). r_end) |
| 254 | goto new_range; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | /** Add the value in the ranges |
| 259 | @param[in] value value to be added */ |
| 260 | void add_valuecxx . . $ range_set#add_value(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# value) |
| 261 | { |
| 262 | range_tcxx . . $ range_t# new_range{value, value}; |
| 263 | add_rangecxx . . $ range_set#add_range(1e1b818b5131e79f).(new_range); |
| 264 | } |
| 265 | |
| 266 | bool remove_if_existscxx . . $ range_set#remove_if_exists(dfa6e707f7696010).(uint32_tcxx . . $ uint32_t# value) |
| 267 | { |
| 268 | auto r_offset= findcxx . . $ range_set#find(a8ab509452734fe7).(value); |
| 269 | if (r_offset !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).()) |
| 270 | { |
| 271 | remove_within_rangecxx . . $ range_set#remove_within_range(7bfb09ac0a34e530).(r_offset, value); |
| 272 | return true; |
| 273 | } |
| 274 | return false; |
| 275 | } |
| 276 | |
| 277 | bool containscxx . . $ range_set#contains(8de63fdb265b07c1).(uint32_tcxx . . $ uint32_t# value) const |
| 278 | { |
| 279 | return findcxx . . $ range_set#find(a8ab509452734fe7).(value) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).(); |
| 280 | } |
| 281 | |
| 282 | ulintcxx . . $ ulint# sizecxx . . $ range_set#size(f708dce9a8856c70).() { return rangescxx . . $ range_set#ranges..sizecxx . . $ std/set#size(fa801f5ac5d26b4e).(); } |
| 283 | void clearcxx . . $ range_set#clear(49f6e7a06ebc5aa8).() { rangescxx . . $ range_set#ranges..clearcxx . . $ std/set#clear(ced63f7c635d850d).(); } |
| 284 | bool emptycxx . . $ range_set#empty(50ce9a9e25b4a850).() const { return rangescxx . . $ range_set#ranges..emptycxx . . $ std/set#empty(3482b152b9333168).(); } |
| 285 | typename range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# begincxx . . $ range_set#begin(eff94ae6f5a5e128).() { return rangescxx . . $ range_set#ranges..begincxx . . $ std/set#begin(3220b82c0db6d2a1).(); } |
| 286 | typename range_set_tcxx . . $ range_set_t#::iteratorcxx . . $ std/set#iterator# endcxx . . $ range_set#end(eff94ae6f5a5e128).() { return rangescxx . . $ range_set#ranges..endcxx . . $ std/set#end(3220b82c0db6d2a1).(); } |
| 287 | }; |
| 288 | #endif |
| 289 | |
| 290 | /** Tablespace or log data space */ |
| 291 | #ifndef UNIV_INNOCHECKSUMcxx . . $ `<built-in>:481:9`! |
| 292 | struct fil_io_tcxx . . $ fil_io_t# |
| 293 | { |
| 294 | /** error code */ |
| 295 | dberr_tcxx . . $ dberr_t# errcxx . . $ fil_io_t#err.; |
| 296 | /** file; node->space->release() must follow IORequestRead call */ |
| 297 | fil_node_tcxx . . $ fil_node_t# *nodecxx . . $ fil_io_t#node.; |
| 298 | }; |
| 299 | |
| 300 | /** Tablespace encryption mode */ |
| 301 | enum fil_encryption_tcxx . . $ fil_encryption_t# |
| 302 | { |
| 303 | /** Encrypted if innodb_encrypt_tables=ON (srv_encrypt_tables) */ |
| 304 | FIL_ENCRYPTION_DEFAULTcxx . . $ FIL_ENCRYPTION_DEFAULT., |
| 305 | /** Encrypted */ |
| 306 | FIL_ENCRYPTION_ONcxx . . $ FIL_ENCRYPTION_ON., |
| 307 | /** Not encrypted */ |
| 308 | FIL_ENCRYPTION_OFFcxx . . $ FIL_ENCRYPTION_OFF. |
| 309 | }; |
| 310 | |
| 311 | struct fil_space_tcxx . . $ fil_space_t# final : ilist_nodecxx . . $ ilist_node#<unflushed_spaces_tag_tcxx . . $ unflushed_spaces_tag_t#>, |
| 312 | ilist_nodecxx . . $ ilist_node#<default_encrypt_tag_tcxx . . $ default_encrypt_tag_t#>, |
| 313 | ilist_nodecxx . . $ ilist_node#<space_list_tag_tcxx . . $ space_list_tag_t#>, |
| 314 | ilist_nodecxx . . $ ilist_node#<named_spaces_tag_tcxx . . $ named_spaces_tag_t#> |
| 315 | #else |
| 316 | struct fil_space_tcxx . . $ fil_space_t# final |
| 317 | #endif |
| 318 | { |
| 319 | #ifndef UNIV_INNOCHECKSUMcxx . . $ `<built-in>:481:9`! |
| 320 | friend fil_node_tcxx . . $ fil_node_t#; |
| 321 | |
| 322 | /** Constructor; see @fil_space_t::create() */ |
| 323 | inline explicit fil_space_tcxx . . $ fil_space_t#fil_space_t(d2b817edc93e47c).(uint32_tcxx . . $ uint32_t# id, uint32_tcxx . . $ uint32_t# flags, bool being_imported, |
| 324 | fil_space_crypt_tcxx . . $ fil_space_crypt_t# *crypt_data) noexcept; |
| 325 | |
| 326 | ~cxx . . $ fil_space_t#`~fil_space_t`(ced63f7c635d850d).fil_space_tcxx . . $ fil_space_t#() |
| 327 | { |
| 328 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!latch_owner); |
| 329 | latchcxx . . $ fil_space_t#latch..destroycxx . . $ srw_lock_impl#destroy(ced63f7c635d850d).(); |
| 330 | } |
| 331 | |
| 332 | /** tablespace identifier */ |
| 333 | uint32_tcxx . . $ uint32_t# idcxx . . $ fil_space_t#id.; |
| 334 | |
| 335 | /** fil_system.spaces chain node */ |
| 336 | fil_space_tcxx . . $ fil_space_t# *hashcxx . . $ fil_space_t#hash.= nullptr; |
| 337 | /** log_sys.get_lsn() of the most recent fil_names_write_if_was_clean(). |
| 338 | Reset to 0 by fil_names_clear(). Protected by log_sys.latch_have_wr(). |
| 339 | If and only if this is nonzero, the tablespace will be in named_spaces. */ |
| 340 | lsn_tcxx . . $ lsn_t# max_lsncxx . . $ fil_space_t#max_lsn.= 0; |
| 341 | /** base node for the chain of data files; multiple entries are |
| 342 | only possible for is_temporary() or id==0 */ |
| 343 | UT_LIST_BASE_NODE_Tcxx . . $ `storage/innobase/include/ut0lst.h:93:9`!(fil_node_t) chaincxx . . $ fil_space_t#chain.; |
| 344 | /** tablespace size in pages; 0 if not determined yet */ |
| 345 | uint32_tcxx . . $ uint32_t# sizecxx . . $ fil_space_t#size.= 0; |
| 346 | /** FSP_SIZE in the tablespace header; 0 if not determined yet */ |
| 347 | uint32_tcxx . . $ uint32_t# size_in_headercxx . . $ fil_space_t#size_in_header.= 0; |
| 348 | /** length of the FSP_FREE list */ |
| 349 | uint32_tcxx . . $ uint32_t# free_lencxx . . $ fil_space_t#free_len.= 0; |
| 350 | /** contents of FSP_FREE_LIMIT */ |
| 351 | uint32_tcxx . . $ uint32_t# free_limitcxx . . $ fil_space_t#free_limit.= 0; |
| 352 | /** recovered tablespace size in pages; 0 if no size change was read |
| 353 | from the redo log, or if the size change was applied */ |
| 354 | uint32_tcxx . . $ uint32_t# recv_sizecxx . . $ fil_space_t#recv_size.= 0; |
| 355 | /** number of reserved free extents for ongoing operations like |
| 356 | B-tree page split */ |
| 357 | uint32_tcxx . . $ uint32_t# n_reserved_extentscxx . . $ fil_space_t#n_reserved_extents.= 0; |
| 358 | private: |
| 359 | #ifdef UNIV_DEBUG |
| 360 | fil_space_t *next_in_space_list() noexcept; |
| 361 | fil_space_t *prev_in_space_list() noexcept; |
| 362 | |
| 363 | fil_space_t *next_in_unflushed_spaces() noexcept; |
| 364 | fil_space_t *prev_in_unflushed_spaces() noexcept; |
| 365 | #endif |
| 366 | |
| 367 | /** the committed size of the tablespace in pages */ |
| 368 | Atomic_relaxedcxx . . $ Atomic_relaxed#<uint32_tcxx . . $ uint32_t#> committed_sizecxx . . $ fil_space_t#committed_size.{cxx . . $ Atomic_relaxed#Atomic_relaxed(9b289cee16747614).0}; |
| 369 | /** Number of pending operations on the file. |
| 370 | The tablespace cannot be freed while (n_pending & PENDING) != 0. */ |
| 371 | stdcxx . . $ std/::atomiccxx . . $ std/atomic#<uint32_tcxx . . $ uint32_t#> n_pendingcxx . . $ fil_space_t#n_pending.{cxx . . $ std/atomic#atomic(6bab9b75950d6f3).CLOSINGcxx . . $ fil_space_t#CLOSING.}; |
| 372 | /** Flag in n_pending that indicates that the tablespace is about to be |
| 373 | deleted, and no further operations should be performed */ |
| 374 | static constexpr uint32_tcxx . . $ uint32_t# STOPPING_READScxx . . $ fil_space_t#STOPPING_READS.= 1U << 31; |
| 375 | /** Flag in n_pending that indicates that the tablespace is being |
| 376 | deleted, and no further operations should be performed */ |
| 377 | static constexpr uint32_tcxx . . $ uint32_t# STOPPING_WRITEScxx . . $ fil_space_t#STOPPING_WRITES.= 1U << 30; |
| 378 | /** Flags in n_pending that indicate that the tablespace is being |
| 379 | deleted, and no further operations should be performed */ |
| 380 | static constexpr uint32_tcxx . . $ uint32_t# STOPPINGcxx . . $ fil_space_t#STOPPING.= STOPPING_READScxx . . $ fil_space_t#STOPPING_READS. | STOPPING_WRITEScxx . . $ fil_space_t#STOPPING_WRITES.; |
| 381 | /** Flag in n_pending that indicates that the tablespace is a candidate |
| 382 | for being closed, and fil_node_t::is_open() can only be trusted after |
| 383 | acquiring fil_system.mutex and resetting the flag */ |
| 384 | static constexpr uint32_tcxx . . $ uint32_t# CLOSINGcxx . . $ fil_space_t#CLOSING.= 1U << 29; |
| 385 | /** Flag in n_pending that indicates that the tablespace needs fsync(). |
| 386 | This must be the least significant flag bit; @see release_flush() */ |
| 387 | static constexpr uint32_tcxx . . $ uint32_t# NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC.= 1U << 28; |
| 388 | /** The reference count */ |
| 389 | static constexpr uint32_tcxx . . $ uint32_t# PENDINGcxx . . $ fil_space_t#PENDING.= ~(STOPPINGcxx . . $ fil_space_t#STOPPING. | CLOSINGcxx . . $ fil_space_t#CLOSING. | NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC.); |
| 390 | /** latch protecting all page allocation bitmap pages */ |
| 391 | IF_DBUGcxx . . $ srw_lock#(srw_lock_debug, srw_lock) latchcxx . . $ fil_space_t#latch.; |
| 392 | /** the thread that holds the exclusive latch, or 0 */ |
| 393 | pthread_tcxx . . $ pthread_t# latch_ownercxx . . $ fil_space_t#latch_owner.= 0; |
| 394 | public: |
| 395 | /** MariaDB encryption data */ |
| 396 | fil_space_crypt_tcxx . . $ fil_space_crypt_t# *crypt_datacxx . . $ fil_space_t#crypt_data.= nullptr; |
| 397 | |
| 398 | /** Whether needs_flush(), or this is in fil_system.unflushed_spaces */ |
| 399 | bool is_in_unflushed_spacescxx . . $ fil_space_t#is_in_unflushed_spaces.= false; |
| 400 | |
| 401 | /** Whether this in fil_system.default_encrypt_tables (needs key rotation) */ |
| 402 | bool is_in_default_encryptcxx . . $ fil_space_t#is_in_default_encrypt.= false; |
| 403 | |
| 404 | private: |
| 405 | /** Whether the tablespace is being imported */ |
| 406 | bool being_importedcxx . . $ fil_space_t#being_imported.= false; |
| 407 | |
| 408 | /** Whether any corrupton of this tablespace has been reported */ |
| 409 | mutable stdcxx . . $ std/::atomic_flagcxx . . $ std/atomic_flag# is_corruptedcxx . . $ fil_space_t#is_corrupted.=cxx . . $ std/atomic_flag#atomic_flag(9f0ba574c1c44ffc). ATOMIC_FLAG_INITcxx . . $ `<external>/8319222351776686999/atomic_base.h:208:9`!; |
| 410 | |
| 411 | public: |
| 412 | /** mutex to protect freed_ranges and last_freed_lsn */ |
| 413 | stdcxx . . $ std/::mutexcxx . . $ std/mutex# freed_range_mutexcxx . . $ fil_space_t#freed_range_mutex.; |
| 414 | private: |
| 415 | /** Ranges of freed page numbers; protected by freed_range_mutex */ |
| 416 | range_setcxx . . $ range_set# freed_rangescxx . . $ fil_space_t#freed_ranges.; |
| 417 | |
| 418 | /** LSN of freeing last page; protected by freed_range_mutex */ |
| 419 | lsn_tcxx . . $ lsn_t# last_freed_lsncxx . . $ fil_space_t#last_freed_lsn.= 0; |
| 420 | |
| 421 | /** LSN of undo tablespace creation or 0; protected by latch */ |
| 422 | lsn_tcxx . . $ lsn_t# create_lsncxx . . $ fil_space_t#create_lsn.= 0; |
| 423 | public: |
| 424 | /** @return whether this is the temporary tablespace */ |
| 425 | bool is_temporarycxx . . $ fil_space_t#is_temporary(3482b152b9333168).() const noexcept |
| 426 | { return UNIV_UNLIKELYcxx . . $ SRV_TMP_SPACE_ID.(id == SRV_TMP_SPACE_ID); } |
| 427 | /** @return whether this tablespace is being imported */ |
| 428 | bool is_being_importedcxx . . $ fil_space_t#is_being_imported(3482b152b9333168).() const noexcept |
| 429 | { return UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(being_imported); } |
| 430 | |
| 431 | /** @return whether doublewrite buffering is needed */ |
| 432 | inline bool use_doublewritecxx . . $ fil_space_t#use_doublewrite(3482b152b9333168).() const noexcept; |
| 433 | |
| 434 | /** @return whether a page has been freed */ |
| 435 | inline bool is_freedcxx . . $ fil_space_t#is_freed(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# page) noexcept; |
| 436 | |
| 437 | /** Set create_lsn. */ |
| 438 | inline void set_create_lsncxx . . $ fil_space_t#set_create_lsn(203741fbd813a59e).(lsn_tcxx . . $ lsn_t# lsn) noexcept; |
| 439 | |
| 440 | /** @return the latest tablespace rebuild LSN, or 0 */ |
| 441 | lsn_tcxx . . $ lsn_t# get_create_lsncxx . . $ fil_space_t#get_create_lsn(c9b1e749b64d5edc).() const noexcept { return create_lsncxx . . $ fil_space_t#create_lsn.; } |
| 442 | |
| 443 | /** Apply freed_ranges to the file. |
| 444 | @param writable whether the file is writable |
| 445 | @return number of pages written or hole-punched */ |
| 446 | uint32_tcxx . . $ uint32_t# flush_freedcxx . . $ fil_space_t#flush_freed(a61c8a0592660aaf).(bool writable) noexcept; |
| 447 | |
| 448 | /** Append a file to the chain of files of a space. |
| 449 | @param[in] name file name of a file that is not open |
| 450 | @param[in] handle file handle, or OS_FILE_CLOSED |
| 451 | @param[in] size file size in entire database pages |
| 452 | @param[in] is_raw whether this is a raw device |
| 453 | @param[in] atomic_write true if atomic write could be enabled |
| 454 | @param[in] max_pages maximum number of pages in file, |
| 455 | or UINT32_MAX for unlimited |
| 456 | @return file object */ |
| 457 | fil_node_tcxx . . $ fil_node_t#* addcxx . . $ fil_space_t#add(6a6aa7e3155b8dbc).(const char* name, pfs_os_file_tcxx . . $ pfs_os_file_t# handle, |
| 458 | uint32_tcxx . . $ uint32_t# size, bool is_raw, bool atomic_write, |
| 459 | uint32_tcxx . . $ uint32_t# max_pages = UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`!) noexcept; |
| 460 | #ifdef UNIV_DEBUG |
| 461 | /** Assert that the mini-transaction is compatible with |
| 462 | updating an allocation bitmap page. |
| 463 | @param[in] mtr mini-transaction */ |
| 464 | void modify_check(const mtr_t& mtr) const; |
| 465 | #endif /* UNIV_DEBUG */ |
| 466 | |
| 467 | /** Try to reserve free extents. |
| 468 | @param[in] n_free_now current number of free extents |
| 469 | @param[in] n_to_reserve number of extents to reserve |
| 470 | @return whether the reservation succeeded */ |
| 471 | bool reserve_free_extentscxx . . $ fil_space_t#reserve_free_extents(d92a6f4903462276).(uint32_tcxx . . $ uint32_t# n_free_now, uint32_tcxx . . $ uint32_t# n_to_reserve) |
| 472 | noexcept |
| 473 | { |
| 474 | if (n_reserved_extentscxx . . $ fil_space_t#n_reserved_extents. + n_to_reserve > n_free_now) { |
| 475 | return false; |
| 476 | } |
| 477 | |
| 478 | n_reserved_extentscxx . . $ fil_space_t#n_reserved_extents. += n_to_reserve; |
| 479 | return true; |
| 480 | } |
| 481 | |
| 482 | /** Release the reserved free extents. |
| 483 | @param[in] n_reserved number of reserved extents */ |
| 484 | void release_free_extentscxx . . $ fil_space_t#release_free_extents(6bab9b75950d6f3).(uint32_tcxx . . $ uint32_t# n_reserved) noexcept |
| 485 | { |
| 486 | if (!n_reserved) return; |
| 487 | ut_acxx . . $ ulint#(n_reserved_extents >= n_reserved); |
| 488 | n_reserved_extentscxx . . $ fil_space_t#n_reserved_extents. -= n_reserved; |
| 489 | } |
| 490 | |
| 491 | /** Rename a file. |
| 492 | @param[in] path tablespace file name after renaming |
| 493 | @param[in] log whether to write redo log |
| 494 | @param[in] replace whether to ignore the existence of path |
| 495 | @return error code |
| 496 | @retval DB_SUCCESS on success */ |
| 497 | dberr_tcxx . . $ dberr_t# renamecxx . . $ fil_space_t#rename(c6214e893540a3a2).(const char *path, bool log, bool replace= false) noexcept |
| 498 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((nonnull)); |
| 499 | |
| 500 | /** Note that the tablespace has been imported. |
| 501 | Initially, purpose=IMPORT so that no redo log is |
| 502 | written while the space ID is being updated in each page. */ |
| 503 | inline void set_importedcxx . . $ fil_space_t#set_imported(ced63f7c635d850d).() noexcept; |
| 504 | |
| 505 | /** Report the tablespace as corrupted |
| 506 | @return whether this was the first call */ |
| 507 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! bool set_corruptedcxx . . $ fil_space_t#set_corrupted(3482b152b9333168).() const noexcept; |
| 508 | |
| 509 | /** @return whether the storage device is rotational (HDD, not SSD) */ |
| 510 | inline bool is_rotationalcxx . . $ fil_space_t#is_rotational(3482b152b9333168).() const noexcept; |
| 511 | |
| 512 | /** Open each file. Never invoked on .ibd files. |
| 513 | @param create_new_db whether to skip the call to fil_node_t::read_page0() |
| 514 | @return whether all files were opened */ |
| 515 | bool opencxx . . $ fil_space_t#open(efaadfb7dc14930a).(bool create_new_db); |
| 516 | /** Close each file. Only invoked on fil_system.temp_space. */ |
| 517 | void closecxx . . $ fil_space_t#close(49f6e7a06ebc5aa8).(); |
| 518 | |
| 519 | /** Drop the tablespace and wait for any pending operations to cease |
| 520 | @param id tablespace identifier |
| 521 | @param detached_handle pointer to file to be closed later, or nullptr |
| 522 | @return tablespace to invoke fil_space_free() on |
| 523 | @retval nullptr if no tablespace was found, or it was deleted by |
| 524 | another concurrent thread */ |
| 525 | static fil_space_tcxx . . $ fil_space_t# *dropcxx . . $ fil_space_t#drop(eb7e459ba0454248).(uint32_tcxx . . $ uint32_t# id, pfs_os_file_tcxx . . $ pfs_os_file_t# *detached_handle); |
| 526 | |
| 527 | private: |
| 528 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 529 | /** Try to acquire a tablespace reference (increment referenced()). |
| 530 | @param avoid when these flags are set, nothing will be acquired |
| 531 | @return the old reference count */ |
| 532 | uint32_tcxx . . $ uint32_t# acquire_lowcxx . . $ fil_space_t#acquire_low(2141b656ce2cc063).(uint32_tcxx . . $ uint32_t# avoid= STOPPINGcxx . . $ fil_space_t#STOPPING.) |
| 533 | { |
| 534 | uint32_tcxx . . $ uint32_t# n= 0; |
| 535 | while (!n_pendingcxx . . $ fil_space_t#n_pending..compare_exchange_strongcxx . . $ std/__atomic_base#compare_exchange_strong(747dd5cfc7d0fd78).(n, n + 1, |
| 536 | stdcxx . . $ std/::memory_order_acquirecxx . . $ std/memory_order_acquire., |
| 537 | stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.) && |
| 538 | !(n & avoid)); |
| 539 | return n; |
| 540 | } |
| 541 | public: |
| 542 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 543 | /** Acquire a tablespace reference. |
| 544 | @return whether a tablespace reference was successfully acquired */ |
| 545 | inline bool acquire_if_not_stoppedcxx . . $ fil_space_t#acquire_if_not_stopped(c9857a73d68e59ba).(); |
| 546 | |
| 547 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 548 | /** Acquire a tablespace reference for I/O. |
| 549 | @param avoid when these flags are set, nothing will be acquired |
| 550 | @return whether the file is usable */ |
| 551 | bool acquirecxx . . $ fil_space_t#acquire(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# avoid= STOPPINGcxx . . $ fil_space_t#STOPPING. | CLOSINGcxx . . $ fil_space_t#CLOSING.) noexcept |
| 552 | { |
| 553 | const auto flags= acquire_lowcxx . . $ fil_space_t#acquire_low(2141b656ce2cc063).(avoid) & (avoid); |
| 554 | return UNIV_LIKELYcxx . . $ `storage/innobase/include/univ.i:437:9`!(!flags) || (flags == CLOSINGcxx . . $ fil_space_t#CLOSING. && acquire_and_preparecxx . . $ fil_space_t#acquire_and_prepare(77ce49a7840d23c7).()); |
| 555 | } |
| 556 | |
| 557 | /** Acquire a tablespace reference for writing. |
| 558 | @param avoid when these flags are set, nothing will be acquired |
| 559 | @return whether the file is writable */ |
| 560 | bool acquire_for_writecxx . . $ fil_space_t#acquire_for_write(77ce49a7840d23c7).() noexcept |
| 561 | { return acquirecxx . . $ fil_space_t#acquire(ad254478a19226f0).(STOPPING_WRITEScxx . . $ fil_space_t#STOPPING_WRITES. | CLOSINGcxx . . $ fil_space_t#CLOSING.); } |
| 562 | |
| 563 | /** Acquire another tablespace reference for I/O. */ |
| 564 | inline void reacquirecxx . . $ fil_space_t#reacquire(ced63f7c635d850d).() noexcept; |
| 565 | |
| 566 | /** Release a tablespace reference. |
| 567 | @return whether this was the last reference */ |
| 568 | bool releasecxx . . $ fil_space_t#release(77ce49a7840d23c7).() noexcept |
| 569 | { |
| 570 | uint32_tcxx . . $ uint32_t# n= n_pendingcxx . . $ fil_space_t#n_pending..fetch_subcxx . . $ std/__atomic_base#fetch_sub(8de7200f212ddeb7).(1, stdcxx . . $ std/::memory_order_releasecxx . . $ std/memory_order_release.); |
| 571 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(n & PENDING); |
| 572 | return (n & PENDINGcxx . . $ fil_space_t#PENDING.) == 1; |
| 573 | } |
| 574 | |
| 575 | /** Clear the NEEDS_FSYNC flag */ |
| 576 | void clear_flushcxx . . $ fil_space_t#clear_flush(ced63f7c635d850d).() noexcept |
| 577 | { |
| 578 | n_pendingcxx . . $ fil_space_t#n_pending..fetch_andcxx . . $ std/__atomic_base#fetch_and(8de7200f212ddeb7).(~NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC., stdcxx . . $ std/::memory_order_releasecxx . . $ std/memory_order_release.); |
| 579 | } |
| 580 | |
| 581 | /** Set the STOPPING flags when creating a file, |
| 582 | to block premature fil_crypt_find_space_to_rotate() */ |
| 583 | inline void set_stoppedcxx . . $ fil_space_t#set_stopped(ced63f7c635d850d).() noexcept |
| 584 | { |
| 585 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(uint32_t n=) |
| 586 | n_pendingcxx . . $ fil_space_t#n_pending..fetch_addcxx . . $ std/__atomic_base#fetch_add(8de7200f212ddeb7).(STOPPINGcxx . . $ fil_space_t#STOPPING. + 1, stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.); |
| 587 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(n == CLOSING); |
| 588 | } |
| 589 | |
| 590 | /** Clear the STOPPING flags after creating a file */ |
| 591 | inline void clear_stoppedcxx . . $ fil_space_t#clear_stopped(ced63f7c635d850d).() noexcept |
| 592 | { |
| 593 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(uint32_t n=) |
| 594 | n_pendingcxx . . $ fil_space_t#n_pending..fetch_subcxx . . $ std/__atomic_base#fetch_sub(8de7200f212ddeb7).(STOPPINGcxx . . $ fil_space_t#STOPPING. + CLOSINGcxx . . $ fil_space_t#CLOSING. + 1, stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.); |
| 595 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(n & PENDING); |
| 596 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!((n & ~PENDING) == (STOPPING | CLOSING)); |
| 597 | } |
| 598 | |
| 599 | private: |
| 600 | /** Clear the CLOSING flag */ |
| 601 | void clear_closingcxx . . $ fil_space_t#clear_closing(ced63f7c635d850d).() noexcept |
| 602 | { |
| 603 | n_pendingcxx . . $ fil_space_t#n_pending..fetch_andcxx . . $ std/__atomic_base#fetch_and(8de7200f212ddeb7).(~CLOSINGcxx . . $ fil_space_t#CLOSING., stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.); |
| 604 | } |
| 605 | |
| 606 | /** @return pending operations (and flags) */ |
| 607 | uint32_tcxx . . $ uint32_t# pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() const noexcept |
| 608 | { return n_pendingcxx . . $ fil_space_t#n_pending..loadcxx . . $ std/__atomic_base#load(1776886d83107284).(stdcxx . . $ std/::memory_order_acquirecxx . . $ std/memory_order_acquire.); } |
| 609 | public: |
| 610 | /** @return whether close() of the file handle has been requested */ |
| 611 | bool is_closingcxx . . $ fil_space_t#is_closing(3482b152b9333168).() const noexcept { return pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & CLOSINGcxx . . $ fil_space_t#CLOSING.; } |
| 612 | /** @return whether the tablespace is about to be dropped */ |
| 613 | bool is_stoppingcxx . . $ fil_space_t#is_stopping(3482b152b9333168).() const noexcept { return pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & STOPPINGcxx . . $ fil_space_t#STOPPING.; } |
| 614 | /** @return whether the tablespace is going to be dropped */ |
| 615 | bool is_stopping_writescxx . . $ fil_space_t#is_stopping_writes(3482b152b9333168).() const noexcept |
| 616 | { return pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & STOPPING_WRITEScxx . . $ fil_space_t#STOPPING_WRITES.; } |
| 617 | /** @return number of pending operations */ |
| 618 | bool is_ready_to_closecxx . . $ fil_space_t#is_ready_to_close(3482b152b9333168).() const noexcept |
| 619 | { return (pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & (PENDINGcxx . . $ fil_space_t#PENDING. | CLOSINGcxx . . $ fil_space_t#CLOSING.)) == CLOSINGcxx . . $ fil_space_t#CLOSING.; } |
| 620 | /** @return whether fsync() or similar is needed */ |
| 621 | bool needs_flushcxx . . $ fil_space_t#needs_flush(3482b152b9333168).() const noexcept { return pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC.; } |
| 622 | /** @return whether fsync() or similar is needed, and the tablespace is |
| 623 | not being dropped */ |
| 624 | bool needs_flush_not_stoppingcxx . . $ fil_space_t#needs_flush_not_stopping(3482b152b9333168).() const noexcept |
| 625 | { return (pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & (NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC. | STOPPING_WRITEScxx . . $ fil_space_t#STOPPING_WRITES.)) == NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC.; } |
| 626 | |
| 627 | uint32_tcxx . . $ uint32_t# referencedcxx . . $ fil_space_t#referenced(d22c8608b6eae7b5).() const noexcept { return pendingcxx . . $ fil_space_t#pending(d22c8608b6eae7b5).() & PENDINGcxx . . $ fil_space_t#PENDING.; } |
| 628 | private: |
| 629 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 630 | /** Prepare to close the file handle. |
| 631 | @return number of pending operations, possibly with NEEDS_FSYNC flag */ |
| 632 | uint32_tcxx . . $ uint32_t# set_closingcxx . . $ fil_space_t#set_closing(2658d6455debfaef).() noexcept |
| 633 | { |
| 634 | return n_pendingcxx . . $ fil_space_t#n_pending..fetch_orcxx . . $ std/__atomic_base#fetch_or(8de7200f212ddeb7).(CLOSINGcxx . . $ fil_space_t#CLOSING., stdcxx . . $ std/::memory_order_acquirecxx . . $ std/memory_order_acquire.); |
| 635 | } |
| 636 | |
| 637 | public: |
| 638 | /** Reopen all files on set_write_through() or set_buffered(). */ |
| 639 | static void reopen_allcxx . . $ fil_space_t#reopen_all(49f6e7a06ebc5aa8).(); |
| 640 | /** Try to close a file to adhere to the innodb_open_files limit. |
| 641 | @param ignore_space Ignore the tablespace which is acquired by caller |
| 642 | @param print_info whether to diagnose why a file cannot be closed |
| 643 | @return whether a file was closed */ |
| 644 | static bool try_to_closecxx . . $ fil_space_t#try_to_close(a534a75ba06473a7).(fil_space_tcxx . . $ fil_space_t# *ignore_space, bool print_info) |
| 645 | noexcept; |
| 646 | |
| 647 | /** Close all tablespace files at shutdown */ |
| 648 | static void close_allcxx . . $ fil_space_t#close_all(ced63f7c635d850d).() noexcept; |
| 649 | |
| 650 | /** Update last_freed_lsn */ |
| 651 | void update_last_freed_lsncxx . . $ fil_space_t#update_last_freed_lsn(2c44cd906ae4e829).(lsn_tcxx . . $ lsn_t# lsn) { last_freed_lsncxx . . $ fil_space_t#last_freed_lsn.= lsn; } |
| 652 | |
| 653 | /** Note that the file will need fsync(). |
| 654 | @return whether this needs to be added to fil_system.unflushed_spaces */ |
| 655 | bool set_needs_flushcxx . . $ fil_space_t#set_needs_flush(77ce49a7840d23c7).() noexcept |
| 656 | { |
| 657 | uint32_tcxx . . $ uint32_t# n= 1; |
| 658 | while (!n_pendingcxx . . $ fil_space_t#n_pending..compare_exchange_strongcxx . . $ std/__atomic_base#compare_exchange_strong(747dd5cfc7d0fd78).(n, n | NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC., |
| 659 | stdcxx . . $ std/::memory_order_acquirecxx . . $ std/memory_order_acquire., |
| 660 | stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.)) |
| 661 | { |
| 662 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(n & PENDING); |
| 663 | if (n & (NEEDS_FSYNCcxx . . $ fil_space_t#NEEDS_FSYNC. | STOPPING_WRITEScxx . . $ fil_space_t#STOPPING_WRITES.)) |
| 664 | return false; |
| 665 | } |
| 666 | |
| 667 | return true; |
| 668 | } |
| 669 | |
| 670 | /** Clear all freed ranges for undo tablespace when InnoDB |
| 671 | encounters TRIM redo log record */ |
| 672 | void clear_freed_rangescxx . . $ fil_space_t#clear_freed_ranges(ced63f7c635d850d).() noexcept { freed_rangescxx . . $ fil_space_t#freed_ranges..clearcxx . . $ range_set#clear(49f6e7a06ebc5aa8).(); } |
| 673 | #endif /* !UNIV_INNOCHECKSUM */ |
| 674 | /** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags; |
| 675 | check fsp0types.h to more info about flags. */ |
| 676 | uint32_tcxx . . $ uint32_t# flagscxx . . $ fil_space_t#flags.; |
| 677 | |
| 678 | /** Determine if full_crc32 is used for a data file |
| 679 | @param[in] flags tablespace flags (FSP_SPACE_FLAGS) |
| 680 | @return whether the full_crc32 algorithm is active */ |
| 681 | static bool full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 682 | { return flags & FSP_FLAGS_FCRC32_MASK_MARKERcxx . . $ `storage/innobase/include/fsp0types.h:344:9`!; } |
| 683 | /** @return whether innodb_checksum_algorithm=full_crc32 is active */ |
| 684 | bool full_crc32cxx . . $ fil_space_t#full_crc32(3482b152b9333168).() const noexcept { return full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flagscxx . . $ fil_space_t#flags.); } |
| 685 | /** Determine if full_crc32 is used along with PAGE_COMPRESSED */ |
| 686 | static bool is_full_crc32_compressedcxx . . $ fil_space_t#is_full_crc32_compressed(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 687 | { |
| 688 | if (!full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags)) |
| 689 | return false; |
| 690 | auto algo= FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGOcxx . . $ `storage/innobase/include/fsp0types.h:382:9`!(flags); |
| 691 | DBUG_ASSERTcxx . . $ `include/my_dbug.h:207:9`!(algo <= PAGE_ALGORITHM_LAST); |
| 692 | return algo != 0; |
| 693 | } |
| 694 | /** Determine the logical page size. |
| 695 | @param flags tablespace flags (FSP_SPACE_FLAGS) |
| 696 | @return the logical page size |
| 697 | @retval 0 if the flags are invalid */ |
| 698 | static unsigned logical_sizecxx . . $ fil_space_t#logical_size(6e3776fd289463bb).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 699 | { |
| 700 | switch (full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags) |
| 701 | ? FSP_FLAGS_FCRC32_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:378:9`!(flags) |
| 702 | : FSP_FLAGS_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:366:9`!(flags)) { |
| 703 | case 3: return 4096; |
| 704 | case 4: return 8192; |
| 705 | case 5: return full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags) ? 16384 : 0; |
| 706 | case 0: return full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags) ? 0 : 16384; |
| 707 | case 6: return 32768; |
| 708 | case 7: return 65536; |
| 709 | default: return 0; |
| 710 | } |
| 711 | } |
| 712 | /** Determine the ROW_FORMAT=COMPRESSED page size. |
| 713 | @param flags tablespace flags (FSP_SPACE_FLAGS) |
| 714 | @return the ROW_FORMAT=COMPRESSED page size |
| 715 | @retval 0 if ROW_FORMAT=COMPRESSED is not used */ |
| 716 | static unsigned zip_sizecxx . . $ fil_space_t#zip_size(6e3776fd289463bb).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 717 | { |
| 718 | if (full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags)) |
| 719 | return 0; |
| 720 | const uint32_tcxx . . $ uint32_t# zip_ssize= FSP_FLAGS_GET_ZIP_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:358:9`!(flags); |
| 721 | return zip_ssize ? (UNIV_ZIP_SIZE_MINcxx . . $ `storage/innobase/include/univ.i:221:9`! >> 1) << zip_ssize : 0; |
| 722 | } |
| 723 | /** Determine the physical page size. |
| 724 | @param flags tablespace flags (FSP_SPACE_FLAGS) |
| 725 | @return the physical page size */ |
| 726 | static unsigned physical_sizecxx . . $ fil_space_t#physical_size(6e3776fd289463bb).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 727 | { |
| 728 | if (full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags)) |
| 729 | return logical_sizecxx . . $ fil_space_t#logical_size(6e3776fd289463bb).(flags); |
| 730 | |
| 731 | const uint32_tcxx . . $ uint32_t# zip_ssize= FSP_FLAGS_GET_ZIP_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:358:9`!(flags); |
| 732 | return zip_ssize |
| 733 | ? (UNIV_ZIP_SIZE_MINcxx . . $ `storage/innobase/include/univ.i:221:9`! >> 1) << zip_ssize |
| 734 | : unsigned(srv_page_sizecxx . . $ srv_page_size.); |
| 735 | } |
| 736 | |
| 737 | /** @return the ROW_FORMAT=COMPRESSED page size |
| 738 | @retval 0 if ROW_FORMAT=COMPRESSED is not used */ |
| 739 | unsigned zip_sizecxx . . $ fil_space_t#zip_size(d22c8608b6eae7b5).() const noexcept { return zip_sizecxx . . $ fil_space_t#zip_size(6e3776fd289463bb).(flagscxx . . $ fil_space_t#flags.); } |
| 740 | /** @return the physical page size */ |
| 741 | unsigned physical_sizecxx . . $ fil_space_t#physical_size(d22c8608b6eae7b5).() const noexcept { return physical_sizecxx . . $ fil_space_t#physical_size(6e3776fd289463bb).(flagscxx . . $ fil_space_t#flags.); } |
| 742 | |
| 743 | /** Check whether PAGE_COMPRESSED is enabled. |
| 744 | @param[in] flags tablespace flags */ |
| 745 | static bool is_compressedcxx . . $ fil_space_t#is_compressed(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 746 | { |
| 747 | return is_full_crc32_compressedcxx . . $ fil_space_t#is_full_crc32_compressed(ad254478a19226f0).(flags) || |
| 748 | FSP_FLAGS_HAS_PAGE_COMPRESSIONcxx . . $ `storage/innobase/include/fsp0types.h:374:9`!(flags); |
| 749 | } |
| 750 | /** @return whether the compression enabled for the tablespace. */ |
| 751 | bool is_compressedcxx . . $ fil_space_t#is_compressed(3482b152b9333168).() const noexcept { return is_compressedcxx . . $ fil_space_t#is_compressed(ad254478a19226f0).(flagscxx . . $ fil_space_t#flags.); } |
| 752 | |
| 753 | /** Get the compression algorithm for full crc32 format. |
| 754 | @param flags contents of FSP_SPACE_FLAGS |
| 755 | @return PAGE_COMPRESSED algorithm of full_crc32 tablespace |
| 756 | @retval 0 if not PAGE_COMPRESSED or not full_crc32 */ |
| 757 | static unsigned get_compression_algocxx . . $ fil_space_t#get_compression_algo(6e3776fd289463bb).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 758 | { |
| 759 | return full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags) |
| 760 | ? FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGOcxx . . $ `storage/innobase/include/fsp0types.h:382:9`!(flags) |
| 761 | : 0; |
| 762 | } |
| 763 | /** @return the page_compressed algorithm |
| 764 | @retval 0 if not page_compressed */ |
| 765 | unsigned get_compression_algocxx . . $ fil_space_t#get_compression_algo(d22c8608b6eae7b5).() const noexcept { return get_compression_algocxx . . $ fil_space_t#get_compression_algo(6e3776fd289463bb).(flagscxx . . $ fil_space_t#flags.); } |
| 766 | /** Determine if the page_compressed page contains an extra byte |
| 767 | for exact compressed stream length |
| 768 | @param flags contents of FSP_SPACE_FLAGS |
| 769 | @return whether the extra byte is needed */ |
| 770 | static bool full_crc32_page_compressed_lencxx . . $ fil_space_t#full_crc32_page_compressed_len(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 771 | { |
| 772 | DBUG_ASSERTcxx . . $ `include/my_dbug.h:207:9`!(full_crc32(flags)); |
| 773 | switch (get_compression_algocxx . . $ fil_space_t#get_compression_algo(6e3776fd289463bb).(flags)) { |
| 774 | case PAGE_LZ4_ALGORITHMcxx . . $ `storage/innobase/include/fsp0types.h:38:9`!: |
| 775 | case PAGE_LZO_ALGORITHMcxx . . $ `storage/innobase/include/fsp0types.h:39:9`!: |
| 776 | case PAGE_SNAPPY_ALGORITHMcxx . . $ `storage/innobase/include/fsp0types.h:42:9`!: |
| 777 | return true; |
| 778 | } |
| 779 | return false; |
| 780 | } |
| 781 | |
| 782 | /** Whether the full checksum matches with non full checksum flags. |
| 783 | @param flags contents of FSP_SPACE_FLAGS |
| 784 | @param expected expected flags |
| 785 | @return true if it is equivalent */ |
| 786 | static bool is_flags_full_crc32_equalcxx . . $ fil_space_t#is_flags_full_crc32_equal(d92a6f4903462276).(uint32_tcxx . . $ uint32_t# flags, uint32_tcxx . . $ uint32_t# expected) noexcept |
| 787 | { |
| 788 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(full_crc32(flags)); |
| 789 | uint32_tcxx . . $ uint32_t# fcrc32_psize= FSP_FLAGS_FCRC32_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:378:9`!(flags); |
| 790 | |
| 791 | if (full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(expected)) |
| 792 | /* The data file may have been created with a |
| 793 | different innodb_compression_algorithm. But |
| 794 | we only support one innodb_page_size for all files. */ |
| 795 | return fcrc32_psize == FSP_FLAGS_FCRC32_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:378:9`!(expected); |
| 796 | |
| 797 | uint32_tcxx . . $ uint32_t# non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:366:9`!(expected); |
| 798 | if (!non_fcrc32_psize) |
| 799 | return fcrc32_psize == 5; |
| 800 | return fcrc32_psize == non_fcrc32_psize; |
| 801 | } |
| 802 | |
| 803 | /** Whether old tablespace flags match full_crc32 flags. |
| 804 | @param flags contents of FSP_SPACE_FLAGS |
| 805 | @param expected expected flags |
| 806 | @return true if it is equivalent */ |
| 807 | static bool is_flags_non_full_crc32_equalcxx . . $ fil_space_t#is_flags_non_full_crc32_equal(d92a6f4903462276).(uint32_tcxx . . $ uint32_t# flags, uint32_tcxx . . $ uint32_t# expected) noexcept |
| 808 | { |
| 809 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!full_crc32(flags)); |
| 810 | if (!full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(expected)) |
| 811 | return false; |
| 812 | |
| 813 | uint32_tcxx . . $ uint32_t# non_fcrc32_psize= FSP_FLAGS_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:366:9`!(flags); |
| 814 | uint32_tcxx . . $ uint32_t# fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:378:9`!(expected); |
| 815 | |
| 816 | if (!non_fcrc32_psize) |
| 817 | return fcrc32_psize == 5; |
| 818 | return fcrc32_psize == non_fcrc32_psize; |
| 819 | } |
| 820 | |
| 821 | /** Whether both fsp flags are equivalent */ |
| 822 | static bool is_flags_equalcxx . . $ fil_space_t#is_flags_equal(d92a6f4903462276).(uint32_tcxx . . $ uint32_t# flags, uint32_tcxx . . $ uint32_t# expected) noexcept |
| 823 | { |
| 824 | if (!((flags ^ expected) & ~(1U << FSP_FLAGS_POS_RESERVEDcxx . . $ `storage/innobase/include/fsp0types.h:290:9`!))) |
| 825 | return true; |
| 826 | return full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags) |
| 827 | ? is_flags_full_crc32_equalcxx . . $ fil_space_t#is_flags_full_crc32_equal(d92a6f4903462276).(flags, expected) |
| 828 | : is_flags_non_full_crc32_equalcxx . . $ fil_space_t#is_flags_non_full_crc32_equal(d92a6f4903462276).(flags, expected); |
| 829 | } |
| 830 | |
| 831 | /** Validate the tablespace flags for full crc32 format. |
| 832 | @param flags contents of FSP_SPACE_FLAGS |
| 833 | @return whether the flags are correct in full crc32 format */ |
| 834 | static bool is_fcrc32_valid_flagscxx . . $ fil_space_t#is_fcrc32_valid_flags(ad254478a19226f0).(uint32_tcxx . . $ uint32_t# flags) noexcept |
| 835 | { |
| 836 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(flags & FSP_FLAGS_FCRC32_MASK_MARKER); |
| 837 | const ulintcxx . . $ ulint# page_ssize= physical_sizecxx . . $ fil_space_t#physical_size(6e3776fd289463bb).(flags); |
| 838 | if (page_ssize < 3 || page_ssize & 8) |
| 839 | return false; |
| 840 | flags >>= FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGOcxx . . $ `storage/innobase/include/fsp0types.h:306:9`!; |
| 841 | return flags <= PAGE_ALGORITHM_LASTcxx . . $ `storage/innobase/include/fsp0types.h:43:9`!; |
| 842 | } |
| 843 | /** Validate the tablespace flags. |
| 844 | @param flags contents of FSP_SPACE_FLAGS |
| 845 | @param is_ibd whether this is an .ibd file (not system tablespace) |
| 846 | @return whether the flags are correct */ |
| 847 | static bool is_valid_flagscxx . . $ fil_space_t#is_valid_flags(c534903ed7350fb0).(uint32_tcxx . . $ uint32_t# flags, bool is_ibd) noexcept |
| 848 | { |
| 849 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("fsp_flags_is_valid_failure", return false;); |
| 850 | if (full_crc32cxx . . $ fil_space_t#full_crc32(ad254478a19226f0).(flags)) |
| 851 | return is_fcrc32_valid_flagscxx . . $ fil_space_t#is_fcrc32_valid_flags(ad254478a19226f0).(flags); |
| 852 | |
| 853 | if (flags == 0) |
| 854 | return true; |
| 855 | if (~FSP_FLAGS_MASKcxx . . $ `storage/innobase/include/fsp0types.h:223:9`! & flags) |
| 856 | return false; |
| 857 | |
| 858 | if (FSP_FLAGS_MASK_ATOMIC_BLOBScxx . . $ `storage/innobase/include/fsp0types.h:318:9`! == |
| 859 | (flags & (FSP_FLAGS_MASK_POST_ANTELOPEcxx . . $ `storage/innobase/include/fsp0types.h:310:9`! | FSP_FLAGS_MASK_ATOMIC_BLOBScxx . . $ `storage/innobase/include/fsp0types.h:318:9`!))) |
| 860 | /* If the "atomic blobs" flag (indicating |
| 861 | ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag is set, then the |
| 862 | ROW_FORMAT!=REDUNDANT flag must also be set. */ |
| 863 | return false; |
| 864 | |
| 865 | /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag |
| 866 | of MySQL 5.6 and MariaDB 10.0, which we ignore. |
| 867 | In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20, |
| 868 | bits 10..14 would be nonzero 0bsssaa where sss is |
| 869 | nonzero PAGE_SSIZE (3, 4, 6, or 7) |
| 870 | and aa is ATOMIC_WRITES (not 0b11). */ |
| 871 | if (FSP_FLAGS_GET_RESERVEDcxx . . $ `storage/innobase/include/fsp0types.h:370:9`!(flags) & ~1U) |
| 872 | return false; |
| 873 | |
| 874 | const uint32_tcxx . . $ uint32_t# ssize= FSP_FLAGS_GET_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:366:9`!(flags); |
| 875 | if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) |
| 876 | /* the page_size is not between 4k and 64k; |
| 877 | 16k should be encoded as 0, not 5 */ |
| 878 | return false; |
| 879 | |
| 880 | const uint32_tcxx . . $ uint32_t# zssize= FSP_FLAGS_GET_ZIP_SSIZEcxx . . $ `storage/innobase/include/fsp0types.h:358:9`!(flags); |
| 881 | if (zssize == 0) |
| 882 | /* not ROW_FORMAT=COMPRESSED */; |
| 883 | else if (zssize > (ssize ? ssize : 5)) |
| 884 | /* Invalid KEY_BLOCK_SIZE */ |
| 885 | return false; |
| 886 | else if (~flags & |
| 887 | (FSP_FLAGS_MASK_POST_ANTELOPEcxx . . $ `storage/innobase/include/fsp0types.h:310:9`! | FSP_FLAGS_MASK_ATOMIC_BLOBScxx . . $ `storage/innobase/include/fsp0types.h:318:9`!)) |
| 888 | /* both these flags must set for ROW_FORMAT=COMPRESSED */ |
| 889 | return false; |
| 890 | |
| 891 | /* The flags do look valid. But, avoid misinterpreting |
| 892 | buggy MariaDB 10.1 format flags for |
| 893 | PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL={0,2,3} |
| 894 | as valid-looking PAGE_SSIZE if this is known to be |
| 895 | an .ibd file and we are using the default innodb_page_size=16k. */ |
| 896 | return(ssize == 0 || !is_ibd || srv_page_sizecxx . . $ srv_page_size. != UNIV_PAGE_SIZE_ORIGcxx . . $ `storage/innobase/include/univ.i:218:9`!); |
| 897 | } |
| 898 | |
| 899 | #ifndef UNIV_INNOCHECKSUMcxx . . $ `<built-in>:481:9`! |
| 900 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 901 | /** Create a tablespace in fil_system. |
| 902 | @param id tablespace identifier |
| 903 | @param flags tablespace flags |
| 904 | @param being_imported whether this is IMPORT TABLESPACE |
| 905 | @param crypt_data encryption information |
| 906 | @param mode encryption mode |
| 907 | @param opened whether the tablespace files are open |
| 908 | @return pointer to created tablespace, to be filled in with add() */ |
| 909 | static fil_space_tcxx . . $ fil_space_t# *createcxx . . $ fil_space_t#create(cde1c5f51b8ca16c).(uint32_tcxx . . $ uint32_t# id, uint32_tcxx . . $ uint32_t# flags, bool being_imported, |
| 910 | fil_space_crypt_tcxx . . $ fil_space_crypt_t# *crypt_data, |
| 911 | fil_encryption_tcxx . . $ fil_encryption_t# mode= FIL_ENCRYPTION_DEFAULTcxx . . $ FIL_ENCRYPTION_DEFAULT., |
| 912 | bool opened= false) noexcept; |
| 913 | |
| 914 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 915 | /** Acquire a tablespace reference. |
| 916 | @param id tablespace identifier |
| 917 | @return tablespace |
| 918 | @retval nullptr if the tablespace is missing or inaccessible */ |
| 919 | static fil_space_tcxx . . $ fil_space_t# *getcxx . . $ fil_space_t#get(fb1f3aca84eadcbc).(uint32_tcxx . . $ uint32_t# id) noexcept; |
| 920 | /** Acquire a tablespace reference for writing. |
| 921 | @param id tablespace identifier |
| 922 | @return tablespace |
| 923 | @retval nullptr if the tablespace is missing or inaccessible */ |
| 924 | static fil_space_tcxx . . $ fil_space_t# *get_for_writecxx . . $ fil_space_t#get_for_write(fb1f3aca84eadcbc).(uint32_tcxx . . $ uint32_t# id) noexcept; |
| 925 | |
| 926 | /** Add/remove a page in freed_ranges. |
| 927 | @tparam add true=add, false=remove |
| 928 | @param offset page number */ |
| 929 | template<bool add=true> void free_pagecxx . . $ fil_space_t#free_page(6bab9b75950d6f3).(uint32_tcxx . . $ uint32_t# offset) noexcept |
| 930 | { |
| 931 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> freed_lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(freed_range_mutexcxx . . $ fil_space_t#freed_range_mutex.); |
| 932 | if (add) |
| 933 | freed_rangescxx . . $ fil_space_t#freed_ranges..add_valuecxx . . $ range_set#add_value(cb2f890c2fdad230).(offset); |
| 934 | else |
| 935 | freed_rangescxx . . $ fil_space_t#freed_ranges..remove_valuecxx . . $ range_set#remove_value(cb2f890c2fdad230).(offset); |
| 936 | } |
| 937 | |
| 938 | /** Add the range of freed pages */ |
| 939 | void add_free_rangescxx . . $ fil_space_t#add_free_ranges(554b202e2e0bf42d).(range_setcxx . . $ range_set# ranges) noexcept |
| 940 | { |
| 941 | stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> freed_lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(freed_range_mutexcxx . . $ fil_space_t#freed_range_mutex.); |
| 942 | freed_rangescxx . . $ fil_space_t#freed_ranges.=cxx . . $ range_set#`operator=`(d00eb3795bb60eaa). stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(ranges); |
| 943 | } |
| 944 | |
| 945 | /** Add the set of freed page ranges */ |
| 946 | void add_free_rangecxx . . $ fil_space_t#add_free_range(617da8bb2163e9f2).(const range_tcxx . . $ range_t# range) noexcept |
| 947 | { |
| 948 | freed_rangescxx . . $ fil_space_t#freed_ranges..add_rangecxx . . $ range_set#add_range(1e1b818b5131e79f).(range); |
| 949 | } |
| 950 | |
| 951 | /** Clear the freed range in temporary tablespace |
| 952 | which are in shrinking ranges. |
| 953 | @param threshold to be truncated value*/ |
| 954 | inline void clear_freed_rangescxx . . $ fil_space_t#clear_freed_ranges(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# threshold); |
| 955 | |
| 956 | /** Set the tablespace size in pages */ |
| 957 | void set_sizescxx . . $ fil_space_t#set_sizes(6bab9b75950d6f3).(uint32_tcxx . . $ uint32_t# s) noexcept |
| 958 | { |
| 959 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(id ? !size : (size >= s)); |
| 960 | sizecxx . . $ fil_space_t#size.= s; committed_sizecxx . . $ fil_space_t#committed_size.=cxx . . $ Atomic_relaxed#`operator=`(ada6a8422704cf8a). s; |
| 961 | } |
| 962 | |
| 963 | /** Update committed_size in mtr_t::commit() */ |
| 964 | void set_committed_sizecxx . . $ fil_space_t#set_committed_size(ced63f7c635d850d).() noexcept { committed_sizecxx . . $ fil_space_t#committed_size.=cxx . . $ Atomic_relaxed#`operator=`(ada6a8422704cf8a). sizecxx . . $ fil_space_t#size.; } |
| 965 | |
| 966 | /** @return the last persisted page number */ |
| 967 | uint32_tcxx . . $ uint32_t# last_page_numbercxx . . $ fil_space_t#last_page_number(d22c8608b6eae7b5).() const noexcept { return committed_sizecxx . . $ fil_space_t#committed_size. - 1; } |
| 968 | |
| 969 | /** @return the size in pages (0 if unreadable) */ |
| 970 | inline uint32_tcxx . . $ uint32_t# get_sizecxx . . $ fil_space_t#get_size(2658d6455debfaef).() noexcept; |
| 971 | |
| 972 | /** Read or write data. |
| 973 | @param type I/O context |
| 974 | @param offset offset in bytes |
| 975 | @param len number of bytes |
| 976 | @param buf the data to be read or written |
| 977 | @param bpage buffer block (for type.is_async() completion callback) |
| 978 | @return status and file descriptor */ |
| 979 | fil_io_tcxx . . $ fil_io_t# iocxx . . $ fil_space_t#io(f253576982604ba3).(const IORequestcxx . . $ IORequest# &type, os_offset_tcxx . . $ os_offset_t# offset, size_tcxx . . $ size_t# len, |
| 980 | void *buf, buf_page_tcxx . . $ buf_page_t# *bpage= nullptr) noexcept; |
| 981 | /** Flush pending writes from the file system cache to the file. */ |
| 982 | template<bool have_reference> inline void flushcxx . . $ fil_space_t#flush(ced63f7c635d850d).() noexcept; |
| 983 | /** Flush pending writes from the file system cache to the file. */ |
| 984 | void flush_lowcxx . . $ fil_space_t#flush_low(ced63f7c635d850d).() noexcept; |
| 985 | |
| 986 | /** Read the first page of a data file. |
| 987 | @param dpage copy of a first page, from the doublewrite buffer, or nullptr |
| 988 | @param no_lsn whether to skip the FIL_PAGE_LSN check |
| 989 | @return whether the page was found valid */ |
| 990 | bool read_page0cxx . . $ fil_space_t#read_page0(dc35541a7e0d3731).(const bytecxx . . $ byte# *dpage, bool no_lsn) noexcept; |
| 991 | |
| 992 | /** Determine the next tablespace for encryption key rotation. |
| 993 | @param space current tablespace (nullptr to start from the beginning) |
| 994 | @param recheck whether the removal condition needs to be rechecked after |
| 995 | encryption parameters were changed |
| 996 | @param encrypt expected state of innodb_encrypt_tables |
| 997 | @return the next tablespace |
| 998 | @retval nullptr upon reaching the end of the iteration */ |
| 999 | static space_list_tcxx . . $ space_list_t#::iteratorcxx . . $ ilist#iterator# nextcxx . . $ fil_space_t#next(cdec6cbe7335d640).(space_list_tcxx . . $ space_list_t#::iteratorcxx . . $ ilist#iterator# space, |
| 1000 | bool recheck, bool encrypt) noexcept; |
| 1001 | |
| 1002 | #ifdef UNIV_DEBUG |
| 1003 | bool is_latched() const noexcept { return latch.have_any(); } |
| 1004 | #endif |
| 1005 | bool is_ownercxx . . $ fil_space_t#is_owner(3482b152b9333168).() const noexcept |
| 1006 | { |
| 1007 | const bool owner{latch_ownercxx . . $ fil_space_t#latch_owner. == pthread_self()}; |
| 1008 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(owner == latch.have_wr()); |
| 1009 | return owner; |
| 1010 | } |
| 1011 | /** Acquire the allocation latch in exclusive mode */ |
| 1012 | void x_lockcxx . . $ fil_space_t#x_lock(ced63f7c635d850d).() noexcept |
| 1013 | { |
| 1014 | latchcxx . . $ fil_space_t#latch..wr_lockcxx . . $ srw_lock_impl#wr_lock(9bb8261ff8654062).(SRW_LOCK_CALLcxx . . $ `storage/innobase/include/srw_lock.h:44:10`!); |
| 1015 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!latch_owner); |
| 1016 | latch_ownercxx . . $ fil_space_t#latch_owner.= pthread_self(); |
| 1017 | } |
| 1018 | /** Release the allocation latch from exclusive mode */ |
| 1019 | void x_unlockcxx . . $ fil_space_t#x_unlock(49f6e7a06ebc5aa8).() |
| 1020 | { |
| 1021 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(latch_owner == pthread_self()); |
| 1022 | latch_ownercxx . . $ fil_space_t#latch_owner.= 0; |
| 1023 | latchcxx . . $ fil_space_t#latch..wr_unlockcxx . . $ srw_lock_impl#wr_unlock(ced63f7c635d850d).(); |
| 1024 | } |
| 1025 | /** Acquire the allocation latch in shared mode */ |
| 1026 | void s_lockcxx . . $ fil_space_t#s_lock(ced63f7c635d850d).() noexcept { latchcxx . . $ fil_space_t#latch..rd_lockcxx . . $ srw_lock_impl#rd_lock(9bb8261ff8654062).(SRW_LOCK_CALLcxx . . $ `storage/innobase/include/srw_lock.h:44:10`!); } |
| 1027 | /** Release the allocation latch from shared mode */ |
| 1028 | void s_unlockcxx . . $ fil_space_t#s_unlock(ced63f7c635d850d).() noexcept { latchcxx . . $ fil_space_t#latch..rd_unlockcxx . . $ srw_lock_impl#rd_unlock(ced63f7c635d850d).(); } |
| 1029 | |
| 1030 | typedef spancxx . . $ span#<const char> name_typecxx . . $ fil_space_t#name_type#; |
| 1031 | |
| 1032 | /** @return the tablespace name (databasename/tablename) */ |
| 1033 | name_typecxx . . $ fil_space_t#name_type# namecxx . . $ fil_space_t#name(dc359c371c75e28b).() const noexcept; |
| 1034 | |
| 1035 | /** How to validate tablespace files that are being opened */ |
| 1036 | enum validatecxx . . $ fil_space_t#validate# { |
| 1037 | /** the file may be missing */ |
| 1038 | MAYBE_MISSINGcxx . . $ fil_space_t#MAYBE_MISSING.= 0, |
| 1039 | /** do not validate */ |
| 1040 | VALIDATE_NOTHINGcxx . . $ fil_space_t#VALIDATE_NOTHING., |
| 1041 | /** validate the tablespace ID */ |
| 1042 | VALIDATE_SPACE_IDcxx . . $ fil_space_t#VALIDATE_SPACE_ID., |
| 1043 | /** opening a file for ALTER TABLE...IMPORT TABLESPACE */ |
| 1044 | VALIDATE_IMPORTcxx . . $ fil_space_t#VALIDATE_IMPORT. |
| 1045 | }; |
| 1046 | |
| 1047 | /** Update the data structures on write completion */ |
| 1048 | void complete_writecxx . . $ fil_space_t#complete_write(ced63f7c635d850d).() noexcept; |
| 1049 | |
| 1050 | /** Free the unused segment for the tablespace |
| 1051 | @param shutdown called during slow shutdown |
| 1052 | @return error code */ |
| 1053 | dberr_tcxx . . $ dberr_t# garbage_collectcxx . . $ fil_space_t#garbage_collect(d04655808700f477).(bool shutdown); |
| 1054 | |
| 1055 | /** Move InnoDB system tables closer to the start of |
| 1056 | the tablespace. |
| 1057 | @return error code |
| 1058 | @retval DB_SUCCESS on successful operation */ |
| 1059 | dberr_tcxx . . $ dberr_t# defragmentcxx . . $ fil_space_t#defragment(61cafcde64169af4).() noexcept; |
| 1060 | private: |
| 1061 | /** @return whether the file is usable for io() */ |
| 1062 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! bool prepare_acquiredcxx . . $ fil_space_t#prepare_acquired(77ce49a7840d23c7).() noexcept; |
| 1063 | /** @return whether the file is usable for io() */ |
| 1064 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! bool acquire_and_preparecxx . . $ fil_space_t#acquire_and_prepare(77ce49a7840d23c7).() noexcept; |
| 1065 | #endif /*!UNIV_INNOCHECKSUM */ |
| 1066 | }; |
| 1067 | |
| 1068 | #ifndef UNIV_INNOCHECKSUMcxx . . $ `<built-in>:481:9`! |
| 1069 | /** File node of a tablespace or the log data space */ |
| 1070 | struct fil_node_tcxx . . $ fil_node_t# final |
| 1071 | { |
| 1072 | /** tablespace containing this file */ |
| 1073 | fil_space_tcxx . . $ fil_space_t# *spacecxx . . $ fil_node_t#space.; |
| 1074 | /** file name; protected by fil_system.mutex and exclusive log_sys.latch */ |
| 1075 | char *namecxx . . $ fil_node_t#name.; |
| 1076 | /** file handle */ |
| 1077 | pfs_os_file_tcxx . . $ pfs_os_file_t# handlecxx . . $ fil_node_t#handle.; |
| 1078 | /** whether the file is on non-rotational media (SSD) */ |
| 1079 | unsigned on_ssdcxx . . $ fil_node_t#on_ssd.:1; |
| 1080 | /** how to write page_compressed tables |
| 1081 | (0=do not punch holes but write minimal amount of data, 1=punch holes, |
| 1082 | 2=always write the same amount; thinly provisioned storage will compress) */ |
| 1083 | unsigned punch_holecxx . . $ fil_node_t#punch_hole.:2; |
| 1084 | /** whether this file could use atomic write */ |
| 1085 | unsigned atomic_writecxx . . $ fil_node_t#atomic_write.:1; |
| 1086 | /** whether the file actually is a raw device or disk partition */ |
| 1087 | unsigned is_raw_diskcxx . . $ fil_node_t#is_raw_disk.:1; |
| 1088 | /** whether the tablespace discovery is being deferred during crash |
| 1089 | recovery due to missing file or incompletely written page 0 */ |
| 1090 | unsigned deferredcxx . . $ fil_node_t#deferred.:1; |
| 1091 | |
| 1092 | /** size of the file in database pages (0 if not known yet); |
| 1093 | the possible last incomplete megabyte may be ignored if space->id == 0 */ |
| 1094 | uint32_tcxx . . $ uint32_t# sizecxx . . $ fil_node_t#size.; |
| 1095 | /** maximum size of the file in database pages (0 if unlimited) */ |
| 1096 | uint32_tcxx . . $ uint32_t# max_sizecxx . . $ fil_node_t#max_size.; |
| 1097 | /** whether the file is currently being extended */ |
| 1098 | Atomic_relaxedcxx . . $ Atomic_relaxed#<bool> being_extendedcxx . . $ fil_node_t#being_extended.; |
| 1099 | /** link to other files in this tablespace */ |
| 1100 | UT_LIST_NODE_Tcxx . . $ `storage/innobase/include/ut0lst.h:57:9`!(fil_node_t) chaincxx . . $ fil_node_t#chain.; |
| 1101 | |
| 1102 | /** Filesystem block size */ |
| 1103 | ulintcxx . . $ ulint# block_sizecxx . . $ fil_node_t#block_size.; |
| 1104 | |
| 1105 | /** @return whether this file is open */ |
| 1106 | bool is_opencxx . . $ fil_node_t#is_open(3482b152b9333168).() const noexcept { return handlecxx . . $ fil_node_t#handle. !=cxx . . $ pfs_os_file_t#`operator!=`(4a668f6de69bf818). OS_FILE_CLOSEDcxx . . $ OS_FILE_CLOSED.; } |
| 1107 | |
| 1108 | /** Read the first page of a data file. |
| 1109 | @param dpage copy of a first page, from the doublewrite buffer, or nullptr |
| 1110 | @param no_lsn whether to skip the FIL_PAGE_LSN check |
| 1111 | @return whether the page was found valid */ |
| 1112 | bool read_page0cxx . . $ fil_node_t#read_page0(dc35541a7e0d3731).(const bytecxx . . $ byte# *dpage, bool no_lsn) noexcept; |
| 1113 | /** Determine some file metadata when creating or reading the file. */ |
| 1114 | void find_metadatacxx . . $ fil_node_t#find_metadata(9f0ba574c1c44ffc).(IF_WINcxx . . $ `include/my_global.h:97:9`!(,bool create= false)) noexcept; |
| 1115 | |
| 1116 | /** Close the file handle. */ |
| 1117 | void closecxx . . $ fil_node_t#close(ced63f7c635d850d).() noexcept; |
| 1118 | /** Same as close() but returns file handle instead of closing it. */ |
| 1119 | pfs_os_file_tcxx . . $ pfs_os_file_t# detachcxx . . $ fil_node_t#detach(93cc1c3fb7e61cf3).() noexcept MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)); |
| 1120 | /** Prepare to free a file from fil_system. |
| 1121 | @param detach_handle whether to detach instead of closing a handle |
| 1122 | @return detached handle or OS_FILE_CLOSED */ |
| 1123 | inline pfs_os_file_tcxx . . $ pfs_os_file_t# close_to_freecxx . . $ fil_node_t#close_to_free(c1cd479394ddcac2).(bool detach_handle= false) noexcept; |
| 1124 | |
| 1125 | private: |
| 1126 | /** Does stuff common for close() and detach() */ |
| 1127 | void prepare_to_close_or_detachcxx . . $ fil_node_t#prepare_to_close_or_detach(ced63f7c635d850d).() noexcept; |
| 1128 | }; |
| 1129 | |
| 1130 | inline bool fil_space_tcxx . . $ fil_space_t#::use_doublewritecxx . . $ fil_space_t#use_doublewrite(3482b152b9333168).() const noexcept |
| 1131 | { |
| 1132 | return !UT_LIST_GET_FIRSTcxx . . $ fil_space_t#chain.(chain)->atomic_writecxx . . $ fil_node_t#atomic_write. && buf_dblwrcxx . . $ buf_dblwr..in_usecxx . . $ buf_dblwr_t#in_use(50ce9a9e25b4a850).(); |
| 1133 | } |
| 1134 | |
| 1135 | inline void fil_space_tcxx . . $ fil_space_t#::set_importedcxx . . $ fil_space_t#set_imported(ced63f7c635d850d).() noexcept |
| 1136 | { |
| 1137 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(being_imported); |
| 1138 | being_importedcxx . . $ fil_space_t#being_imported.= false; |
| 1139 | UT_LIST_GET_FIRSTcxx . . $ fil_space_t#chain.(chain)->find_metadatacxx . . $ fil_node_t#find_metadata(9f0ba574c1c44ffc).(); |
| 1140 | } |
| 1141 | |
| 1142 | inline bool fil_space_tcxx . . $ fil_space_t#::is_rotationalcxx . . $ fil_space_t#is_rotational(3482b152b9333168).() const noexcept |
| 1143 | { |
| 1144 | for (const fil_node_tcxx . . $ fil_node_t# *node= UT_LIST_GET_FIRSTcxx . . $ ut_list_base#start.(chain); node; |
| 1145 | node= UT_LIST_GET_NEXTcxx . . $ `storage/innobase/include/ut0lst.h:401:9`!(chain, node)) |
| 1146 | if (!node->on_ssdcxx . . $ fil_node_t#on_ssd.) |
| 1147 | return true; |
| 1148 | return false; |
| 1149 | } |
| 1150 | |
| 1151 | /** Common InnoDB file extensions */ |
| 1152 | enum ib_extentioncxx . . $ ib_extention# { |
| 1153 | NO_EXTcxx . . $ NO_EXT. = 0, |
| 1154 | IBDcxx . . $ IBD. = 1, |
| 1155 | ISLcxx . . $ ISL. = 2, |
| 1156 | CFGcxx . . $ CFG. = 3 |
| 1157 | }; |
| 1158 | extern const char* dot_extcxx . . $ dot_ext.[]; |
| 1159 | #define DOT_IBDcxx . . $ `storage/innobase/include/fil0fil.h:1159:9`! dot_ext[IBD] |
| 1160 | #define DOT_ISLcxx . . $ `storage/innobase/include/fil0fil.h:1160:9`! dot_ext[ISL] |
| 1161 | #define DOT_CFGcxx . . $ `storage/innobase/include/fil0fil.h:1161:9`! dot_ext[CFG] |
| 1162 | |
| 1163 | /** When mariadbd is run, the default directory "." is the mysqld datadir, |
| 1164 | but in the MariaDB Embedded Server Library and mysqlbackup it is not the default |
| 1165 | directory, and we must set the base file path explicitly */ |
| 1166 | extern const char* fil_path_to_mysql_datadircxx . . $ fil_path_to_mysql_datadir.; |
| 1167 | #else |
| 1168 | # include "univ.i"cxx . . $ `<file>/storage/innobase/include/univ.i`/ |
| 1169 | #endif /* !UNIV_INNOCHECKSUM */ |
| 1170 | |
| 1171 | /** Initial size of a single-table tablespace in pages */ |
| 1172 | #define FIL_IBD_FILE_INITIAL_SIZEcxx . . $ `storage/innobase/include/fil0fil.h:1172:9`! 4U |
| 1173 | |
| 1174 | /** 'null' (undefined) page offset in the context of file spaces */ |
| 1175 | #define FIL_NULLcxx . . $ `storage/innobase/include/fil0fil.h:1175:9`! ULINT32_UNDEFINEDcxx . . $ `storage/innobase/include/univ.i:337:9`! |
| 1176 | |
| 1177 | |
| 1178 | #define FIL_ADDR_PAGEcxx . . $ `storage/innobase/include/fil0fil.h:1178:9`! 0U /* first in address is the page offset */ |
| 1179 | #define FIL_ADDR_BYTEcxx . . $ `storage/innobase/include/fil0fil.h:1179:9`! 4U /* then comes 2-byte byte offset within page*/ |
| 1180 | #define FIL_ADDR_SIZEcxx . . $ `storage/innobase/include/fil0fil.h:1180:9`! 6U /* address size is 6 bytes */ |
| 1181 | |
| 1182 | /** File space address */ |
| 1183 | struct fil_addr_tcxx . . $ fil_addr_t# { |
| 1184 | /** page number within a tablespace */ |
| 1185 | uint32_tcxx . . $ uint32_t# pagecxx . . $ fil_addr_t#page.; |
| 1186 | /** byte offset within the page */ |
| 1187 | uint16_tcxx . . $ uint16_t# boffsetcxx . . $ fil_addr_t#boffset.; |
| 1188 | }; |
| 1189 | |
| 1190 | /** The byte offsets on a file page for various variables @{ */ |
| 1191 | #define FIL_PAGE_SPACE_OR_CHKSUMcxx . . $ `storage/innobase/include/fil0fil.h:1191:9`! 0 /*!< in < MySQL-4.0.14 space id the |
| 1192 | page belongs to (== 0) but in later |
| 1193 | versions the 'new' checksum of the |
| 1194 | page */ |
| 1195 | #define FIL_PAGE_OFFSETcxx . . $ `storage/innobase/include/fil0fil.h:1195:9`! 4U /*!< page offset inside space */ |
| 1196 | #define FIL_PAGE_PREVcxx . . $ `storage/innobase/include/fil0fil.h:1196:9`! 8U /*!< if there is a 'natural' |
| 1197 | predecessor of the page, its |
| 1198 | offset. Otherwise FIL_NULL. |
| 1199 | This field is not set on BLOB |
| 1200 | pages, which are stored as a |
| 1201 | singly-linked list. See also |
| 1202 | FIL_PAGE_NEXT. */ |
| 1203 | #define FIL_PAGE_NEXTcxx . . $ `storage/innobase/include/fil0fil.h:1203:9`! 12U /*!< if there is a 'natural' successor |
| 1204 | of the page, its offset. |
| 1205 | Otherwise FIL_NULL. |
| 1206 | B-tree index pages |
| 1207 | (FIL_PAGE_TYPE contains FIL_PAGE_INDEX) |
| 1208 | on the same PAGE_LEVEL are maintained |
| 1209 | as a doubly linked list via |
| 1210 | FIL_PAGE_PREV and FIL_PAGE_NEXT |
| 1211 | in the collation order of the |
| 1212 | smallest user record on each page. */ |
| 1213 | #define FIL_PAGE_LSNcxx . . $ `storage/innobase/include/fil0fil.h:1213:9`! 16U /*!< lsn of the end of the newest |
| 1214 | modification log record to the page */ |
| 1215 | #define FIL_PAGE_TYPEcxx . . $ `storage/innobase/include/fil0fil.h:1215:9`! 24U /*!< file page type: FIL_PAGE_INDEX,..., |
| 1216 | 2 bytes. |
| 1217 | |
| 1218 | The contents of this field can only |
| 1219 | be trusted in the following case: |
| 1220 | if the page is an uncompressed |
| 1221 | B-tree index page, then it is |
| 1222 | guaranteed that the value is |
| 1223 | FIL_PAGE_INDEX. |
| 1224 | The opposite does not hold. |
| 1225 | |
| 1226 | In tablespaces created by |
| 1227 | MySQL/InnoDB 5.1.7 or later, the |
| 1228 | contents of this field is valid |
| 1229 | for all uncompressed pages. */ |
| 1230 | |
| 1231 | /** For the first page in a system tablespace data file(ibdata*, not *.ibd): |
| 1232 | the file has been flushed to disk at least up to this lsn |
| 1233 | For other pages of tablespaces not in innodb_checksum_algorithm=full_crc32 |
| 1234 | format: 32-bit key version used to encrypt the page + 32-bit checksum |
| 1235 | or 64 bits of zero if no encryption */ |
| 1236 | #define FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSIONcxx . . $ `storage/innobase/include/fil0fil.h:1236:9`! 26U |
| 1237 | |
| 1238 | /** This overloads FIL_PAGE_FILE_FLUSH_LSN for RTREE Split Sequence Number */ |
| 1239 | #define FIL_RTREE_SPLIT_SEQ_NUMcxx . . $ `storage/innobase/include/fil0fil.h:1239:9`! FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSIONcxx . . $ `storage/innobase/include/fil0fil.h:1236:9`! |
| 1240 | |
| 1241 | /** Start of the page_compressed content */ |
| 1242 | #define FIL_PAGE_COMP_ALGOcxx . . $ `storage/innobase/include/fil0fil.h:1242:9`! FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION |
| 1243 | |
| 1244 | /** starting from 4.1.x this contains the space id of the page */ |
| 1245 | #define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_IDcxx . . $ `storage/innobase/include/fil0fil.h:1245:9`! 34U |
| 1246 | |
| 1247 | #define FIL_PAGE_SPACE_IDcxx . . $ `storage/innobase/include/fil0fil.h:1247:9`! FIL_PAGE_ARCH_LOG_NO_OR_SPACE_IDcxx . . $ `storage/innobase/include/fil0fil.h:1245:9`! |
| 1248 | |
| 1249 | #define FIL_PAGE_DATAcxx . . $ `storage/innobase/include/fil0fil.h:1249:9`! 38U /*!< start of the data on the page */ |
| 1250 | |
| 1251 | /** 32-bit key version used to encrypt the page in full_crc32 format. |
| 1252 | For non-encrypted page, it contains 0. */ |
| 1253 | #define FIL_PAGE_FCRC32_KEY_VERSIONcxx . . $ `storage/innobase/include/fil0fil.h:1253:9`! 0 |
| 1254 | |
| 1255 | /** page_compressed without innodb_checksum_algorithm=full_crc32 @{ */ |
| 1256 | /** Number of bytes used to store actual payload data size on |
| 1257 | page_compressed pages when not using full_crc32. */ |
| 1258 | #define FIL_PAGE_COMP_SIZEcxx . . $ `storage/innobase/include/fil0fil.h:1258:9`! 0 |
| 1259 | |
| 1260 | /** Number of bytes for FIL_PAGE_COMP_SIZE */ |
| 1261 | #define FIL_PAGE_COMP_METADATA_LENcxx . . $ `storage/innobase/include/fil0fil.h:1261:9`! 2 |
| 1262 | |
| 1263 | /** Number of bytes used to store actual compression method |
| 1264 | for encrypted tables when not using full_crc32. */ |
| 1265 | #define FIL_PAGE_ENCRYPT_COMP_ALGOcxx . . $ `storage/innobase/include/fil0fil.h:1265:9`! 2 |
| 1266 | |
| 1267 | /** Extra header size for encrypted page_compressed pages when |
| 1268 | not using full_crc32 */ |
| 1269 | #define FIL_PAGE_ENCRYPT_COMP_METADATA_LENcxx . . $ `storage/innobase/include/fil0fil.h:1269:9`! 4 |
| 1270 | /* @} */ |
| 1271 | |
| 1272 | /** File page trailer @{ */ |
| 1273 | #define FIL_PAGE_END_LSN_OLD_CHKSUMcxx . . $ `storage/innobase/include/fil0fil.h:1273:9`! 8 /*!< the low 4 bytes of this are used |
| 1274 | to store the page checksum, the |
| 1275 | last 4 bytes should be identical |
| 1276 | to the last 4 bytes of FIL_PAGE_LSN */ |
| 1277 | #define FIL_PAGE_DATA_ENDcxx . . $ `storage/innobase/include/fil0fil.h:1277:9`! 8 /*!< size of the page trailer */ |
| 1278 | |
| 1279 | /** Store the last 4 bytes of FIL_PAGE_LSN */ |
| 1280 | #define FIL_PAGE_FCRC32_END_LSNcxx . . $ `storage/innobase/include/fil0fil.h:1280:9`! 8 |
| 1281 | |
| 1282 | /** Store crc32 checksum at the end of the page */ |
| 1283 | #define FIL_PAGE_FCRC32_CHECKSUMcxx . . $ `storage/innobase/include/fil0fil.h:1283:9`! 4 |
| 1284 | /* @} */ |
| 1285 | |
| 1286 | /** File page types (values of FIL_PAGE_TYPE) @{ */ |
| 1287 | /** page_compressed, encrypted=YES (not used for full_crc32) */ |
| 1288 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_PAGE_COMPRESSED_ENCRYPTEDcxx . . $ FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED.= 37401; |
| 1289 | /** page_compressed (not used for full_crc32) */ |
| 1290 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_PAGE_COMPRESSEDcxx . . $ FIL_PAGE_PAGE_COMPRESSED.= 34354; |
| 1291 | /** B-tree index page */ |
| 1292 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_INDEXcxx . . $ FIL_PAGE_INDEX.= 17855; |
| 1293 | /** R-tree index page (SPATIAL INDEX) */ |
| 1294 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_RTREEcxx . . $ FIL_PAGE_RTREE.= 17854; |
| 1295 | /** Undo log page */ |
| 1296 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_UNDO_LOGcxx . . $ FIL_PAGE_UNDO_LOG.= 2; |
| 1297 | /** Index node (of file-in-file metadata) */ |
| 1298 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_INODEcxx . . $ FIL_PAGE_INODE.= 3; |
| 1299 | /** Former change buffer free list */ |
| 1300 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_IBUF_FREE_LISTcxx . . $ FIL_PAGE_IBUF_FREE_LIST.= 4; |
| 1301 | /** Freshly allocated page */ |
| 1302 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_ALLOCATEDcxx . . $ FIL_PAGE_TYPE_ALLOCATED.= 0; |
| 1303 | /** Former change buffer bitmap pages (pages n*innodb_page_size+1) */ |
| 1304 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_IBUF_BITMAPcxx . . $ FIL_PAGE_IBUF_BITMAP.= 5; |
| 1305 | /** System page */ |
| 1306 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_SYScxx . . $ FIL_PAGE_TYPE_SYS.= 6; |
| 1307 | /** Transaction system data */ |
| 1308 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_TRX_SYScxx . . $ FIL_PAGE_TYPE_TRX_SYS.= 7; |
| 1309 | /** Tablespace header (page 0) */ |
| 1310 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_FSP_HDRcxx . . $ FIL_PAGE_TYPE_FSP_HDR.= 8; |
| 1311 | /** Extent descriptor page (pages n*innodb_page_size, except 0) */ |
| 1312 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_XDEScxx . . $ FIL_PAGE_TYPE_XDES.= 9; |
| 1313 | /** Uncompressed BLOB page */ |
| 1314 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_BLOBcxx . . $ FIL_PAGE_TYPE_BLOB.= 10; |
| 1315 | /** First ROW_FORMAT=COMPRESSED BLOB page */ |
| 1316 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_ZBLOBcxx . . $ FIL_PAGE_TYPE_ZBLOB.= 11; |
| 1317 | /** Subsequent ROW_FORMAT=COMPRESSED BLOB page */ |
| 1318 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_ZBLOB2cxx . . $ FIL_PAGE_TYPE_ZBLOB2.= 12; |
| 1319 | /** In old tablespaces, garbage in FIL_PAGE_TYPE is replaced with this |
| 1320 | value when flushing pages. */ |
| 1321 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_UNKNOWNcxx . . $ FIL_PAGE_TYPE_UNKNOWN.= 13; |
| 1322 | |
| 1323 | /* File page types introduced in MySQL 5.7, not supported in MariaDB */ |
| 1324 | //constexpr uint16_t FIL_PAGE_COMPRESSED = 14; |
| 1325 | //constexpr uint16_t FIL_PAGE_ENCRYPTED = 15; |
| 1326 | //constexpr uint16_t FIL_PAGE_COMPRESSED_AND_ENCRYPTED = 16; |
| 1327 | //constexpr FIL_PAGE_ENCRYPTED_RTREE = 17; |
| 1328 | /** Clustered index root page after instant ADD COLUMN */ |
| 1329 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_INSTANTcxx . . $ FIL_PAGE_TYPE_INSTANT.= 18; |
| 1330 | |
| 1331 | /** Used by i_s.cc to index into the text description. |
| 1332 | Note: FIL_PAGE_TYPE_INSTANT maps to the same as FIL_PAGE_INDEX. */ |
| 1333 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_TYPE_LASTcxx . . $ FIL_PAGE_TYPE_LAST.= FIL_PAGE_TYPE_UNKNOWNcxx . . $ FIL_PAGE_TYPE_UNKNOWN.; |
| 1334 | |
| 1335 | /** Set in FIL_PAGE_TYPE for full_crc32 pages in page_compressed format. |
| 1336 | If the flag is set, then the following holds for the remaining bits |
| 1337 | of FIL_PAGE_TYPE: |
| 1338 | Bits 0..7 will contain the compressed page size in bytes. |
| 1339 | Bits 8..14 are reserved and must be 0. */ |
| 1340 | constexpr uint16_tcxx . . $ uint16_t# FIL_PAGE_COMPRESS_FCRC32_MARKERcxx . . $ FIL_PAGE_COMPRESS_FCRC32_MARKER.= 15; |
| 1341 | /* @} */ |
| 1342 | |
| 1343 | /** @return whether the page type is B-tree or R-tree index */ |
| 1344 | inline bool fil_page_type_is_indexcxx . . $ fil_page_type_is_index(4c88780caf225ec1).(uint16_tcxx . . $ uint16_t# page_type) noexcept |
| 1345 | { |
| 1346 | switch (page_type) { |
| 1347 | case FIL_PAGE_TYPE_INSTANTcxx . . $ FIL_PAGE_TYPE_INSTANT.: |
| 1348 | case FIL_PAGE_INDEXcxx . . $ FIL_PAGE_INDEX.: |
| 1349 | case FIL_PAGE_RTREEcxx . . $ FIL_PAGE_RTREE.: |
| 1350 | return(true); |
| 1351 | } |
| 1352 | return(false); |
| 1353 | } |
| 1354 | |
| 1355 | /** Check whether the page is index page (either regular Btree index or Rtree |
| 1356 | index */ |
| 1357 | #define fil_page_index_page_checkcxx . . $ `storage/innobase/include/fil0fil.h:1357:9`!(page) \ |
| 1358 | fil_page_type_is_index(fil_page_get_type(page)) |
| 1359 | |
| 1360 | /** Get the file page type. |
| 1361 | @param[in] page file page |
| 1362 | @return page type */ |
| 1363 | inline uint16_tcxx . . $ uint16_t# fil_page_get_typecxx . . $ fil_page_get_type(422f7ec86fa2a2fb).(const bytecxx . . $ byte# *page) noexcept |
| 1364 | { |
| 1365 | return mach_read_from_2cxx . . $ mach_read_from_2(469dcb4e54b221a8).(my_assume_alignedcxx . . $ my_assume_aligned(5eb18401b0825ee).<2>(page + FIL_PAGE_TYPEcxx . . $ `storage/innobase/include/fil0fil.h:1215:9`!)); |
| 1366 | } |
| 1367 | |
| 1368 | #ifndef UNIV_INNOCHECKSUMcxx . . $ `<built-in>:481:9`! |
| 1369 | |
| 1370 | /** Number of pending tablespace flushes */ |
| 1371 | extern Atomic_countercxx . . $ Atomic_counter#<ulintcxx . . $ ulint#> fil_n_pending_tablespace_flushescxx . . $ fil_n_pending_tablespace_flushes.; |
| 1372 | |
| 1373 | /** Look up a tablespace. |
| 1374 | The caller should hold an InnoDB table lock or a MDL that prevents |
| 1375 | the tablespace from being dropped during the operation, |
| 1376 | or the caller should be in single-threaded crash recovery mode |
| 1377 | (no user connections that could drop tablespaces). |
| 1378 | Normally, fil_space_t::get() should be used instead. |
| 1379 | @param[in] id tablespace ID |
| 1380 | @return tablespace, or NULL if not found */ |
| 1381 | fil_space_tcxx . . $ fil_space_t# *fil_space_getcxx . . $ fil_space_get(fb1f3aca84eadcbc).(uint32_tcxx . . $ uint32_t# id) noexcept |
| 1382 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)); |
| 1383 | |
| 1384 | /** The tablespace memory cache */ |
| 1385 | struct fil_system_tcxx . . $ fil_system_t# |
| 1386 | { |
| 1387 | /** |
| 1388 | Constructor. |
| 1389 | |
| 1390 | Some members may require late initialisation, thus we just mark object as |
| 1391 | uninitialised. Real initialisation happens in create(). |
| 1392 | */ |
| 1393 | fil_system_tcxx . . $ fil_system_t#fil_system_t(49f6e7a06ebc5aa8).() {} |
| 1394 | |
| 1395 | bool is_initialisedcxx . . $ fil_system_t#is_initialised(3482b152b9333168).() const noexcept { return spacescxx . . $ fil_system_t#spaces..arraycxx . . $ hash_table_t#array.; } |
| 1396 | |
| 1397 | /** |
| 1398 | Create the file system interface at database start. |
| 1399 | |
| 1400 | @param[in] hash_size hash table size |
| 1401 | */ |
| 1402 | void createcxx . . $ fil_system_t#create(2c44cd906ae4e829).(ulintcxx . . $ ulint# hash_size); |
| 1403 | |
| 1404 | /** Close the file system interface at shutdown */ |
| 1405 | void closecxx . . $ fil_system_t#close(ced63f7c635d850d).() noexcept; |
| 1406 | |
| 1407 | private: |
| 1408 | /** Points to the last opened space in space_list. Protected with |
| 1409 | fil_system.mutex. */ |
| 1410 | fil_space_tcxx . . $ fil_space_t# *space_list_last_openedcxx . . $ fil_system_t#space_list_last_opened.= nullptr; |
| 1411 | |
| 1412 | #ifdef __linux__cxx . . $ `<built-in>:465:9`! |
| 1413 | /** available block devices that reside on non-rotational storage */ |
| 1414 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<dev_t> ssdcxx . . $ fil_system_t#ssd.; |
| 1415 | public: |
| 1416 | /** @return whether a file system device is on non-rotational storage */ |
| 1417 | bool is_ssdcxx . . $ fil_system_t#is_ssd(9d5f7ce526bbb82a).(dev_t dev) const noexcept |
| 1418 | { |
| 1419 | /* Linux seems to allow up to 15 partitions per block device. |
| 1420 | If the detected ssd carries "partition number 0" (it is the whole device), |
| 1421 | compare the candidate file system number without the partition number. */ |
| 1422 | for (const auto s : ssdcxx . . $ fil_system_t#ssd.) |
| 1423 | if (dev == s || (dev & ~15U) == s) |
| 1424 | return true; |
| 1425 | return false; |
| 1426 | } |
| 1427 | #endif |
| 1428 | public: |
| 1429 | /** Detach a tablespace from the cache and close the files. |
| 1430 | @param space tablespace |
| 1431 | @param detach_handle whether to detach the handle, instead of closing |
| 1432 | @return detached handle |
| 1433 | @retval OS_FILE_CLOSED if no handle was detached */ |
| 1434 | pfs_os_file_tcxx . . $ pfs_os_file_t# detachcxx . . $ fil_system_t#detach(636372ea1f43340f).(fil_space_tcxx . . $ fil_space_t# *space, bool detach_handle= false) noexcept; |
| 1435 | |
| 1436 | /** the mutex protecting most data fields, and some fields of fil_space_t */ |
| 1437 | mysql_mutex_t mutexcxx . . $ fil_system_t#mutex.; |
| 1438 | fil_space_tcxx . . $ fil_space_t#* sys_spacecxx . . $ fil_system_t#sys_space.; /*!< The innodb_system tablespace */ |
| 1439 | fil_space_tcxx . . $ fil_space_t#* temp_spacecxx . . $ fil_system_t#temp_space.; /*!< The innodb_temporary tablespace */ |
| 1440 | /** Map of fil_space_t::id to fil_space_t* */ |
| 1441 | hash_table_tcxx . . $ hash_table_t# spacescxx . . $ fil_system_t#spaces.; |
| 1442 | |
| 1443 | /** false=invoke fsync() or fdatasync() on data files before checkpoint; |
| 1444 | true=each write is durable (O_DSYNC) */ |
| 1445 | my_boolcxx . . $ my_bool# write_throughcxx . . $ fil_system_t#write_through.; |
| 1446 | /** whether data files are buffered (not O_DIRECT) */ |
| 1447 | my_boolcxx . . $ my_bool# bufferedcxx . . $ fil_system_t#buffered.; |
| 1448 | /** whether fdatasync() is needed on data files */ |
| 1449 | Atomic_relaxedcxx . . $ Atomic_relaxed#<bool> need_unflushed_spacescxx . . $ fil_system_t#need_unflushed_spaces.; |
| 1450 | |
| 1451 | /** Try to enable or disable write-through of data files */ |
| 1452 | void set_write_throughcxx . . $ fil_system_t#set_write_through(b45ddcbc8423892c).(bool write_through); |
| 1453 | /** Update innodb_doublewrite */ |
| 1454 | void set_use_doublewritecxx . . $ fil_system_t#set_use_doublewrite(2c44cd906ae4e829).(ulong use) |
| 1455 | { |
| 1456 | buf_dblwrcxx . . $ buf_dblwr..set_usecxx . . $ buf_dblwr_t#set_use(2c44cd906ae4e829).(use); |
| 1457 | need_unflushed_spacescxx . . $ fil_system_t#need_unflushed_spaces.=cxx . . $ Atomic_relaxed#`operator=`(ada6a8422704cf8a). !write_throughcxx . . $ fil_system_t#write_through. && buf_dblwrcxx . . $ buf_dblwr..need_fsynccxx . . $ buf_dblwr_t#need_fsync(50ce9a9e25b4a850).(); |
| 1458 | } |
| 1459 | |
| 1460 | /** Try to enable or disable file system caching of data files */ |
| 1461 | void set_bufferedcxx . . $ fil_system_t#set_buffered(b45ddcbc8423892c).(bool buffered); |
| 1462 | |
| 1463 | TPOOL_SUPPRESS_TSANcxx . . $ `tpool/tpool_structs.h:38:9`! bool is_write_throughcxx . . $ fil_system_t#is_write_through(50ce9a9e25b4a850).() const { return write_throughcxx . . $ fil_system_t#write_through.; } |
| 1464 | TPOOL_SUPPRESS_TSANcxx . . $ `tpool/tpool_structs.h:38:9`! bool is_bufferedcxx . . $ fil_system_t#is_buffered(50ce9a9e25b4a850).() const { return bufferedcxx . . $ fil_system_t#buffered.; } |
| 1465 | |
| 1466 | /** @return whether to update unflushed_spaces */ |
| 1467 | bool use_unflushed_spacescxx . . $ fil_system_t#use_unflushed_spaces(50ce9a9e25b4a850).() const { return need_unflushed_spacescxx . . $ fil_system_t#need_unflushed_spaces.; } |
| 1468 | |
| 1469 | /** tablespaces for which fil_space_t::needs_flush() holds */ |
| 1470 | sized_ilistcxx . . $ sized_ilist#<fil_space_tcxx . . $ fil_space_t#, unflushed_spaces_tag_tcxx . . $ unflushed_spaces_tag_t#> unflushed_spacescxx . . $ fil_system_t#unflushed_spaces.; |
| 1471 | /** number of currently open files; protected by mutex */ |
| 1472 | ulintcxx . . $ ulint# n_opencxx . . $ fil_system_t#n_open.; |
| 1473 | /** last time we noted n_open exceeding the limit; protected by mutex */ |
| 1474 | time_tcxx . . $ time_t# n_open_exceeded_timecxx . . $ fil_system_t#n_open_exceeded_time.; |
| 1475 | /** maximum space id in the existing tables; on InnoDB startup this is |
| 1476 | initialized based on the data dictionary contents */ |
| 1477 | uint32_tcxx . . $ uint32_t# max_assigned_idcxx . . $ fil_system_t#max_assigned_id.; |
| 1478 | /** nonzero if fil_node_open_file_low() should avoid moving the tablespace |
| 1479 | to the end of space_list, for FIFO policy of try_to_close() */ |
| 1480 | ulintcxx . . $ ulint# freeze_space_listcxx . . $ fil_system_t#freeze_space_list.; |
| 1481 | /** List of all file spaces, opened spaces should be at the top of the list |
| 1482 | to optimize try_to_close() execution. Protected with fil_system.mutex. */ |
| 1483 | ilistcxx . . $ ilist#<fil_space_tcxx . . $ fil_space_t#, space_list_tag_tcxx . . $ space_list_tag_t#> space_listcxx . . $ fil_system_t#space_list.; |
| 1484 | /** list of all tablespaces for which a FILE_MODIFY record has been written |
| 1485 | since the latest redo log checkpoint. |
| 1486 | Protected only by exclusive log_sys.latch. */ |
| 1487 | ilistcxx . . $ ilist#<fil_space_tcxx . . $ fil_space_t#, named_spaces_tag_tcxx . . $ named_spaces_tag_t#> named_spacescxx . . $ fil_system_t#named_spaces.; |
| 1488 | |
| 1489 | /** list of all ENCRYPTED=DEFAULT tablespaces that need |
| 1490 | to be converted to the current value of innodb_encrypt_tables */ |
| 1491 | ilistcxx . . $ ilist#<fil_space_tcxx . . $ fil_space_t#, default_encrypt_tag_tcxx . . $ default_encrypt_tag_t#> default_encrypt_tablescxx . . $ fil_system_t#default_encrypt_tables.; |
| 1492 | |
| 1493 | /** whether fil_space_t::create() has issued a warning about |
| 1494 | potential space_id reuse */ |
| 1495 | bool space_id_reuse_warnedcxx . . $ fil_system_t#space_id_reuse_warned.; |
| 1496 | |
| 1497 | /** Add the file to the end of opened spaces list in |
| 1498 | fil_system.space_list, so that fil_space_t::try_to_close() should close |
| 1499 | it as a last resort. |
| 1500 | @param space space to add */ |
| 1501 | void add_opened_last_to_space_listcxx . . $ fil_system_t#add_opened_last_to_space_list(88f69b9a9864369c).(fil_space_tcxx . . $ fil_space_t# *space) noexcept; |
| 1502 | |
| 1503 | /** Move the file to the end of opened spaces list in |
| 1504 | fil_system.space_list, so that fil_space_t::try_to_close() should close |
| 1505 | it as a last resort. |
| 1506 | @param space space to move */ |
| 1507 | inline void move_opened_last_to_space_listcxx . . $ fil_system_t#move_opened_last_to_space_list(88f69b9a9864369c).(fil_space_tcxx . . $ fil_space_t# *space) noexcept |
| 1508 | { |
| 1509 | /* In the case when several files of the same space are added in a |
| 1510 | row, there is no need to remove and add a space to the same position |
| 1511 | in space_list. It can be for system or temporary tablespaces. */ |
| 1512 | if (freeze_space_listcxx . . $ fil_system_t#freeze_space_list. || space_list_last_openedcxx . . $ fil_system_t#space_list_last_opened. == space) |
| 1513 | return; |
| 1514 | |
| 1515 | space_listcxx . . $ fil_system_t#space_list..erasecxx . . $ ilist#erase(74fc2ca530a5b28d).(space_list_tcxx . . $ space_list_t#::iteratorcxx . . $ ilist#iterator#(space)); |
| 1516 | add_opened_last_to_space_listcxx . . $ fil_system_t#add_opened_last_to_space_list(88f69b9a9864369c).(space); |
| 1517 | } |
| 1518 | |
| 1519 | /** Move closed file last in fil_system.space_list, so that |
| 1520 | fil_space_t::try_to_close() iterates opened files first in FIFO order, |
| 1521 | i.e. first opened, first closed. |
| 1522 | @param space space to move */ |
| 1523 | void move_closed_last_to_space_listcxx . . $ fil_system_t#move_closed_last_to_space_list(88f69b9a9864369c).(fil_space_tcxx . . $ fil_space_t# *space) noexcept |
| 1524 | { |
| 1525 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(freeze_space_list)) |
| 1526 | return; |
| 1527 | |
| 1528 | space_list_tcxx . . $ space_list_t#::iteratorcxx . . $ ilist#iterator# s= space_list_tcxx . . $ ilist#Iterator#Iterator(b878f813500fc8c).::iteratorcxx . . $ ilist#iterator#(space); |
| 1529 | |
| 1530 | if (space_list_last_openedcxx . . $ fil_system_t#space_list_last_opened. == space) |
| 1531 | { |
| 1532 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(s != space_list.begin()); |
| 1533 | space_list_tcxx . . $ space_list_t#::iteratorcxx . . $ ilist#iterator# prev= s; |
| 1534 | space_list_last_openedcxx . . $ fil_system_t#space_list_last_opened.= &*cxx . . $ ilist#Iterator#`operator*`(80ef4fb0f39170b5).--cxx . . $ ilist#Iterator#operator--(fc97392e836d6e10).prev; |
| 1535 | } |
| 1536 | |
| 1537 | space_listcxx . . $ fil_system_t#space_list..erasecxx . . $ ilist#erase(74fc2ca530a5b28d).(s); |
| 1538 | space_listcxx . . $ fil_system_t#space_list..push_backcxx . . $ ilist#push_back(926f85bfe424ae64).(*space); |
| 1539 | } |
| 1540 | |
| 1541 | /** Return the next tablespace from default_encrypt_tables list. |
| 1542 | @param space previous tablespace (nullptr to start from the start) |
| 1543 | @param recheck whether the removal condition needs to be rechecked after |
| 1544 | the encryption parameters were changed |
| 1545 | @param encrypt expected state of innodb_encrypt_tables |
| 1546 | @return the next tablespace to process (n_pending_ops incremented) |
| 1547 | @retval fil_system.temp_space if there is no work to do |
| 1548 | @retval nullptr upon reaching the end of the iteration */ |
| 1549 | inline fil_space_tcxx . . $ fil_space_t#* default_encrypt_nextcxx . . $ fil_system_t#default_encrypt_next(b017f7afa5547651).(fil_space_tcxx . . $ fil_space_t# *space, bool recheck, |
| 1550 | bool encrypt) noexcept; |
| 1551 | |
| 1552 | /** Extend all open data files to the recovered size */ |
| 1553 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! void extend_to_recv_sizecxx . . $ fil_system_t#extend_to_recv_size(ced63f7c635d850d).() noexcept; |
| 1554 | |
| 1555 | /** Determine if a tablespace associated with a file name exists. |
| 1556 | @param path tablespace file name to look for |
| 1557 | @return a matching tablespace */ |
| 1558 | inline fil_space_tcxx . . $ fil_space_t# *findcxx . . $ fil_system_t#find(218bafed2b706004).(const char *path) const noexcept; |
| 1559 | }; |
| 1560 | |
| 1561 | /** The tablespace memory cache. */ |
| 1562 | extern fil_system_tcxx . . $ fil_system_t# fil_systemcxx . . $ fil_system.; |
| 1563 | |
| 1564 | inline void fil_space_tcxx . . $ fil_space_t#::reacquirecxx . . $ fil_space_t#reacquire(ced63f7c635d850d).() noexcept |
| 1565 | { |
| 1566 | #ifdef SAFE_MUTEX |
| 1567 | uint32_t n= |
| 1568 | #endif |
| 1569 | n_pendingcxx . . $ fil_space_t#n_pending..fetch_addcxx . . $ std/__atomic_base#fetch_add(8de7200f212ddeb7).(1, stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.); |
| 1570 | #ifdef SAFE_MUTEX |
| 1571 | if (mysql_mutex_is_owner(&fil_system.mutex)) return; |
| 1572 | ut_ad(n & PENDING); |
| 1573 | ut_ad(UT_LIST_GET_FIRST(chain)->is_open()); |
| 1574 | #endif /* SAFE_MUTEX */ |
| 1575 | } |
| 1576 | |
| 1577 | /** Flush pending writes from the file system cache to the file. */ |
| 1578 | template<bool have_reference> inline void fil_space_tcxx . . $ fil_space_t#::flushcxx . . $ fil_space_t#flush(ced63f7c635d850d).() noexcept |
| 1579 | { |
| 1580 | mysql_mutex_assert_not_ownercxx . . $ `include/mysql/psi/mysql_thread.h:282:9`!(&fil_system.mutex); |
| 1581 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!have_reference || (pending() & PENDING)); |
| 1582 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!is_temporary()); |
| 1583 | if (have_reference) |
| 1584 | flush_lowcxx . . $ fil_space_t#flush_low(ced63f7c635d850d).(); |
| 1585 | else |
| 1586 | { |
| 1587 | if (!(acquire_lowcxx . . $ fil_space_t#acquire_low(2141b656ce2cc063).(STOPPINGcxx . . $ fil_space_t#STOPPING. | CLOSINGcxx . . $ fil_space_t#CLOSING.) & (STOPPINGcxx . . $ fil_space_t#STOPPING. | CLOSINGcxx . . $ fil_space_t#CLOSING.))) |
| 1588 | { |
| 1589 | flush_lowcxx . . $ fil_space_t#flush_low(ced63f7c635d850d).(); |
| 1590 | releasecxx . . $ fil_space_t#release(77ce49a7840d23c7).(); |
| 1591 | } |
| 1592 | } |
| 1593 | } |
| 1594 | |
| 1595 | /** @return the size in pages (0 if unreadable) */ |
| 1596 | inline uint32_tcxx . . $ uint32_t# fil_space_tcxx . . $ fil_space_t#::get_sizecxx . . $ fil_space_t#get_size(2658d6455debfaef).() noexcept |
| 1597 | { |
| 1598 | if (!sizecxx . . $ fil_space_t#size.) |
| 1599 | { |
| 1600 | mysql_mutex_lockcxx . . $ fil_system_t#mutex.(&fil_system.mutex); |
| 1601 | read_page0cxx . . $ fil_space_t#read_page0(dc35541a7e0d3731).(nullptr, false); |
| 1602 | mysql_mutex_unlockcxx . . $ fil_system_t#mutex.(&fil_system.mutex); |
| 1603 | } |
| 1604 | return sizecxx . . $ fil_space_t#size.; |
| 1605 | } |
| 1606 | |
| 1607 | #include "fil0crypt.h"cxx . . $ `<file>/storage/innobase/include/fil0crypt.h`/ |
| 1608 | |
| 1609 | /*******************************************************************//** |
| 1610 | Assigns a new space id for a new single-table tablespace. This works simply by |
| 1611 | incrementing the global counter. If 4 billion id's is not enough, we may need |
| 1612 | to recycle id's. |
| 1613 | @return true if assigned, false if not */ |
| 1614 | bool fil_assign_new_space_idcxx . . $ fil_assign_new_space_id(f4db574767150238).(uint32_tcxx . . $ uint32_t# *space_id) noexcept; |
| 1615 | |
| 1616 | /** Frees a space object from the tablespace memory cache. |
| 1617 | Closes the files in the chain but does not delete them. |
| 1618 | There must not be any pending i/o's or flushes on the files. |
| 1619 | @param id tablespace identifier |
| 1620 | @param x_latched whether the caller holds exclusive fil_space_t::latch |
| 1621 | @return true if success */ |
| 1622 | bool fil_space_freecxx . . $ fil_space_free(c534903ed7350fb0).(uint32_tcxx . . $ uint32_t# id, bool x_latched) noexcept; |
| 1623 | |
| 1624 | /** Set the recovered size of a tablespace in pages. |
| 1625 | @param id tablespace ID |
| 1626 | @param size recovered size in pages |
| 1627 | @param flags tablespace flags */ |
| 1628 | void fil_space_set_recv_size_and_flagscxx . . $ fil_space_set_recv_size_and_flags(4fdb83a109acf3a0).(uint32_tcxx . . $ uint32_t# id, uint32_tcxx . . $ uint32_t# size, |
| 1629 | uint32_tcxx . . $ uint32_t# flags) noexcept; |
| 1630 | |
| 1631 | /*******************************************************************//** |
| 1632 | Sets the max tablespace id counter if the given number is bigger than the |
| 1633 | previous value. */ |
| 1634 | void fil_set_max_space_id_if_biggercxx . . $ fil_set_max_space_id_if_bigger(6bab9b75950d6f3).(uint32_tcxx . . $ uint32_t# max_id) noexcept; |
| 1635 | |
| 1636 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)) |
| 1637 | /** Delete a tablespace and associated .ibd file. |
| 1638 | @param id tablespace identifier |
| 1639 | @return detached file handle (to be closed by the caller) |
| 1640 | @return OS_FILE_CLOSED if no file existed */ |
| 1641 | pfs_os_file_tcxx . . $ pfs_os_file_t# fil_delete_tablespacecxx . . $ fil_delete_tablespace(2cb9640f29b6b4ff).(uint32_tcxx . . $ uint32_t# id) noexcept; |
| 1642 | |
| 1643 | /** Close a single-table tablespace on failed IMPORT TABLESPACE. |
| 1644 | The tablespace must be cached in the memory cache. |
| 1645 | Free all pages used by the tablespace. */ |
| 1646 | void fil_close_tablespacecxx . . $ fil_close_tablespace(6bab9b75950d6f3).(uint32_tcxx . . $ uint32_t# id) noexcept; |
| 1647 | |
| 1648 | /*******************************************************************//** |
| 1649 | Allocates and builds a file name from a path, a table or tablespace name |
| 1650 | and a suffix. The string must be freed by caller with ut_free(). |
| 1651 | @param[in] path nullptr or the directory path or the full path and filename |
| 1652 | @param[in] name {} if path is full, or Table/Tablespace name |
| 1653 | @param[in] extension the file extension to use |
| 1654 | @param[in] trim_name true if the last name on the path should be trimmed |
| 1655 | @return own: file name */ |
| 1656 | char* fil_make_filepath_lowcxx . . $ fil_make_filepath_low(3a9d6a37cf401fee).(const char *path, |
| 1657 | const fil_space_tcxx . . $ fil_space_t#::name_typecxx . . $ fil_space_t#name_type# &name, |
| 1658 | ib_extentioncxx . . $ ib_extention# extension, bool trim_name) noexcept; |
| 1659 | |
| 1660 | char *fil_make_filepathcxx . . $ fil_make_filepath(8c662c98e388b103).(const char* path, const table_name_tcxx . . $ table_name_t# name, |
| 1661 | ib_extentioncxx . . $ ib_extention# suffix, bool strip_name) noexcept; |
| 1662 | |
| 1663 | /** Wrapper function over fil_make_filepath_low to build file name. |
| 1664 | @param path nullptr or the directory path or the full path and filename |
| 1665 | @param name {} if path is full, or Table/Tablespace name |
| 1666 | @param extension the file extension to use |
| 1667 | @param trim_name true if the last name on the path should be trimmed |
| 1668 | @return own: file name */ |
| 1669 | static inline char* |
| 1670 | fil_make_filepathcxx . . $ fil_make_filepath(3a9d6a37cf401fee).(const char* path, const fil_space_tcxx . . $ fil_space_t#::name_typecxx . . $ fil_space_t#name_type# &name, |
| 1671 | ib_extentioncxx . . $ ib_extention# extension, bool trim_name) noexcept |
| 1672 | { |
| 1673 | /* If we are going to strip a name off the path, there better be a |
| 1674 | path and a new name to put back on. */ |
| 1675 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!trim_name || (path && name.data())); |
| 1676 | return fil_make_filepath_lowcxx . . $ fil_make_filepath_low(3a9d6a37cf401fee).(path, name, extension, trim_name); |
| 1677 | } |
| 1678 | |
| 1679 | /** Create a tablespace file. |
| 1680 | @param[in] space_id Tablespace ID |
| 1681 | @param[in] name Tablespace name in dbname/tablename format. |
| 1682 | @param[in] path Path and filename of the datafile to create. |
| 1683 | @param[in] flags Tablespace flags |
| 1684 | @param[in] size Initial size of the tablespace file in pages, |
| 1685 | must be >= FIL_IBD_FILE_INITIAL_SIZE |
| 1686 | @param[in] mode MariaDB encryption mode |
| 1687 | @param[in] key_id MariaDB encryption key_id |
| 1688 | @param[out] err DB_SUCCESS or error code |
| 1689 | @return the created tablespace |
| 1690 | @retval NULL on error */ |
| 1691 | fil_space_tcxx . . $ fil_space_t#* |
| 1692 | fil_ibd_createcxx . . $ fil_ibd_create(13ff5aa601eef218).( |
| 1693 | uint32_tcxx . . $ uint32_t# space_id, |
| 1694 | const table_name_tcxx . . $ table_name_t# name, |
| 1695 | const char* path, |
| 1696 | uint32_tcxx . . $ uint32_t# flags, |
| 1697 | uint32_tcxx . . $ uint32_t# size, |
| 1698 | fil_encryption_tcxx . . $ fil_encryption_t# mode, |
| 1699 | uint32_tcxx . . $ uint32_t# key_id, |
| 1700 | dberr_tcxx . . $ dberr_t#* err) noexcept |
| 1701 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((nonnull, warn_unused_result)); |
| 1702 | |
| 1703 | /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. |
| 1704 | (Typically when upgrading from MariaDB 10.1.0..10.1.20.) |
| 1705 | @param[in,out] space tablespace |
| 1706 | @param[in] flags desired tablespace flags */ |
| 1707 | void fsp_flags_try_adjustcxx . . $ fsp_flags_try_adjust(9b026bbe728f3d55).(fil_space_tcxx . . $ fil_space_t# *space, uint32_tcxx . . $ uint32_t# flags); |
| 1708 | |
| 1709 | /** |
| 1710 | Tries to open a single-table tablespace and optionally checks the space id is |
| 1711 | right in it. If does not succeed, prints an error message to the .err log. This |
| 1712 | function is used to open a tablespace when we start up mysqld, and also in |
| 1713 | IMPORT TABLESPACE. |
| 1714 | |
| 1715 | NOTE that we assume this operation is used either at the database |
| 1716 | startup or under the protection of MDL, to prevent concurrent access |
| 1717 | to the same tablespace. |
| 1718 | |
| 1719 | @param id tablespace identifier |
| 1720 | @param flags expected FSP_SPACE_FLAGS |
| 1721 | @param validate how to validate files |
| 1722 | @param name the table name in databasename/tablename format |
| 1723 | @param path_in expected filepath, usually read from dictionary |
| 1724 | @param err DB_SUCCESS or error code |
| 1725 | @return tablespace |
| 1726 | @retval nullptr if the tablespace could not be opened */ |
| 1727 | fil_space_tcxx . . $ fil_space_t# *fil_ibd_opencxx . . $ fil_ibd_open(94c58849d3046f4d).(uint32_tcxx . . $ uint32_t# id, uint32_tcxx . . $ uint32_t# flags, |
| 1728 | fil_space_tcxx . . $ fil_space_t#::validatecxx . . $ fil_space_t#validate# validate, |
| 1729 | fil_space_tcxx . . $ fil_space_t#::name_typecxx . . $ fil_space_t#name_type# name, |
| 1730 | const char *path_in, dberr_tcxx . . $ dberr_t# *err= nullptr) noexcept; |
| 1731 | |
| 1732 | enum fil_load_statuscxx . . $ fil_load_status# { |
| 1733 | /** The tablespace file(s) were found and valid. */ |
| 1734 | FIL_LOAD_OKcxx . . $ FIL_LOAD_OK., |
| 1735 | /** The name no longer matches space_id */ |
| 1736 | FIL_LOAD_ID_CHANGEDcxx . . $ FIL_LOAD_ID_CHANGED., |
| 1737 | /** The file(s) were not found */ |
| 1738 | FIL_LOAD_NOT_FOUNDcxx . . $ FIL_LOAD_NOT_FOUND., |
| 1739 | /** The file(s) were not valid */ |
| 1740 | FIL_LOAD_INVALIDcxx . . $ FIL_LOAD_INVALID., |
| 1741 | /** The tablespace file was deferred to open */ |
| 1742 | FIL_LOAD_DEFERcxx . . $ FIL_LOAD_DEFER. |
| 1743 | }; |
| 1744 | |
| 1745 | /** Open a single-file tablespace and add it to the InnoDB data structures. |
| 1746 | @param[in] space_id tablespace ID |
| 1747 | @param[in] filename path/to/databasename/tablename.ibd |
| 1748 | @param[out] space the tablespace, or NULL on error |
| 1749 | @return status of the operation */ |
| 1750 | enum fil_load_statuscxx . . $ fil_load_status# |
| 1751 | fil_ibd_loadcxx . . $ fil_ibd_load(5389baf58e8dad20).(uint32_tcxx . . $ uint32_t# space_id, const char *filename, fil_space_tcxx . . $ fil_space_t# *&space) |
| 1752 | noexcept MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result)); |
| 1753 | |
| 1754 | /** Determine if a matching tablespace exists in the InnoDB tablespace |
| 1755 | memory cache. Note that if we have not done a crash recovery at the database |
| 1756 | startup, there may be many tablespaces which are not yet in the memory cache. |
| 1757 | @param[in] id Tablespace ID |
| 1758 | @param[in] table_flags table flags |
| 1759 | @return the tablespace |
| 1760 | @retval NULL if no matching tablespace exists in the memory cache */ |
| 1761 | fil_space_tcxx . . $ fil_space_t# *fil_space_for_table_exists_in_memcxx . . $ fil_space_for_table_exists_in_mem(3a0fe4bc6ebddf1a).(uint32_tcxx . . $ uint32_t# id, |
| 1762 | uint32_tcxx . . $ uint32_t# table_flags) noexcept; |
| 1763 | |
| 1764 | /** Try to extend a tablespace if it is smaller than the specified size. |
| 1765 | @param[in,out] space tablespace |
| 1766 | @param[in] size desired size in pages |
| 1767 | @return whether the tablespace is at least as big as requested */ |
| 1768 | bool fil_space_extendcxx . . $ fil_space_extend(70c9c99c34e96a7a).(fil_space_tcxx . . $ fil_space_t# *space, uint32_tcxx . . $ uint32_t# size) noexcept; |
| 1769 | |
| 1770 | /** Flush to disk the writes in file spaces of the given type |
| 1771 | possibly cached by the OS. */ |
| 1772 | void fil_flush_file_spacescxx . . $ fil_flush_file_spaces(ced63f7c635d850d).() noexcept; |
| 1773 | /******************************************************************//** |
| 1774 | Checks the consistency of the tablespace cache. |
| 1775 | @return true if ok */ |
| 1776 | bool fil_validatecxx . . $ fil_validate(77ce49a7840d23c7).() noexcept; |
| 1777 | |
| 1778 | /** Set the file page type. |
| 1779 | @param page file page |
| 1780 | @param type FIL_PAGE_TYPE value */ |
| 1781 | inline void fil_page_set_typecxx . . $ fil_page_set_type(4806ad2b86a16c06).(bytecxx . . $ byte# *page, uint16_tcxx . . $ uint16_t# type) noexcept |
| 1782 | { |
| 1783 | mach_write_to_2cxx . . $ mach_write_to_2(6165b45f45ef689c).(page + FIL_PAGE_TYPEcxx . . $ `storage/innobase/include/fil0fil.h:1215:9`!, type); |
| 1784 | } |
| 1785 | |
| 1786 | /********************************************************************//** |
| 1787 | Delete the tablespace file and any related files like .cfg. |
| 1788 | This should not be called for temporary tables. */ |
| 1789 | void |
| 1790 | fil_delete_filecxx . . $ fil_delete_file(aac1607cfe1c1740).( |
| 1791 | /*============*/ |
| 1792 | const char* path) /*!< in: filepath of the ibd tablespace */ |
| 1793 | noexcept; |
| 1794 | |
| 1795 | /** Look up a table space by a given id. |
| 1796 | @param id tablespace identifier |
| 1797 | @return tablespace object |
| 1798 | @retval nullptr if not found */ |
| 1799 | fil_space_tcxx . . $ fil_space_t# *fil_space_get_by_idcxx . . $ fil_space_get_by_id(fb1f3aca84eadcbc).(uint32_tcxx . . $ uint32_t# id) noexcept; |
| 1800 | |
| 1801 | /** Note that a non-predefined persistent tablespace has been modified |
| 1802 | by redo log. |
| 1803 | @param[in,out] space tablespace */ |
| 1804 | void fil_names_dirtycxx . . $ fil_names_dirty(88f69b9a9864369c).(fil_space_tcxx . . $ fil_space_t# *space) noexcept; |
| 1805 | |
| 1806 | |
| 1807 | bool fil_comp_algo_loadedcxx . . $ fil_comp_algo_loaded(b9eae780e4ee7ff5).(ulintcxx . . $ ulint# comp_algo) noexcept; |
| 1808 | |
| 1809 | /** On a log checkpoint, reset fil_names_dirty_and_write() flags |
| 1810 | and write out FILE_MODIFY if needed, and write FILE_CHECKPOINT. |
| 1811 | @param lsn checkpoint LSN |
| 1812 | @return current LSN */ |
| 1813 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! lsn_tcxx . . $ lsn_t# fil_names_clearcxx . . $ fil_names_clear(a6c5aadce0732900).(lsn_tcxx . . $ lsn_t# lsn) noexcept; |
| 1814 | |
| 1815 | #ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH |
| 1816 | void test_make_filepath(); |
| 1817 | #endif /* UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH */ |
| 1818 | |
| 1819 | /** Determine the block size of the data file. |
| 1820 | @param[in] space tablespace |
| 1821 | @param[in] offset page number |
| 1822 | @return block size */ |
| 1823 | ulintcxx . . $ ulint# fil_space_get_block_sizecxx . . $ fil_space_get_block_size(190977292e5f03e3).(const fil_space_tcxx . . $ fil_space_t#* space, unsigned offset) |
| 1824 | noexcept; |
| 1825 | |
| 1826 | /** Check whether encryption key found |
| 1827 | @param crypt_data Encryption data |
| 1828 | @param f_name File name |
| 1829 | @return encryption key found */ |
| 1830 | bool fil_crypt_checkcxx . . $ fil_crypt_check(24b3b8166e7352ba).(fil_space_crypt_tcxx . . $ fil_space_crypt_t# *crypt_data, const char *f_name) |
| 1831 | noexcept; |
| 1832 | |
| 1833 | #endif /* UNIV_INNOCHECKSUM */ |