@@ -1272,6 +1272,17 @@ innobase_fts_store_docid(
1272
1272
dbug_tmp_restore_column_map(tbl->write_set, old_map);
1273
1273
}
1274
1274
1275
+ /*****************************************************************//**
1276
+ Checks if the filename name is reserved in InnoDB.
1277
+ @return true if the name is reserved */
1278
+ static
1279
+ bool
1280
+ innobase_check_reserved_file_name(
1281
+ /*===================*/
1282
+ handlerton* hton, /*!< in: handlerton of Innodb */
1283
+ const char* name); /*!< in: Name of the database */
1284
+
1285
+
1275
1286
/*************************************************************//**
1276
1287
Check for a valid value of innobase_commit_concurrency.
1277
1288
@return 0 for valid innodb_commit_concurrency */
@@ -3547,6 +3558,7 @@ innobase_init(
3547
3558
innobase_hton->replace_native_transaction_in_thd =
3548
3559
innodb_replace_trx_in_thd;
3549
3560
innobase_hton->data = &innodb_api_cb;
3561
+ innobase_hton->is_reserved_db_name= innobase_check_reserved_file_name;
3550
3562
3551
3563
innobase_hton->is_supported_system_table=
3552
3564
innobase_is_supported_system_table;
@@ -21360,3 +21372,30 @@ innodb_buffer_pool_size_validate(
21360
21372
21361
21373
return(0);
21362
21374
}
21375
+
21376
+ /*****************************************************************//**
21377
+ Checks if the file name is reserved in InnoDB. Currently
21378
+ redo log files(ib_logfile*) is reserved.
21379
+ @return true if the name is reserved */
21380
+ static
21381
+ bool
21382
+ innobase_check_reserved_file_name(
21383
+ /*===================*/
21384
+ handlerton* hton, /*!< in: handlerton of Innodb */
21385
+ const char* name) /*!< in: Name of the database */
21386
+ {
21387
+ CHARSET_INFO *ci= system_charset_info;
21388
+ size_t logname_size = strlen(ib_logfile_basename);
21389
+
21390
+ /* Name is smaller than reserved name */
21391
+ if (strlen(name) < logname_size) {
21392
+ return (false);
21393
+ }
21394
+ /* Do case insensitive comparison for name. */
21395
+ for (uint i=0; i < logname_size; i++) {
21396
+ if (my_tolower(ci, name[i]) != ib_logfile_basename[i]){
21397
+ return (false);
21398
+ }
21399
+ }
21400
+ return (true);
21401
+ }
0 commit comments