| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | Copyright (c) 2016, 2022, 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 fsp/fsp0space.cc |
| 22 | Multi file, shared, system tablespace implementation. |
| 23 | |
| 24 | Created 2012-11-16 by Sunny Bains as srv/srv0space.cc |
| 25 | Refactored 2013-7-26 by Kevin Lewis |
| 26 | *******************************************************/ |
| 27 | |
| 28 | #include "fsp0sysspace.h"cxx . . $ `<file>/storage/innobase/include/fsp0sysspace.h`/ |
| 29 | #include "srv0start.h"cxx . . $ `<file>/storage/innobase/include/srv0start.h`/ |
| 30 | #include "trx0sys.h"cxx . . $ `<file>/storage/innobase/include/trx0sys.h`/ |
| 31 | #include "dict0load.h"cxx . . $ `<file>/storage/innobase/include/dict0load.h`/ |
| 32 | #include "mem0mem.h"cxx . . $ `<file>/storage/innobase/include/mem0mem.h`/ |
| 33 | #include "os0file.h"cxx . . $ `<file>/storage/innobase/include/os0file.h`/ |
| 34 | #include "row0mysql.h"cxx . . $ `<file>/storage/innobase/include/row0mysql.h`/ |
| 35 | #include "buf0dblwr.h"cxx . . $ `<file>/storage/innobase/include/buf0dblwr.h`/ |
| 36 | #include "log.h"cxx . . $ `<file>/sql/log.h`/ |
| 37 | |
| 38 | /** The server header file is included to access opt_initialize global variable. |
| 39 | If server passes the option for create/open DB to SE, we should remove such |
| 40 | direct reference to server header and global variable */ |
| 41 | #include "mysqld.h"cxx . . $ `<file>/sql/mysqld.h`/ |
| 42 | |
| 43 | /** The control info of the system tablespace. */ |
| 44 | SysTablespacecxx . . $ SysTablespace# srv_sys_spacecxx . . $ srv_sys_space.; |
| 45 | |
| 46 | /** The control info of a temporary table shared tablespace. */ |
| 47 | SysTablespacecxx . . $ SysTablespace# srv_tmp_spacecxx . . $ srv_tmp_space.; |
| 48 | |
| 49 | /** If the last data file is auto-extended, we add this many pages to it |
| 50 | at a time. We have to make this public because it is a config variable. */ |
| 51 | uint sys_tablespace_auto_extend_incrementcxx . . $ sys_tablespace_auto_extend_increment.; |
| 52 | |
| 53 | /** Convert a numeric string that optionally ends in G or M or K, |
| 54 | to a number containing megabytes. |
| 55 | @param[in] str String with a quantity in bytes |
| 56 | @param[out] megs The number in megabytes |
| 57 | @return next character in string */ |
| 58 | char* |
| 59 | SysTablespacecxx . . $ SysTablespace#::parse_unitscxx . . $ SysTablespace#parse_units(211d0368eb0e7028).( |
| 60 | char* ptr, |
| 61 | ulintcxx . . $ ulint#* megs) |
| 62 | { |
| 63 | char* endp; |
| 64 | |
| 65 | *megs = strtoulcxx . . $ strtoul(335a43d87d12a1b6).(ptr, &endp, 10); |
| 66 | |
| 67 | ptr = endp; |
| 68 | |
| 69 | switch (*ptr) { |
| 70 | case 'G': case 'g': |
| 71 | *megs *= 1024; |
| 72 | /* fall through */ |
| 73 | case 'M': case 'm': |
| 74 | ++ptr; |
| 75 | break; |
| 76 | case 'K': case 'k': |
| 77 | *megs /= 1024; |
| 78 | ++ptr; |
| 79 | break; |
| 80 | default: |
| 81 | *megs /= 1024 * 1024; |
| 82 | break; |
| 83 | } |
| 84 | |
| 85 | return(ptr); |
| 86 | } |
| 87 | |
| 88 | /** Parse the input params and populate member variables. |
| 89 | @param[in] filepath path to data files |
| 90 | @param[in] supports_raw true if the tablespace supports raw devices |
| 91 | @return true on success parse */ |
| 92 | bool |
| 93 | SysTablespacecxx . . $ SysTablespace#::parse_paramscxx . . $ SysTablespace#parse_params(e96b1cf346ae2c6).( |
| 94 | const char* filepath_spec, |
| 95 | bool supports_raw) |
| 96 | { |
| 97 | char* filepath; |
| 98 | ulintcxx . . $ ulint# size; |
| 99 | char* input_str; |
| 100 | ulintcxx . . $ ulint# n_files = 0; |
| 101 | |
| 102 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(m_last_file_size_max == 0); |
| 103 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!m_auto_extend_last_file); |
| 104 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!m_auto_shrink); |
| 105 | |
| 106 | char* new_str = mem_strdupcxx . . $ mem_strdup(a8b8e32347182212).(filepath_spec); |
| 107 | char* str = new_str; |
| 108 | |
| 109 | input_str = str; |
| 110 | |
| 111 | /*---------------------- PASS 1 ---------------------------*/ |
| 112 | /* First calculate the number of data files and check syntax: |
| 113 | filepath:size[K |M | G];filepath:size[K |M | G]... . |
| 114 | Note that a Windows path may contain a drive name and a ':'. */ |
| 115 | while (*str != '\0') { |
| 116 | filepath = str; |
| 117 | |
| 118 | while ((*str != ':' && *str != '\0') |
| 119 | || (*str == ':' |
| 120 | && (*(str + 1) == '\\' || *(str + 1) == '/' |
| 121 | || *(str + 1) == ':'))) { |
| 122 | str++; |
| 123 | } |
| 124 | |
| 125 | if (*str == '\0') { |
| 126 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 127 | |
| 128 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 129 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "syntax error in file path or size" |
| 130 | " specified is less than 1 megabyte"; |
| 131 | return(false); |
| 132 | } |
| 133 | |
| 134 | str++; |
| 135 | |
| 136 | str = parse_unitscxx . . $ SysTablespace#parse_units(211d0368eb0e7028).(str, &size); |
| 137 | |
| 138 | if (0 == strncmp(str, ":autoextend", |
| 139 | (sizeof ":autoextend") - 1)) { |
| 140 | |
| 141 | str += (sizeof ":autoextend") - 1; |
| 142 | |
| 143 | if (0 == strncmp(str, ":max:", |
| 144 | (sizeof ":max:") - 1)) { |
| 145 | |
| 146 | str += (sizeof ":max:") - 1; |
| 147 | |
| 148 | str = parse_unitscxx . . $ SysTablespace#parse_units(211d0368eb0e7028).(str, &size); |
| 149 | } |
| 150 | |
| 151 | if (0 == strncmp(str, ":autoshrink", |
| 152 | (sizeof ":autoshrink") - 1)) { |
| 153 | str += (sizeof ":autoshrink") - 1; |
| 154 | } |
| 155 | |
| 156 | if (*str != '\0') { |
| 157 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 158 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 159 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "syntax error in file path or" |
| 160 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " size specified is less than" |
| 161 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " 1 megabyte"; |
| 162 | return(false); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | if (::strlen(str) >= 6 |
| 167 | && *str == 'n' |
| 168 | && *(str + 1) == 'e' |
| 169 | && *(str + 2) == 'w') { |
| 170 | |
| 171 | if (!supports_raw) { |
| 172 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 173 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Tablespace doesn't support raw" |
| 174 | " devices"; |
| 175 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 176 | return(false); |
| 177 | } |
| 178 | |
| 179 | str += 3; |
| 180 | } |
| 181 | |
| 182 | if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') { |
| 183 | str += 3; |
| 184 | |
| 185 | if (!supports_raw) { |
| 186 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 187 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Tablespace doesn't support raw" |
| 188 | " devices"; |
| 189 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 190 | return(false); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | if (size == 0) { |
| 195 | |
| 196 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 197 | |
| 198 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 199 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "syntax error in file path or size" |
| 200 | " specified is less than 1 megabyte"; |
| 201 | |
| 202 | return(false); |
| 203 | } |
| 204 | |
| 205 | ++n_files; |
| 206 | |
| 207 | if (*str == ';') { |
| 208 | str++; |
| 209 | } else if (*str != '\0') { |
| 210 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 211 | |
| 212 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 213 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "syntax error in file path or size" |
| 214 | " specified is less than 1 megabyte"; |
| 215 | return(false); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | if (n_files == 0) { |
| 220 | |
| 221 | /* filepath_spec must contain at least one data file |
| 222 | definition */ |
| 223 | |
| 224 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 225 | |
| 226 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 227 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "syntax error in file path or size specified" |
| 228 | " is less than 1 megabyte"; |
| 229 | |
| 230 | return(false); |
| 231 | } |
| 232 | |
| 233 | /*---------------------- PASS 2 ---------------------------*/ |
| 234 | /* Then store the actual values to our arrays */ |
| 235 | str = input_str; |
| 236 | ulintcxx . . $ ulint# order = 0; |
| 237 | |
| 238 | while (*str != '\0') { |
| 239 | filepath = str; |
| 240 | |
| 241 | /* Note that we must step over the ':' in a Windows filepath; |
| 242 | a Windows path normally looks like C:\ibdata\ibdata1:1G, but |
| 243 | a Windows raw partition may have a specification like |
| 244 | \\.\C::1Gnewraw or \\.\PHYSICALDRIVE2:1Gnewraw */ |
| 245 | |
| 246 | while ((*str != ':' && *str != '\0') |
| 247 | || (*str == ':' |
| 248 | && (*(str + 1) == '\\' || *(str + 1) == '/' |
| 249 | || *(str + 1) == ':'))) { |
| 250 | str++; |
| 251 | } |
| 252 | |
| 253 | if (*str == ':') { |
| 254 | /* Make filepath a null-terminated string */ |
| 255 | *str = '\0'; |
| 256 | str++; |
| 257 | } |
| 258 | |
| 259 | str = parse_unitscxx . . $ SysTablespace#parse_units(211d0368eb0e7028).(str, &size); |
| 260 | |
| 261 | if (0 == strncmp(str, ":autoextend", |
| 262 | (sizeof ":autoextend") - 1)) { |
| 263 | |
| 264 | m_auto_extend_last_filecxx . . $ SysTablespace#m_auto_extend_last_file. = true; |
| 265 | |
| 266 | str += (sizeof ":autoextend") - 1; |
| 267 | |
| 268 | if (0 == strncmp(str, ":max:", |
| 269 | (sizeof ":max:") - 1)) { |
| 270 | |
| 271 | str += (sizeof ":max:") - 1; |
| 272 | |
| 273 | str = parse_unitscxx . . $ SysTablespace#parse_units(211d0368eb0e7028).(str, &m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max.); |
| 274 | } |
| 275 | |
| 276 | if (0 == strncmp(str, ":autoshrink", |
| 277 | (sizeof ":autoshrink") - 1)) { |
| 278 | str += (sizeof ":autoshrink") - 1; |
| 279 | m_auto_shrinkcxx . . $ SysTablespace#m_auto_shrink. = true; |
| 280 | } |
| 281 | |
| 282 | if (*str != '\0') { |
| 283 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 284 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "syntax error in file path or" |
| 285 | " size specified is less than 1" |
| 286 | " megabyte"; |
| 287 | return(false); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | m_filescxx . . $ Tablespace#m_files..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(Datafilecxx . . $ Datafile#Datafile(a30eb5e4a3566ff4).(flagscxx . . $ Tablespace#flags(ddd8539a2fcdd4ce).(), uint32_tcxx . . $ uint32_t#(size), order)); |
| 292 | m_filescxx . . $ Tablespace#m_files..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().make_filepathcxx . . $ Datafile#make_filepath(425f5835150c9854).(pathcxx . . $ Tablespace#path(a9f41ea0e82d88cf).(), |
| 293 | {cxx . . $ st_/span#span(afd8256c216b84b2).filepath, strlen(filepath)}, |
| 294 | NO_EXTcxx . . $ NO_EXT.); |
| 295 | |
| 296 | if (::strlen(str) >= 6 |
| 297 | && *str == 'n' |
| 298 | && *(str + 1) == 'e' |
| 299 | && *(str + 2) == 'w') { |
| 300 | |
| 301 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(supports_raw); |
| 302 | |
| 303 | str += 3; |
| 304 | |
| 305 | /* Initialize new raw device only during initialize */ |
| 306 | /* JAN: TODO: MySQL 5.7 used opt_initialize */ |
| 307 | m_filescxx . . $ Tablespace#m_files..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().m_typecxx . . $ Datafile#m_type. = |
| 308 | opt_bootstrapcxx . . $ opt_bootstrap. ? SRV_NEW_RAWcxx . . $ SRV_NEW_RAW. : SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.; |
| 309 | } |
| 310 | |
| 311 | if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') { |
| 312 | |
| 313 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(supports_raw); |
| 314 | |
| 315 | str += 3; |
| 316 | |
| 317 | /* Initialize new raw device only during initialize */ |
| 318 | if (m_filescxx . . $ Tablespace#m_files..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().m_typecxx . . $ Datafile#m_type. == SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.) { |
| 319 | /* JAN: TODO: MySQL 5.7 used opt_initialize */ |
| 320 | m_filescxx . . $ Tablespace#m_files..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).().m_typecxx . . $ Datafile#m_type. = |
| 321 | opt_bootstrapcxx . . $ opt_bootstrap. ? SRV_NEW_RAWcxx . . $ SRV_NEW_RAW. : SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | if (*str == ';') { |
| 326 | ++str; |
| 327 | } |
| 328 | order++; |
| 329 | } |
| 330 | |
| 331 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(n_files == ulint(m_files.size())); |
| 332 | |
| 333 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(new_str); |
| 334 | |
| 335 | return(true); |
| 336 | } |
| 337 | |
| 338 | /** Frees the memory allocated by the parse method. */ |
| 339 | void |
| 340 | SysTablespacecxx . . $ SysTablespace#::shutdowncxx . . $ SysTablespace#shutdown(49f6e7a06ebc5aa8).() |
| 341 | { |
| 342 | Tablespacecxx . . $ Tablespace#::shutdowncxx . . $ Tablespace#shutdown(49f6e7a06ebc5aa8).(); |
| 343 | |
| 344 | m_auto_extend_last_filecxx . . $ SysTablespace#m_auto_extend_last_file. = 0; |
| 345 | m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max. = 0; |
| 346 | m_created_new_rawcxx . . $ SysTablespace#m_created_new_raw. = 0; |
| 347 | m_is_tablespace_fullcxx . . $ SysTablespace#m_is_tablespace_full. = false; |
| 348 | m_sanity_checks_donecxx . . $ SysTablespace#m_sanity_checks_done. = false; |
| 349 | m_auto_shrinkcxx . . $ SysTablespace#m_auto_shrink. = false; |
| 350 | } |
| 351 | |
| 352 | /** Verify the size of the physical file. |
| 353 | @param[in] file data file object |
| 354 | @return DB_SUCCESS if OK else error code. */ |
| 355 | dberr_tcxx . . $ dberr_t# |
| 356 | SysTablespacecxx . . $ SysTablespace#::check_sizecxx . . $ SysTablespace#check_size(da6fdb6f1c982e05).( |
| 357 | Datafilecxx . . $ Datafile#& file) |
| 358 | { |
| 359 | os_offset_tcxx . . $ os_offset_t# size = os_file_get_sizecxx . . $ os_file_get_size(a516d6ace67a1470).(file.m_handlecxx . . $ Datafile#m_handle.); |
| 360 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(size != (os_offset_t) -1); |
| 361 | |
| 362 | /* Under some error conditions like disk full scenarios |
| 363 | or file size reaching filesystem limit the data file |
| 364 | could contain an incomplete extent at the end. When we |
| 365 | extend a data file and if some failure happens, then |
| 366 | also the data file could contain an incomplete extent. |
| 367 | So we need to round the size downward to a megabyte.*/ |
| 368 | |
| 369 | const uint32_tcxx . . $ uint32_t# rounded_size_pages = static_cast<uint32_tcxx . . $ uint32_t#>( |
| 370 | size >> srv_page_size_shiftcxx . . $ srv_page_size_shift.); |
| 371 | |
| 372 | /* If last file */ |
| 373 | if (&file == &m_filescxx . . $ Tablespace#m_files..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).() && m_auto_extend_last_filecxx . . $ SysTablespace#m_auto_extend_last_file.) { |
| 374 | |
| 375 | if (file.m_sizecxx . . $ Datafile#m_size. > rounded_size_pages |
| 376 | || (m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max. > 0 |
| 377 | && m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max. < rounded_size_pages)) { |
| 378 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The Auto-extending data file '" |
| 379 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 380 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' is of a different size " |
| 381 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). rounded_size_pages |
| 382 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " pages than specified" |
| 383 | " by innodb_data_file_path"; |
| 384 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 385 | } |
| 386 | |
| 387 | file.m_sizecxx . . $ Datafile#m_size. = rounded_size_pages; |
| 388 | } |
| 389 | |
| 390 | if (rounded_size_pages != file.m_sizecxx . . $ Datafile#m_size.) { |
| 391 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The data file '" |
| 392 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' is of a different size " |
| 393 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). rounded_size_pages <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " pages" |
| 394 | " than the " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.m_sizecxx . . $ Datafile#m_size. <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " pages specified by" |
| 395 | " innodb_data_file_path"; |
| 396 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 397 | } |
| 398 | |
| 399 | return(DB_SUCCESScxx . . $ DB_SUCCESS.); |
| 400 | } |
| 401 | |
| 402 | /** Set the size of the file. |
| 403 | @param[in] file data file object |
| 404 | @return DB_SUCCESS or error code */ |
| 405 | dberr_tcxx . . $ dberr_t# |
| 406 | SysTablespacecxx . . $ SysTablespace#::set_sizecxx . . $ SysTablespace#set_size(da6fdb6f1c982e05).( |
| 407 | Datafilecxx . . $ Datafile#& file) |
| 408 | { |
| 409 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_read_only_mode || m_ignore_read_only); |
| 410 | const ibcxx . . $ ib/::bytes_ieccxx . . $ ib/bytes_iec# bcxx . . $ ib/bytes_iec#bytes_iec(891dc3055356b409).{uint64_tcxx . . $ uint64_t#{file.m_sizecxx . . $ Datafile#m_size.} << srv_page_size_shiftcxx . . $ srv_page_size_shift.}; |
| 411 | |
| 412 | /* We created the data file and now write it full of zeros */ |
| 413 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Setting file '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' size to " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). b |
| 414 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). ". Physically writing the file full; Please wait ..."; |
| 415 | |
| 416 | bool success = os_file_set_sizecxx . . $ os_file_set_size(c5e330475387994b).( |
| 417 | file.m_filepathcxx . . $ Datafile#m_filepath., file.m_handlecxx . . $ Datafile#m_handle., |
| 418 | static_cast<os_offset_tcxx . . $ os_offset_t#>(file.m_sizecxx . . $ Datafile#m_size.) << srv_page_size_shiftcxx . . $ srv_page_size_shift.); |
| 419 | |
| 420 | if (success) { |
| 421 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "File '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' size is now " |
| 422 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). b |
| 423 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "."; |
| 424 | } else { |
| 425 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Could not set the file size of '" |
| 426 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "'. Probably out of disk space"; |
| 427 | |
| 428 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 429 | } |
| 430 | |
| 431 | return(DB_SUCCESScxx . . $ DB_SUCCESS.); |
| 432 | } |
| 433 | |
| 434 | /** Create a data file. |
| 435 | @param[in] file data file object |
| 436 | @return DB_SUCCESS or error code */ |
| 437 | dberr_tcxx . . $ dberr_t# |
| 438 | SysTablespacecxx . . $ SysTablespace#::create_filecxx . . $ SysTablespace#create_file(da6fdb6f1c982e05).( |
| 439 | Datafilecxx . . $ Datafile#& file) |
| 440 | { |
| 441 | dberr_tcxx . . $ dberr_t# err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 442 | |
| 443 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(!file.m_exists); |
| 444 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_read_only_mode || m_ignore_read_only); |
| 445 | |
| 446 | switch (file.m_typecxx . . $ Datafile#m_type.) { |
| 447 | case SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.: |
| 448 | |
| 449 | /* The partition is opened, not created; then it is |
| 450 | written over */ |
| 451 | m_created_new_rawcxx . . $ SysTablespace#m_created_new_raw. = true; |
| 452 | |
| 453 | /* Fall through. */ |
| 454 | |
| 455 | case SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.: |
| 456 | |
| 457 | srv_start_raw_disk_in_usecxx . . $ srv_start_raw_disk_in_use. = TRUEcxx . . $ `include/my_global.h:476:9`!; |
| 458 | |
| 459 | /* Fall through. */ |
| 460 | |
| 461 | case SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.: |
| 462 | err = file.open_or_createcxx . . $ Datafile#open_or_create(d04655808700f477).( |
| 463 | !m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only. && srv_read_only_modecxx . . $ srv_read_only_mode.); |
| 464 | break; |
| 465 | } |
| 466 | |
| 467 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 468 | return err; |
| 469 | } |
| 470 | |
| 471 | switch (file.m_typecxx . . $ Datafile#m_type.) { |
| 472 | case SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.: |
| 473 | break; |
| 474 | case SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.: |
| 475 | #ifndef _WIN32 |
| 476 | if (!space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).() && my_disable_locking |
| 477 | && os_file_lockcxx . . $ os_file_lock(7e790de9bbf2a1ce).(file.m_handlecxx . . $ Datafile#m_handle., file.m_filepathcxx . . $ Datafile#m_filepath.)) { |
| 478 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 479 | break; |
| 480 | } |
| 481 | #endif |
| 482 | /* fall through */ |
| 483 | case SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.: |
| 484 | err = set_sizecxx . . $ SysTablespace#set_size(da6fdb6f1c982e05).(file); |
| 485 | } |
| 486 | |
| 487 | return(err); |
| 488 | } |
| 489 | |
| 490 | /** Open a data file. |
| 491 | @param[in] file data file object |
| 492 | @return DB_SUCCESS or error code */ |
| 493 | dberr_tcxx . . $ dberr_t# |
| 494 | SysTablespacecxx . . $ SysTablespace#::open_filecxx . . $ SysTablespace#open_file(da6fdb6f1c982e05).( |
| 495 | Datafilecxx . . $ Datafile#& file) |
| 496 | { |
| 497 | dberr_tcxx . . $ dberr_t# err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 498 | |
| 499 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(file.m_exists); |
| 500 | |
| 501 | switch (file.m_typecxx . . $ Datafile#m_type.) { |
| 502 | case SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.: |
| 503 | /* The partition is opened, not created; then it is |
| 504 | written over */ |
| 505 | m_created_new_rawcxx . . $ SysTablespace#m_created_new_raw. = true; |
| 506 | |
| 507 | /* Fall through */ |
| 508 | |
| 509 | case SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.: |
| 510 | srv_start_raw_disk_in_usecxx . . $ srv_start_raw_disk_in_use. = TRUEcxx . . $ `include/my_global.h:476:9`!; |
| 511 | |
| 512 | if (srv_read_only_modecxx . . $ srv_read_only_mode. && !m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only.) { |
| 513 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Can't open a raw device '" |
| 514 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.m_filepathcxx . . $ Datafile#m_filepath. <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' when" |
| 515 | " --innodb-read-only is set"; |
| 516 | |
| 517 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 518 | } |
| 519 | |
| 520 | /* Fall through */ |
| 521 | |
| 522 | case SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.: |
| 523 | err = file.open_or_createcxx . . $ Datafile#open_or_create(d04655808700f477).( |
| 524 | !m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only. && srv_read_only_modecxx . . $ srv_read_only_mode.); |
| 525 | |
| 526 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 527 | return(err); |
| 528 | } |
| 529 | break; |
| 530 | } |
| 531 | |
| 532 | switch (file.m_typecxx . . $ Datafile#m_type.) { |
| 533 | case SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.: |
| 534 | /* Set file size for new raw device. */ |
| 535 | err = set_sizecxx . . $ SysTablespace#set_size(da6fdb6f1c982e05).(file); |
| 536 | break; |
| 537 | |
| 538 | case SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.: |
| 539 | #ifndef _WIN32 |
| 540 | if (!space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).() && (m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only. || !srv_read_only_modecxx . . $ srv_read_only_mode.) |
| 541 | && my_disable_locking |
| 542 | && os_file_lockcxx . . $ os_file_lock(7e790de9bbf2a1ce).(file.m_handlecxx . . $ Datafile#m_handle., file.m_filepathcxx . . $ Datafile#m_filepath.)) { |
| 543 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 544 | break; |
| 545 | } |
| 546 | #endif |
| 547 | /* Check file size for existing file. */ |
| 548 | err = check_sizecxx . . $ SysTablespace#check_size(da6fdb6f1c982e05).(file); |
| 549 | break; |
| 550 | |
| 551 | case SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.: |
| 552 | err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 553 | break; |
| 554 | |
| 555 | } |
| 556 | |
| 557 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 558 | file.closecxx . . $ Datafile#close(629d9d73bf1a44e9).(); |
| 559 | } |
| 560 | |
| 561 | return(err); |
| 562 | } |
| 563 | |
| 564 | /** Check the tablespace header for this tablespace. |
| 565 | @return DB_SUCCESS or error code */ |
| 566 | inline dberr_tcxx . . $ dberr_t# SysTablespacecxx . . $ SysTablespace#::read_lsn_and_check_flagscxx . . $ SysTablespace#read_lsn_and_check_flags(629d9d73bf1a44e9).() |
| 567 | { |
| 568 | dberr_tcxx . . $ dberr_t# err; |
| 569 | |
| 570 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# it = m_filescxx . . $ Tablespace#m_files..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 571 | |
| 572 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(it->m_exists); |
| 573 | |
| 574 | if (it->m_handlecxx . . $ Datafile#m_handle. ==cxx . . $ pfs_os_file_t#`operator==`(4a668f6de69bf818). OS_FILE_CLOSEDcxx . . $ OS_FILE_CLOSED.) { |
| 575 | |
| 576 | err = it->open_or_createcxx . . $ Datafile#open_or_create(d04655808700f477).( |
| 577 | m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only. ? false : srv_read_only_modecxx . . $ srv_read_only_mode.); |
| 578 | |
| 579 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 580 | return(err); |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | err = it->read_first_pagecxx . . $ Datafile#read_first_page(d04655808700f477).( |
| 585 | m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only. && srv_read_only_modecxx . . $ srv_read_only_mode.); |
| 586 | |
| 587 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 588 | return(err); |
| 589 | } |
| 590 | |
| 591 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(it->order() == 0); |
| 592 | |
| 593 | if (srv_operationcxx . . $ srv_operation. <= SRV_OPERATION_EXPORT_RESTOREDcxx . . $ SRV_OPERATION_EXPORT_RESTORED.) { |
| 594 | buf_dblwrcxx . . $ buf_dblwr..init_or_load_pagescxx . . $ buf_dblwr_t#init_or_load_pages(dac20939214749d9).(it->handlecxx . . $ Datafile#handle(81061095d0000f66).(), it->filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).()); |
| 595 | } |
| 596 | |
| 597 | /* Check the contents of the first page of the |
| 598 | first datafile. */ |
| 599 | err = it->validate_first_pagecxx . . $ Datafile#validate_first_page(533096b55fccbc67).(it->m_first_pagecxx . . $ Datafile#m_first_page.); |
| 600 | const page_tcxx . . $ `storage/innobase/include/page0types.h:38:9`! *first_page = it->m_first_pagecxx . . $ Datafile#m_first_page.; |
| 601 | |
| 602 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 603 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&recv_sys.mutex); |
| 604 | first_page = recv_syscxx . . $ recv_sys..dblwrcxx . . $ recv_sys_t#dblwr..find_pagecxx . . $ recv_dblwr_t#find_page(4b0b53387b33bea6).( |
| 605 | page_id_tcxx . . $ page_id_t#page_id_t(b4d55b1286ff73e8).(space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).(), 0), LSN_MAXcxx . . $ `storage/innobase/include/log0types.h:34:9`!); |
| 606 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&recv_sys.mutex); |
| 607 | if (!first_page) { |
| 608 | err = DB_CORRUPTIONcxx . . $ DB_CORRUPTION.; |
| 609 | } else { |
| 610 | err = it->read_first_page_flagscxx . . $ Datafile#read_first_page_flags(533096b55fccbc67).(first_page); |
| 611 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 612 | err = it->validate_first_pagecxx . . $ Datafile#validate_first_page(533096b55fccbc67).(first_page); |
| 613 | } |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | /* Make sure the tablespace space ID matches the |
| 618 | space ID on the first page of the first datafile. */ |
| 619 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS. || space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).() != it->m_space_idcxx . . $ Datafile#m_space_id.) { |
| 620 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: The data file '%s'" |
| 621 | " has the wrong space ID." |
| 622 | " It should be " UINT32PFcxx . . $ `storage/innobase/include/univ.i:312:10`! ", but " UINT32PFcxx . . $ `storage/innobase/include/univ.i:312:10`! |
| 623 | " was found", it->filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).(), |
| 624 | space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).(), it->m_space_idcxx . . $ Datafile#m_space_id.); |
| 625 | it->closecxx . . $ Datafile#close(629d9d73bf1a44e9).(); |
| 626 | return err; |
| 627 | } |
| 628 | |
| 629 | if (!log_syscxx . . $ log_sys..file_sizecxx . . $ log_t#file_size. && log_syscxx . . $ log_sys..formatcxx . . $ log_t#format. == log_tcxx . . $ log_t#::FORMAT_3_23cxx . . $ log_t#FORMAT_3_23. |
| 630 | && srv_operationcxx . . $ srv_operation. == SRV_OPERATION_NORMALcxx . . $ SRV_OPERATION_NORMAL. |
| 631 | && srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_LOG_REDOcxx . . $ SRV_FORCE_NO_LOG_REDO.) { |
| 632 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_lockcxx . . $ ssux_lock_impl#wr_lock(ced63f7c635d850d).(); |
| 633 | /* Upgrade from 0-sized ib_logfile0. */ |
| 634 | log_syscxx . . $ log_sys..last_checkpoint_lsncxx . . $ log_t#last_checkpoint_lsn. =cxx . . $ Atomic_relaxed#`operator=`(ada6a8422704cf8a). mach_read_from_8cxx . . $ mach_read_from_8(b191ace3c5bffbd9).( |
| 635 | first_page + 26/*FIL_PAGE_FILE_FLUSH_LSN*/); |
| 636 | if (log_syscxx . . $ log_sys..last_checkpoint_lsncxx . . $ log_t#last_checkpoint_lsn. < 8204) { |
| 637 | /* Before MDEV-14425, InnoDB had a minimum LSN |
| 638 | of 8192+12=8204. Likewise, mariadb-backup |
| 639 | --prepare would create an empty ib_logfile0 |
| 640 | after applying the log. We will allow an |
| 641 | upgrade from such an empty log. */ |
| 642 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: ib_logfile0 is " |
| 643 | "empty, and LSN is unknown."); |
| 644 | err = DB_CORRUPTIONcxx . . $ DB_CORRUPTION.; |
| 645 | } else { |
| 646 | recv_syscxx . . $ recv_sys..lsncxx . . $ recv_sys_t#lsn. = recv_syscxx . . $ recv_sys..file_checkpointcxx . . $ recv_sys_t#file_checkpoint. = |
| 647 | log_syscxx . . $ log_sys..last_checkpoint_lsncxx . . $ log_t#last_checkpoint_lsn.; |
| 648 | log_syscxx . . $ log_sys..set_recovered_lsncxx . . $ log_t#set_recovered_lsn(203741fbd813a59e).(recv_syscxx . . $ recv_sys..lsncxx . . $ recv_sys_t#lsn.); |
| 649 | log_syscxx . . $ log_sys..next_checkpoint_nocxx . . $ log_t#next_checkpoint_no. = 0; |
| 650 | } |
| 651 | |
| 652 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_unlockcxx . . $ ssux_lock_impl#wr_unlock(ced63f7c635d850d).(); |
| 653 | } |
| 654 | |
| 655 | it->closecxx . . $ Datafile#close(629d9d73bf1a44e9).(); |
| 656 | return err; |
| 657 | } |
| 658 | |
| 659 | /** Check if a file can be opened in the correct mode. |
| 660 | @param[in] file data file object |
| 661 | @param[out] reason exact reason if file_status check failed. |
| 662 | @return DB_SUCCESS or error code. */ |
| 663 | dberr_tcxx . . $ dberr_t# |
| 664 | SysTablespacecxx . . $ SysTablespace#::check_file_statuscxx . . $ SysTablespace#check_file_status(9bf29976a813e381).( |
| 665 | const Datafilecxx . . $ Datafile#& file, |
| 666 | file_status_tcxx . . $ SysTablespace#file_status_t#& reason) |
| 667 | { |
| 668 | os_file_stat_tcxx . . $ os_file_stat_t# stat; |
| 669 | |
| 670 | memset(&stat, 0x0, sizeof(stat)); |
| 671 | |
| 672 | dberr_tcxx . . $ dberr_t# err = os_file_get_statuscxx . . $ os_file_get_status(b4857cad02b801a9).( |
| 673 | file.m_filepathcxx . . $ Datafile#m_filepath., &stat, true, |
| 674 | m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only. ? false : srv_read_only_modecxx . . $ srv_read_only_mode.); |
| 675 | |
| 676 | reason = FILE_STATUS_VOIDcxx . . $ SysTablespace#FILE_STATUS_VOID.; |
| 677 | /* File exists but we can't read the rw-permission settings. */ |
| 678 | switch (err) { |
| 679 | case DB_FAILcxx . . $ DB_FAIL.: |
| 680 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "os_file_get_status() failed on '" |
| 681 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 682 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "'. Can't determine file permissions"; |
| 683 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 684 | reason = FILE_STATUS_RW_PERMISSION_ERRORcxx . . $ SysTablespace#FILE_STATUS_RW_PERMISSION_ERROR.; |
| 685 | break; |
| 686 | |
| 687 | case DB_SUCCESScxx . . $ DB_SUCCESS.: |
| 688 | /* Note: stat.rw_perm is only valid for "regular" files */ |
| 689 | |
| 690 | if (stat.typecxx . . $ os_file_stat_t#type. == OS_FILE_TYPE_FILEcxx . . $ OS_FILE_TYPE_FILE.) { |
| 691 | if (!stat.rw_permcxx . . $ os_file_stat_t#rw_perm.) { |
| 692 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The data file" |
| 693 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 694 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). ((!srv_read_only_modecxx . . $ srv_read_only_mode. |
| 695 | || m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only.) |
| 696 | ? "' must be writable" |
| 697 | : "' must be readable"); |
| 698 | |
| 699 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 700 | reason = FILE_STATUS_READ_WRITE_ERRORcxx . . $ SysTablespace#FILE_STATUS_READ_WRITE_ERROR.; |
| 701 | } |
| 702 | |
| 703 | } else { |
| 704 | /* Not a regular file, bail out. */ |
| 705 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The data file '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 706 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' is not a regular file."; |
| 707 | |
| 708 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 709 | reason = FILE_STATUS_NOT_REGULAR_FILE_ERRORcxx . . $ SysTablespace#FILE_STATUS_NOT_REGULAR_FILE_ERROR.; |
| 710 | } |
| 711 | break; |
| 712 | |
| 713 | case DB_NOT_FOUNDcxx . . $ DB_NOT_FOUND.: |
| 714 | break; |
| 715 | |
| 716 | default: |
| 717 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(0); |
| 718 | } |
| 719 | |
| 720 | return(err); |
| 721 | } |
| 722 | |
| 723 | /** Note that the data file was not found. |
| 724 | @param[in] file data file object |
| 725 | @param[out] create_new_db true if a new instance to be created |
| 726 | @return DB_SUCESS or error code */ |
| 727 | dberr_tcxx . . $ dberr_t# |
| 728 | SysTablespacecxx . . $ SysTablespace#::file_not_foundcxx . . $ SysTablespace#file_not_found(1f5a170904628b81).( |
| 729 | Datafilecxx . . $ Datafile#& file, |
| 730 | bool* create_new_db) |
| 731 | { |
| 732 | file.m_existscxx . . $ Datafile#m_exists. = false; |
| 733 | |
| 734 | if (m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only.) { |
| 735 | } else if (srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 736 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Can't create file '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 737 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' when --innodb-read-only is set"; |
| 738 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 739 | } else if (srv_force_recoverycxx . . $ srv_force_recovery. && space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).() == TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE.) { |
| 740 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Can't create file '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 741 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' when --innodb-force-recovery is set"; |
| 742 | return DB_ERRORcxx . . $ DB_ERROR.; |
| 743 | } |
| 744 | |
| 745 | if (&file == &m_filescxx . . $ Tablespace#m_files..frontcxx . . $ std/vector#front(6baabfa6fc7b3a8e).()) { |
| 746 | |
| 747 | /* First data file. */ |
| 748 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(!*create_new_db); |
| 749 | *create_new_db = TRUEcxx . . $ `include/my_global.h:476:9`!; |
| 750 | |
| 751 | if (space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).() == TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE.) { |
| 752 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The first data file '" |
| 753 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' did not exist." |
| 754 | " A new tablespace will be created!"; |
| 755 | } |
| 756 | |
| 757 | } else { |
| 758 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Need to create a new data file '" |
| 759 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). file.filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "'."; |
| 760 | } |
| 761 | |
| 762 | /* Set the file create mode. */ |
| 763 | switch (file.m_typecxx . . $ Datafile#m_type.) { |
| 764 | case SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.: |
| 765 | file.set_open_flagscxx . . $ Datafile#set_open_flags(f9124c22b6e6ac0).(OS_FILE_CREATEcxx . . $ OS_FILE_CREATE.); |
| 766 | break; |
| 767 | |
| 768 | case SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.: |
| 769 | case SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.: |
| 770 | file.set_open_flagscxx . . $ Datafile#set_open_flags(f9124c22b6e6ac0).(OS_FILE_OPEN_RAWcxx . . $ OS_FILE_OPEN_RAW.); |
| 771 | break; |
| 772 | } |
| 773 | |
| 774 | return(DB_SUCCESScxx . . $ DB_SUCCESS.); |
| 775 | } |
| 776 | |
| 777 | /** Note that the data file was found. |
| 778 | @param[in,out] file data file object |
| 779 | @return true if a new instance to be created */ |
| 780 | bool |
| 781 | SysTablespacecxx . . $ SysTablespace#::file_foundcxx . . $ SysTablespace#file_found(5b65add6ebdff51f).( |
| 782 | Datafilecxx . . $ Datafile#& file) |
| 783 | { |
| 784 | /* Note that the file exists and can be opened |
| 785 | in the appropriate mode. */ |
| 786 | file.m_existscxx . . $ Datafile#m_exists. = true; |
| 787 | |
| 788 | /* Set the file open mode */ |
| 789 | switch (file.m_typecxx . . $ Datafile#m_type.) { |
| 790 | case SRV_NOT_RAWcxx . . $ SRV_NOT_RAW.: |
| 791 | file.set_open_flagscxx . . $ Datafile#set_open_flags(f9124c22b6e6ac0).( |
| 792 | &file == &m_filescxx . . $ Tablespace#m_files..frontcxx . . $ std/vector#front(6baabfa6fc7b3a8e).() |
| 793 | ? OS_FILE_OPEN_RETRYcxx . . $ OS_FILE_OPEN_RETRY. : OS_FILE_OPENcxx . . $ OS_FILE_OPEN.); |
| 794 | break; |
| 795 | |
| 796 | case SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.: |
| 797 | case SRV_OLD_RAWcxx . . $ SRV_OLD_RAW.: |
| 798 | file.set_open_flagscxx . . $ Datafile#set_open_flags(f9124c22b6e6ac0).(OS_FILE_OPEN_RAWcxx . . $ OS_FILE_OPEN_RAW.); |
| 799 | break; |
| 800 | } |
| 801 | |
| 802 | /* Need to create the system tablespace for new raw device. */ |
| 803 | return(file.m_typecxx . . $ Datafile#m_type. == SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.); |
| 804 | } |
| 805 | |
| 806 | /** Check the data file specification. |
| 807 | @param[out] create_new_db true if a new database is to be created |
| 808 | @param[in] min_expected_size Minimum expected tablespace size in bytes |
| 809 | @return DB_SUCCESS if all OK else error code */ |
| 810 | dberr_tcxx . . $ dberr_t# |
| 811 | SysTablespacecxx . . $ SysTablespace#::check_file_speccxx . . $ SysTablespace#check_file_spec(8a501ed6ab1d5d38).( |
| 812 | bool* create_new_db, |
| 813 | ulintcxx . . $ ulint# min_expected_size) |
| 814 | { |
| 815 | *create_new_db = FALSEcxx . . $ `include/my_global.h:477:9`!; |
| 816 | |
| 817 | if (m_filescxx . . $ Tablespace#m_files..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() >= 1000) { |
| 818 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "There must be < 1000 data files " |
| 819 | " but " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). m_filescxx . . $ Tablespace#m_files..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " have been" |
| 820 | " defined."; |
| 821 | |
| 822 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 823 | } |
| 824 | |
| 825 | if (!m_auto_extend_last_filecxx . . $ SysTablespace#m_auto_extend_last_file. |
| 826 | && get_sum_of_sizescxx . . $ Tablespace#get_sum_of_sizes(ddd8539a2fcdd4ce).() |
| 827 | < (min_expected_size >> srv_page_size_shiftcxx . . $ srv_page_size_shift.)) { |
| 828 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Tablespace size must be at least " |
| 829 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). (min_expected_size >> 20) <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " MB"; |
| 830 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 831 | } |
| 832 | |
| 833 | dberr_tcxx . . $ dberr_t# err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 834 | |
| 835 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(!m_files.empty()); |
| 836 | |
| 837 | /* If there is more than one data file and the last data file |
| 838 | doesn't exist, that is OK. We allow adding of new data files. */ |
| 839 | |
| 840 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# begin = m_filescxx . . $ Tablespace#m_files..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 841 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# end = m_filescxx . . $ Tablespace#m_files..endcxx . . $ std/vector#end(55a6de06420d4903).(); |
| 842 | |
| 843 | for (files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# it = begin; it != end; ++it) { |
| 844 | |
| 845 | file_status_tcxx . . $ SysTablespace#file_status_t# reason_if_failed; |
| 846 | err = check_file_statuscxx . . $ SysTablespace#check_file_status(9bf29976a813e381).(*it, reason_if_failed); |
| 847 | |
| 848 | if (err == DB_NOT_FOUNDcxx . . $ DB_NOT_FOUND.) { |
| 849 | |
| 850 | err = file_not_foundcxx . . $ SysTablespace#file_not_found(1f5a170904628b81).(*it, create_new_db); |
| 851 | |
| 852 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 853 | break; |
| 854 | } |
| 855 | |
| 856 | } else if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 857 | if (reason_if_failed == FILE_STATUS_READ_WRITE_ERRORcxx . . $ SysTablespace#FILE_STATUS_READ_WRITE_ERROR.) { |
| 858 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The data file '" |
| 859 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). it->filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 860 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). ((!srv_read_only_modecxx . . $ srv_read_only_mode. |
| 861 | || m_ignore_read_onlycxx . . $ Tablespace#m_ignore_read_only.) |
| 862 | ? "' must be writable" |
| 863 | : "' must be readable"); |
| 864 | } |
| 865 | |
| 866 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(err != DB_FAIL); |
| 867 | break; |
| 868 | |
| 869 | } else if (*create_new_db) { |
| 870 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The data file '" |
| 871 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). begin->filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() |
| 872 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' was not found but" |
| 873 | " one of the other data files '" |
| 874 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). it->filepathcxx . . $ Datafile#filepath(a9f41ea0e82d88cf).() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' exists."; |
| 875 | |
| 876 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 877 | break; |
| 878 | |
| 879 | } else { |
| 880 | *create_new_db = file_foundcxx . . $ SysTablespace#file_found(5b65add6ebdff51f).(*it); |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | return(err); |
| 885 | } |
| 886 | |
| 887 | /** Open or create the data files |
| 888 | @param[in] is_temp whether this is a temporary tablespace |
| 889 | @param[in] create_new_db whether we are creating a new database |
| 890 | @param[out] sum_new_sizes sum of sizes of the new files added |
| 891 | @return DB_SUCCESS or error code */ |
| 892 | dberr_tcxx . . $ dberr_t# |
| 893 | SysTablespacecxx . . $ SysTablespace#::open_or_createcxx . . $ SysTablespace#open_or_create(8c43b2175a26c688).( |
| 894 | bool is_temp, |
| 895 | bool create_new_db, |
| 896 | ulintcxx . . $ ulint#* sum_new_sizes) |
| 897 | { |
| 898 | dberr_tcxx . . $ dberr_t# err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 899 | fil_space_tcxx . . $ fil_space_t#* space = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 900 | |
| 901 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!m_files.empty()); |
| 902 | |
| 903 | if (sum_new_sizes) { |
| 904 | *sum_new_sizes = 0; |
| 905 | } |
| 906 | |
| 907 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# begin = m_filescxx . . $ Tablespace#m_files..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 908 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# end = m_filescxx . . $ Tablespace#m_files..endcxx . . $ std/vector#end(55a6de06420d4903).(); |
| 909 | |
| 910 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(begin->order() == 0); |
| 911 | |
| 912 | for (files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# it = begin; it != end; ++it) { |
| 913 | |
| 914 | if (it->m_existscxx . . $ Datafile#m_exists.) { |
| 915 | err = open_filecxx . . $ SysTablespace#open_file(da6fdb6f1c982e05).(*it); |
| 916 | |
| 917 | /* For new raw device increment new size. */ |
| 918 | if (sum_new_sizes && it->m_typecxx . . $ Datafile#m_type. == SRV_NEW_RAWcxx . . $ SRV_NEW_RAW.) { |
| 919 | |
| 920 | *sum_new_sizes += it->m_sizecxx . . $ Datafile#m_size.; |
| 921 | } |
| 922 | |
| 923 | } else { |
| 924 | err = create_filecxx . . $ SysTablespace#create_file(da6fdb6f1c982e05).(*it); |
| 925 | |
| 926 | if (sum_new_sizes) { |
| 927 | *sum_new_sizes += it->m_sizecxx . . $ Datafile#m_size.; |
| 928 | } |
| 929 | |
| 930 | /* Set the correct open flags now that we have |
| 931 | successfully created the file. */ |
| 932 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 933 | /* We ignore new_db OUT parameter here |
| 934 | as the information is known at this stage */ |
| 935 | file_foundcxx . . $ SysTablespace#file_found(5b65add6ebdff51f).(*it); |
| 936 | } |
| 937 | } |
| 938 | |
| 939 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 940 | return(err); |
| 941 | } |
| 942 | |
| 943 | } |
| 944 | |
| 945 | if (!create_new_db && space_idcxx . . $ Tablespace#space_id(ddd8539a2fcdd4ce).() == TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE.) { |
| 946 | /* Validate the header page in the first datafile. */ |
| 947 | err = read_lsn_and_check_flagscxx . . $ SysTablespace#read_lsn_and_check_flags(629d9d73bf1a44e9).(); |
| 948 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 949 | return(err); |
| 950 | } |
| 951 | } |
| 952 | |
| 953 | /* Close the curent handles, add space and file info to the |
| 954 | fil_system cache and the Data Dictionary, and re-open them |
| 955 | in file_system cache so that they stay open until shutdown. */ |
| 956 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&fil_system.mutex); |
| 957 | ulintcxx . . $ ulint# node_counter = 0; |
| 958 | for (files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# it = begin; it != end; ++it) { |
| 959 | it->closecxx . . $ Datafile#close(629d9d73bf1a44e9).(); |
| 960 | it->m_existscxx . . $ Datafile#m_exists. = true; |
| 961 | |
| 962 | if (it != begin) { |
| 963 | } else if (is_temp) { |
| 964 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(space_id() == SRV_TMP_SPACE_ID); |
| 965 | space = fil_space_tcxx . . $ fil_space_t#::createcxx . . $ fil_space_t#create(cde1c5f51b8ca16c).( |
| 966 | SRV_TMP_SPACE_IDcxx . . $ SRV_TMP_SPACE_ID., flagscxx . . $ Tablespace#flags(ddd8539a2fcdd4ce).(), false, nullptr); |
| 967 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(space == fil_system.temp_space); |
| 968 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!space->is_compressed()); |
| 969 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(space->full_crc32()); |
| 970 | } else { |
| 971 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(space_id() == TRX_SYS_SPACE); |
| 972 | space = fil_space_tcxx . . $ fil_space_t#::createcxx . . $ fil_space_t#create(cde1c5f51b8ca16c).( |
| 973 | TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE., it->flagscxx . . $ Datafile#flags(ddd8539a2fcdd4ce).(), false, nullptr); |
| 974 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(space == fil_system.sys_space); |
| 975 | } |
| 976 | |
| 977 | uint32_tcxx . . $ uint32_t# max_size = (++node_counter == m_filescxx . . $ Tablespace#m_files..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() |
| 978 | ? (m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max. == 0 |
| 979 | ? UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`! |
| 980 | : uint32_tcxx . . $ uint32_t#(m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max.)) |
| 981 | : it->m_sizecxx . . $ Datafile#m_size.); |
| 982 | |
| 983 | space->addcxx . . $ fil_space_t#add(6a6aa7e3155b8dbc).(it->m_filepathcxx . . $ Datafile#m_filepath., OS_FILE_CLOSEDcxx . . $ pfs_os_file_t#pfs_os_file_t(d4f767463ce0a6b3)., it->m_sizecxx . . $ Datafile#m_size., |
| 984 | it->m_typecxx . . $ Datafile#m_type. != SRV_NOT_RAWcxx . . $ SRV_NOT_RAW., true, max_size); |
| 985 | } |
| 986 | |
| 987 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&fil_system.mutex); |
| 988 | return(err); |
| 989 | } |
| 990 | |
| 991 | /** Normalize the file size, convert from megabytes to number of pages. */ |
| 992 | void |
| 993 | SysTablespacecxx . . $ SysTablespace#::normalize_sizecxx . . $ SysTablespace#normalize_size(49f6e7a06ebc5aa8).() |
| 994 | { |
| 995 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# end = m_filescxx . . $ Tablespace#m_files..endcxx . . $ std/vector#end(55a6de06420d4903).(); |
| 996 | |
| 997 | for (files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# it = m_filescxx . . $ Tablespace#m_files..begincxx . . $ std/vector#begin(55a6de06420d4903).(); it != end; ++it) { |
| 998 | |
| 999 | it->m_sizecxx . . $ Datafile#m_size. <<= (20U - srv_page_size_shiftcxx . . $ srv_page_size_shift.); |
| 1000 | it->m_user_param_sizecxx . . $ Datafile#m_user_param_size. = it->m_sizecxx . . $ Datafile#m_size.; |
| 1001 | } |
| 1002 | |
| 1003 | m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max. <<= (20U - srv_page_size_shiftcxx . . $ srv_page_size_shift.); |
| 1004 | } |
| 1005 | |
| 1006 | |
| 1007 | /** |
| 1008 | @return next increment size */ |
| 1009 | uint32_tcxx . . $ uint32_t# SysTablespacecxx . . $ SysTablespace#::get_incrementcxx . . $ SysTablespace#get_increment(ddd8539a2fcdd4ce).() const |
| 1010 | { |
| 1011 | if (m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max. == 0) |
| 1012 | return get_autoextend_incrementcxx . . $ SysTablespace#get_autoextend_increment(ddd8539a2fcdd4ce).(); |
| 1013 | |
| 1014 | if (!is_valid_sizecxx . . $ SysTablespace#is_valid_size(50ce9a9e25b4a850).()) |
| 1015 | { |
| 1016 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The last data file has a size of " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). last_file_sizecxx . . $ SysTablespace#last_file_size(ddd8539a2fcdd4ce).() |
| 1017 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " but the max size allowed is " |
| 1018 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max.; |
| 1019 | } |
| 1020 | |
| 1021 | return stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(uint32_tcxx . . $ uint32_t#(m_last_file_size_maxcxx . . $ SysTablespace#m_last_file_size_max.) - last_file_sizecxx . . $ SysTablespace#last_file_size(ddd8539a2fcdd4ce).(), |
| 1022 | get_autoextend_incrementcxx . . $ SysTablespace#get_autoextend_increment(ddd8539a2fcdd4ce).()); |
| 1023 | } |
| 1024 | |
| 1025 | |
| 1026 | /** |
| 1027 | @return true if configured to use raw devices */ |
| 1028 | bool |
| 1029 | SysTablespacecxx . . $ SysTablespace#::has_raw_devicecxx . . $ SysTablespace#has_raw_device(c9857a73d68e59ba).() |
| 1030 | { |
| 1031 | files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# end = m_filescxx . . $ Tablespace#m_files..endcxx . . $ std/vector#end(55a6de06420d4903).(); |
| 1032 | |
| 1033 | for (files_tcxx . . $ Tablespace#files_t#::iteratorcxx . . $ std/vector#iterator# it = m_filescxx . . $ Tablespace#m_files..begincxx . . $ std/vector#begin(55a6de06420d4903).(); it != end; ++it) { |
| 1034 | |
| 1035 | if (it->is_raw_devicecxx . . $ Datafile#is_raw_device(c9857a73d68e59ba).()) { |
| 1036 | return(true); |
| 1037 | } |
| 1038 | } |
| 1039 | |
| 1040 | return(false); |
| 1041 | } |