~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/fil/fil0fil.c

  • Committer: Monty Taylor
  • Date: 2010-11-26 22:50:54 UTC
  • mfrom: (1953.1.6 build)
  • Revision ID: mordred@inaugust.com-20101126225054-sg90svw8579t5p3i
Stewart - InnoDB 1.1.1
Monty - Fixed some autoconf tests which were returning false positives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
/** The null file address */
122
122
UNIV_INTERN fil_addr_t  fil_addr_null = {FIL_NULL, 0};
123
123
 
 
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 */
 
128
 
 
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 */
 
133
 
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
653
663
                async I/O! */
654
664
 
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);
657
668
                if (!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. */
772
783
 
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,
 
788
                                              &ret);
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,
 
791
                                              node->name,
778
792
                                              OS_FILE_OPEN_RAW,
779
 
                                              OS_FILE_AIO, OS_DATA_FILE, &ret);
 
793
                                              OS_FILE_AIO, OS_DATA_FILE,
 
794
                                                     &ret);
780
795
        } else {
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,
 
799
                                              &ret);
783
800
        }
784
801
 
785
802
        ut_a(ret);
1228
1245
        UT_LIST_INIT(space->chain);
1229
1246
        space->magic_n = FIL_SPACE_MAGIC_N;
1230
1247
 
1231
 
        rw_lock_create(&space->latch, SYNC_FSP);
 
1248
        rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
1232
1249
 
1233
1250
        HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space);
1234
1251
 
1538
1555
 
1539
1556
        fil_system = mem_zalloc(sizeof(fil_system_t));
1540
1557
 
1541
 
        mutex_create(&fil_system->mutex, SYNC_ANY_LATCH);
 
1558
        mutex_create(fil_system_mutex_key,
 
1559
                     &fil_system->mutex, SYNC_ANY_LATCH);
1542
1560
 
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);
2535
2553
 
2536
2554
        if (success) {
2537
 
                success = os_file_rename(old_path, path);
 
2555
                success = os_file_rename(innodb_file_data_key, old_path, path);
2538
2556
 
2539
2557
                if (!success) {
2540
2558
                        /* We have to revert the changes we made
2611
2629
 
2612
2630
        path = fil_make_ibd_name(tablename, is_temp);
2613
2631
 
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);
2800
2819
 
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)));
2984
3004
 
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 */
3140
3161
#endif
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);
3298
3320
 
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));
3301
3323
 
3302
3324
                ut_free(buf2);
3303
3325
                mem_free(filepath);
3335
3357
 
3336
3358
                mutex_exit(&fil_system->mutex);
3337
3359
 
3338
 
                ut_a(os_file_rename(filepath, new_path));
 
3360
                ut_a(os_file_rename(innodb_file_data_key, filepath, new_path));
3339
3361
 
3340
3362
                ut_free(buf2);
3341
3363
                mem_free(filepath);
3542
3564
        return(err);
3543
3565
}
3544
3566
 
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
3550
 
and space id. */
3551
 
UNIV_INTERN
3552
 
void
3553
 
fil_print_orphaned_tablespaces(void)
3554
 
/*================================*/
3555
 
{
3556
 
        fil_space_t*    space;
3557
 
 
3558
 
        mutex_enter(&fil_system->mutex);
3559
 
 
3560
 
        space = UT_LIST_GET_FIRST(fil_system->space_list);
3561
 
 
3562
 
        while (space) {
3563
 
                if (space->purpose == FIL_TABLESPACE && space->id != 0
3564
 
                    && !space->mark) {
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",
3569
 
                                (ulong) space->id);
3570
 
                }
3571
 
 
3572
 
                space = UT_LIST_GET_NEXT(space_list, space);
3573
 
        }
3574
 
 
3575
 
        mutex_exit(&fil_system->mutex);
3576
 
}
3577
 
 
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.
4457
4446
 
4458
4447
        ut_ad(fil_validate());
4459
4448
 
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,
 
4456
                                          &message, &type);
4465
4457
#else
4466
4458
                ret = 0; /* Eliminate compiler warning */
4467
4459
                ut_error;