~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/srv/srv0srv.c

  • Committer: Brian Aker
  • Date: 2010-12-02 01:39:53 UTC
  • mto: This revision was merged to the branch mainline in revision 1968.
  • Revision ID: brian@tangent.org-20101202013953-9ie7kafjag0e051q
Style cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
Currently we support native aio on windows and linux */
143
143
UNIV_INTERN my_bool     srv_use_native_aio = TRUE;
144
144
 
145
 
#ifdef __WIN__
146
 
/* Windows native condition variables. We use runtime loading / function
147
 
pointers, because they are not available on Windows Server 2003 and
148
 
Windows XP/2000.
149
 
 
150
 
We use condition for events on Windows if possible, even if os_event
151
 
resembles Windows kernel event object well API-wise. The reason is
152
 
performance, kernel objects are heavyweights and WaitForSingleObject() is a
153
 
performance killer causing calling thread to context switch. Besides, Innodb
154
 
is preallocating large number (often millions) of os_events. With kernel event
155
 
objects it takes a big chunk out of non-paged pool, which is better suited
156
 
for tasks like IO than for storing idle event objects. */
157
 
UNIV_INTERN ibool       srv_use_native_conditions = FALSE;
158
 
#endif /* __WIN__ */
159
 
 
160
145
UNIV_INTERN ulint       srv_n_data_files = 0;
161
146
UNIV_INTERN char**      srv_data_file_names = NULL;
162
147
/* size in database pages */
463
448
UNIV_INTERN ib_int64_t  srv_n_lock_wait_time            = 0;
464
449
UNIV_INTERN ulint               srv_n_lock_max_wait_time        = 0;
465
450
 
466
 
UNIV_INTERN ulint               srv_truncated_status_writes     = 0;
467
451
 
468
452
/*
469
453
  Set the following to 0 if you want InnoDB to write messages on
1620
1604
                row_mysql_unfreeze_data_dictionary(trx);
1621
1605
                break;
1622
1606
        case RW_X_LATCH:
1623
 
                /* There should never be a lock wait when the
1624
 
                dictionary latch is reserved in X mode.  Dictionary
1625
 
                transactions should only acquire locks on dictionary
1626
 
                tables, not other tables. All access to dictionary
1627
 
                tables should be covered by dictionary
1628
 
                transactions. */
1629
 
                ut_print_timestamp(stderr);
1630
 
                fputs("  InnoDB: Error: dict X latch held in "
1631
 
                      "srv_suspend_mysql_thread\n", stderr);
1632
 
                /* This should never occur. This incorrect handling
1633
 
                was added in the early development of
1634
 
                ha_innobase::add_index() in InnoDB Plugin 1.0. */
1635
1607
                /* Release fast index creation latch */
1636
1608
                row_mysql_unlock_data_dictionary(trx);
1637
1609
                break;
1651
1623
                row_mysql_freeze_data_dictionary(trx);
1652
1624
                break;
1653
1625
        case RW_X_LATCH:
1654
 
                /* This should never occur. This incorrect handling
1655
 
                was added in the early development of
1656
 
                ha_innobase::add_index() in InnoDB Plugin 1.0. */
1657
1626
                row_mysql_lock_data_dictionary(trx);
1658
1627
                break;
1659
1628
        }
1690
1659
                    start_time != -1 && finish_time != -1) {
1691
1660
                        srv_n_lock_max_wait_time = diff_time;
1692
1661
                }
1693
 
 
1694
 
                /* Record the lock wait time for this thread */
1695
 
                thd_set_lock_wait_time(trx->mysql_thd, diff_time);
1696
1662
        }
1697
1663
 
1698
1664
        if (trx->was_chosen_as_deadlock_victim) {
2058
2024
        export_vars.innodb_rows_inserted = srv_n_rows_inserted;
2059
2025
        export_vars.innodb_rows_updated = srv_n_rows_updated;
2060
2026
        export_vars.innodb_rows_deleted = srv_n_rows_deleted;
2061
 
        export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
2062
2027
 
2063
2028
        mutex_exit(&srv_innodb_monitor_mutex);
2064
2029
}
2664
2629
        when there is database activity */
2665
2630
 
2666
2631
        srv_last_log_flush_time = time(NULL);
2667
 
 
2668
 
        /* Sleep for 1 second on entrying the for loop below the first time. */
2669
 
        next_itr_time = ut_time_ms() + 1000;
 
2632
        next_itr_time = ut_time_ms();
2670
2633
 
2671
2634
        for (i = 0; i < 10; i++) {
2672
2635
                ulint   cur_time = ut_time_ms();
3074
3037
 
3075
3038
        slot_no = srv_table_reserve_slot(SRV_WORKER);
3076
3039
 
3077
 
        slot = srv_table_get_nth_slot(slot_no);
3078
 
 
3079
3040
        ++srv_n_threads_active[SRV_WORKER];
3080
3041
 
3081
3042
        mutex_exit(&kernel_mutex);
3127
3088
 
3128
3089
        mutex_enter(&kernel_mutex);
3129
3090
 
3130
 
        ut_ad(srv_table_get_nth_slot(slot_no) == slot);
3131
 
 
3132
3091
        /* Decrement the active count. */
3133
3092
        srv_suspend_thread();
3134
3093
 
3135
 
        slot->in_use = FALSE;
 
3094
        mutex_exit(&kernel_mutex);
3136
3095
 
3137
3096
        /* Free the thread local memory. */
3138
3097
        thr_local_free(os_thread_get_curr_id());
3139
3098
 
 
3099
        mutex_enter(&kernel_mutex);
 
3100
 
 
3101
        /* Free the slot for reuse. */
 
3102
        slot = srv_table_get_nth_slot(slot_no);
 
3103
        slot->in_use = FALSE;
 
3104
 
3140
3105
        mutex_exit(&kernel_mutex);
3141
3106
 
3142
3107
#ifdef UNIV_DEBUG_THREAD_CREATION