121
121
/** The null file address */
122
122
UNIV_INTERN fil_addr_t fil_addr_null = {FIL_NULL, 0};
124
#ifdef UNIV_PFS_MUTEX
125
/* Key to register fil_system_mutex with performance schema */
126
UNIV_INTERN mysql_pfs_key_t fil_system_mutex_key;
127
#endif /* UNIV_PFS_MUTEX */
129
#ifdef UNIV_PFS_RWLOCK
130
/* Key to register file space latch with performance schema */
131
UNIV_INTERN mysql_pfs_key_t fil_space_latch_key;
132
#endif /* UNIV_PFS_RWLOCK */
124
134
/** File node of a tablespace or the log data space */
125
135
struct fil_node_struct {
126
136
fil_space_t* space; /*!< backpointer to the space where this node
655
665
node->handle = os_file_create_simple_no_error_handling(
656
node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
666
innodb_file_data_key, node->name, OS_FILE_OPEN,
667
OS_FILE_READ_ONLY, &success);
658
669
/* The following call prints an error message */
659
670
os_file_get_last_error(TRUE);
771
782
os_file_create() to fall back to the normal file I/O mode. */
773
784
if (space->purpose == FIL_LOG) {
774
node->handle = os_file_create(node->name, OS_FILE_OPEN,
775
OS_FILE_AIO, OS_LOG_FILE, &ret);
785
node->handle = os_file_create(innodb_file_log_key,
786
node->name, OS_FILE_OPEN,
787
OS_FILE_AIO, OS_LOG_FILE,
776
789
} else if (node->is_raw_disk) {
777
node->handle = os_file_create(node->name,
790
node->handle = os_file_create(innodb_file_data_key,
778
792
OS_FILE_OPEN_RAW,
779
OS_FILE_AIO, OS_DATA_FILE, &ret);
793
OS_FILE_AIO, OS_DATA_FILE,
781
node->handle = os_file_create(node->name, OS_FILE_OPEN,
782
OS_FILE_AIO, OS_DATA_FILE, &ret);
796
node->handle = os_file_create(innodb_file_data_key,
797
node->name, OS_FILE_OPEN,
798
OS_FILE_AIO, OS_DATA_FILE,
1228
1245
UT_LIST_INIT(space->chain);
1229
1246
space->magic_n = FIL_SPACE_MAGIC_N;
1231
rw_lock_create(&space->latch, SYNC_FSP);
1248
rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
1233
1250
HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space);
1539
1556
fil_system = mem_zalloc(sizeof(fil_system_t));
1541
mutex_create(&fil_system->mutex, SYNC_ANY_LATCH);
1558
mutex_create(fil_system_mutex_key,
1559
&fil_system->mutex, SYNC_ANY_LATCH);
1543
1561
fil_system->spaces = hash_create(hash_size);
1544
1562
fil_system->name_hash = hash_create(hash_size);
2534
2552
success = fil_rename_tablespace_in_mem(space, node, path);
2537
success = os_file_rename(old_path, path);
2555
success = os_file_rename(innodb_file_data_key, old_path, path);
2539
2557
if (!success) {
2540
2558
/* We have to revert the changes we made
2612
2630
path = fil_make_ibd_name(tablename, is_temp);
2614
file = os_file_create(path, OS_FILE_CREATE, OS_FILE_NORMAL,
2632
file = os_file_create(innodb_file_data_key, path,
2633
OS_FILE_CREATE, OS_FILE_NORMAL,
2615
2634
OS_DATA_FILE, &ret);
2616
2635
if (ret == FALSE) {
2617
2636
ut_print_timestamp(stderr);
2799
2818
filepath = fil_make_ibd_name(name, FALSE);
2801
2820
file = os_file_create_simple_no_error_handling(
2802
filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
2821
innodb_file_data_key, filepath, OS_FILE_OPEN,
2822
OS_FILE_READ_WRITE, &success);
2803
2823
if (!success) {
2804
2824
/* The following call prints an error message */
2805
2825
os_file_get_last_error(TRUE);
2983
3003
ut_a(!(flags & (~0UL << DICT_TF_BITS)));
2985
3005
file = os_file_create_simple_no_error_handling(
2986
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
3006
innodb_file_data_key, filepath, OS_FILE_OPEN,
3007
OS_FILE_READ_ONLY, &success);
2987
3008
if (!success) {
2988
3009
/* The following call prints an error message */
2989
3010
os_file_get_last_error(TRUE);
3139
3160
# endif /* !UNIV_HOTBACKUP */
3141
3162
file = os_file_create_simple_no_error_handling(
3142
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
3163
innodb_file_data_key, filepath, OS_FILE_OPEN,
3164
OS_FILE_READ_ONLY, &success);
3143
3165
if (!success) {
3144
3166
/* The following call prints an error message */
3145
3167
os_file_get_last_error(TRUE);
3297
3319
os_file_close(file);
3299
3321
new_path = fil_make_ibbackup_old_name(filepath);
3300
ut_a(os_file_rename(filepath, new_path));
3322
ut_a(os_file_rename(innodb_file_data_key, filepath, new_path));
3303
3325
mem_free(filepath);
3336
3358
mutex_exit(&fil_system->mutex);
3338
ut_a(os_file_rename(filepath, new_path));
3360
ut_a(os_file_rename(innodb_file_data_key, filepath, new_path));
3341
3363
mem_free(filepath);
3545
/********************************************************************//**
3546
If we need crash recovery, and we have called
3547
fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(),
3548
we can call this function to print an error message of orphaned .ibd files
3549
for which there is not a data dictionary entry with a matching table name
3553
fil_print_orphaned_tablespaces(void)
3554
/*================================*/
3558
mutex_enter(&fil_system->mutex);
3560
space = UT_LIST_GET_FIRST(fil_system->space_list);
3563
if (space->purpose == FIL_TABLESPACE && space->id != 0
3565
fputs("InnoDB: Warning: tablespace ", stderr);
3566
ut_print_filename(stderr, space->name);
3567
fprintf(stderr, " of id %lu has no matching table in\n"
3568
"InnoDB: the InnoDB data dictionary.\n",
3572
space = UT_LIST_GET_NEXT(space_list, space);
3575
mutex_exit(&fil_system->mutex);
3578
3567
/*******************************************************************//**
3579
3568
Returns TRUE if a single-table tablespace does not exist in the memory cache,
3580
3569
or is being deleted there.
4458
4447
ut_ad(fil_validate());
4460
if (os_aio_use_native_aio) {
4449
if (srv_use_native_aio) {
4461
4450
srv_set_io_thread_op_info(segment, "native aio handle");
4462
4451
#ifdef WIN_ASYNC_IO
4463
4452
ret = os_aio_windows_handle(segment, 0, &fil_node,
4464
4453
&message, &type);
4454
#elif defined(LINUX_NATIVE_AIO)
4455
ret = os_aio_linux_handle(segment, &fil_node,
4466
4458
ret = 0; /* Eliminate compiler warning */