~ubuntu-branches/ubuntu/quantal/mysql-5.5/quantal-security

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Seth Arnold
  • Date: 2013-04-18 18:15:39 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130418181539-7uo1w041b4h2ulbs
Tags: 5.5.31-0ubuntu0.12.10.1
* SECURITY UPDATE: Update to 5.5.31 to fix security issues (LP: #1170516)
  - http://www.oracle.com/technetwork/topics/security/cpuapr2013-1899555.html
* debian/patches/71_disable_rpl_tests.patch: refreshed.
* debian/patches/fix-mysqldump-test.patch: removed, fixed differently
  upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
 
3
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
4
4
Copyright (c) 2008, 2009 Google Inc.
5
5
Copyright (c) 2009, Percona Inc.
6
6
 
58
58
*******************************************************/
59
59
 
60
60
/* Dummy comment */
 
61
#include "m_string.h" /* for my_sys.h */
 
62
#include "my_sys.h" /* DEBUG_SYNC_C */
61
63
#include "srv0srv.h"
62
64
 
63
65
#include "ut0mem.h"
83
85
#include "ha_prototypes.h"
84
86
#include "trx0i_s.h"
85
87
#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
 
88
#include "read0read.h"
86
89
#include "mysql/plugin.h"
87
90
#include "mysql/service_thd_wait.h"
88
91
 
276
279
/* Internal setting for "innodb_stats_method". Decides how InnoDB treats
277
280
NULL value when collecting statistics. By default, it is set to
278
281
SRV_STATS_NULLS_EQUAL(0), ie. all NULL value are treated equal */
279
 
ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
 
282
UNIV_INTERN ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
280
283
 
281
284
/* here we count the amount of data written in total (in bytes) */
282
285
UNIV_INTERN ulint srv_data_written = 0;
356
359
InnoDB */
357
360
UNIV_INTERN ulint       srv_conc_n_waiting_threads = 0;
358
361
 
 
362
/* print all user-level transactions deadlocks to mysqld stderr */
 
363
UNIV_INTERN my_bool     srv_print_all_deadlocks = FALSE;
 
364
 
359
365
typedef struct srv_conc_slot_struct     srv_conc_slot_t;
360
366
struct srv_conc_slot_struct{
361
367
        os_event_t                      event;          /*!< event to wait */
1568
1574
 
1569
1575
        trx = thr_get_trx(thr);
1570
1576
 
 
1577
        if (trx->mysql_thd != 0) {
 
1578
                DEBUG_SYNC_C("srv_suspend_mysql_thread_enter");
 
1579
        }
 
1580
 
1571
1581
        os_event_set(srv_lock_timeout_thread_event);
1572
1582
 
1573
1583
        mutex_enter(&kernel_mutex);
2006
2016
srv_export_innodb_status(void)
2007
2017
/*==========================*/
2008
2018
{
2009
 
        buf_pool_stat_t stat;
2010
 
        ulint           LRU_len;
2011
 
        ulint           free_len;
2012
 
        ulint           flush_list_len;
 
2019
        buf_pool_stat_t         stat;
 
2020
        buf_pools_list_size_t   buf_pools_list_size;
 
2021
        ulint                   LRU_len;
 
2022
        ulint                   free_len;
 
2023
        ulint                   flush_list_len;
2013
2024
 
2014
2025
        buf_get_total_stat(&stat);
2015
2026
        buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
 
2027
        buf_get_total_list_size_in_bytes(&buf_pools_list_size);
2016
2028
 
2017
2029
        mutex_enter(&srv_innodb_monitor_mutex);
2018
2030
 
2041
2053
        export_vars.innodb_buffer_pool_read_ahead_evicted
2042
2054
                = stat.n_ra_pages_evicted;
2043
2055
        export_vars.innodb_buffer_pool_pages_data = LRU_len;
 
2056
        export_vars.innodb_buffer_pool_bytes_data =
 
2057
                buf_pools_list_size.LRU_bytes
 
2058
                + buf_pools_list_size.unzip_LRU_bytes;
2044
2059
        export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
 
2060
        export_vars.innodb_buffer_pool_bytes_dirty =
 
2061
                buf_pools_list_size.flush_list_bytes;
2045
2062
        export_vars.innodb_buffer_pool_pages_free = free_len;
2046
2063
#ifdef UNIV_DEBUG
2047
2064
        export_vars.innodb_buffer_pool_pages_latched
2087
2104
        export_vars.innodb_rows_deleted = srv_n_rows_deleted;
2088
2105
        export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
2089
2106
 
 
2107
#ifdef UNIV_DEBUG
 
2108
        {
 
2109
                trx_id_t        done_trx_no;
 
2110
                trx_id_t        up_limit_id;
 
2111
 
 
2112
                rw_lock_s_lock(&purge_sys->latch);
 
2113
                done_trx_no     = purge_sys->done_trx_no;
 
2114
                up_limit_id     = purge_sys->view
 
2115
                        ? purge_sys->view->up_limit_id
 
2116
                        : 0;
 
2117
                rw_lock_s_unlock(&purge_sys->latch);
 
2118
 
 
2119
                if (trx_sys->max_trx_id < done_trx_no) {
 
2120
                        export_vars.innodb_purge_trx_id_age = 0;
 
2121
                } else {
 
2122
                        export_vars.innodb_purge_trx_id_age =
 
2123
                                trx_sys->max_trx_id - done_trx_no;
 
2124
                }
 
2125
 
 
2126
                if (!up_limit_id
 
2127
                    || trx_sys->max_trx_id < up_limit_id) {
 
2128
                        export_vars.innodb_purge_view_trx_id_age = 0;
 
2129
                } else {
 
2130
                        export_vars.innodb_purge_view_trx_id_age =
 
2131
                                trx_sys->max_trx_id - up_limit_id;
 
2132
                }
 
2133
        }
 
2134
#endif /* UNIV_DEBUG */
 
2135
 
2090
2136
        mutex_exit(&srv_innodb_monitor_mutex);
2091
2137
}
2092
2138
 
2773
2819
        for (i = 0; i < 10; i++) {
2774
2820
                ulint   cur_time = ut_time_ms();
2775
2821
 
 
2822
#ifdef UNIV_DEBUG
 
2823
                if (btr_cur_limit_optimistic_insert_debug
 
2824
                    && srv_n_purge_threads == 0) {
 
2825
                        /* If btr_cur_limit_optimistic_insert_debug is enabled
 
2826
                        and no purge_threads, purge opportunity is increased
 
2827
                        by x100 (1purge/100msec), to speed up debug scripts
 
2828
                        which should wait for purged. */
 
2829
                        next_itr_time -= 900;
 
2830
 
 
2831
                        srv_main_thread_op_info = "master purging";
 
2832
 
 
2833
                        srv_master_do_purge();
 
2834
 
 
2835
                        if (srv_fast_shutdown && srv_shutdown_state > 0) {
 
2836
 
 
2837
                                goto background_loop;
 
2838
                        }
 
2839
                }
 
2840
#endif /* UNIV_DEBUG */
 
2841
 
2776
2842
                /* ALTER TABLE in MySQL requires on Unix that the table handler
2777
2843
                can drop tables lazily after there no longer are SELECT
2778
2844
                queries to them. */