~tsarev/percona-server/5.5-processlist_rows_stats-sporadic_fails-fix

« back to all changes in this revision

Viewing changes to innodb_io_patches.patch

  • Committer: kinoyasu
  • Date: 2011-05-10 11:57:42 UTC
  • Revision ID: kinoyasu@gauntlet4-20110510115742-3i3194rn2m8fipm2
port Yasufumi patches to 5.5.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
54
54
--- a/storage/innobase/handler/ha_innodb.cc     2010-12-03 15:09:51.283956391 +0900
55
55
+++ b/storage/innobase/handler/ha_innodb.cc     2010-12-03 15:10:08.963980444 +0900
56
 
@@ -445,6 +445,12 @@
 
56
@@ -444,6 +444,12 @@
57
57
   "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
58
58
   NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
59
59
 
66
66
 
67
67
 static handler *innobase_create_handler(handlerton *hton,
68
68
                                         TABLE_SHARE *table,
69
 
@@ -839,6 +845,17 @@
 
69
@@ -838,6 +844,17 @@
70
70
        }
71
71
 }
72
72
 
84
84
 /********************************************************************//**
85
85
 Obtain the InnoDB transaction of a MySQL thread.
86
86
 @return        reference to transaction pointer */
87
 
@@ -2410,6 +2427,9 @@
 
87
@@ -2423,6 +2440,9 @@
88
88
        srv_n_read_io_threads = (ulint) innobase_read_io_threads;
89
89
        srv_n_write_io_threads = (ulint) innobase_write_io_threads;
90
90
 
94
94
        srv_force_recovery = (ulint) innobase_force_recovery;
95
95
 
96
96
        srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
97
 
@@ -11001,7 +11021,7 @@
 
97
@@ -11018,7 +11038,7 @@
98
98
   PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
99
99
   "Purge threads can be either 0 or 1.",
100
100
   NULL, NULL,
103
103
   0,                   /* Minimum value */
104
104
   1, 0);               /* Maximum value */
105
105
 
106
 
@@ -11043,12 +11063,18 @@
 
106
@@ -11060,12 +11080,18 @@
107
107
   innodb_file_format_max_validate,
108
108
   innodb_file_format_max_update, "Antelope");
109
109
 
128
128
 
129
129
 static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
130
130
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
131
 
@@ -11143,7 +11169,7 @@
 
131
@@ -11160,7 +11186,7 @@
132
132
 static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
133
133
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
134
134
   "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
137
137
 
138
138
 static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
139
139
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
140
 
@@ -11295,6 +11321,95 @@
 
140
@@ -11312,6 +11338,95 @@
141
141
   "trigger a readahead.",
142
142
   NULL, NULL, 56, 0, 64, 0);
143
143
 
233
233
 static struct st_mysql_sys_var* innobase_system_variables[]= {
234
234
   MYSQL_SYSVAR(additional_mem_pool_size),
235
235
   MYSQL_SYSVAR(autoextend_increment),
236
 
@@ -11315,6 +11430,7 @@
 
236
@@ -11332,6 +11447,7 @@
237
237
   MYSQL_SYSVAR(file_format_check),
238
238
   MYSQL_SYSVAR(file_format_max),
239
239
   MYSQL_SYSVAR(flush_log_at_trx_commit),
241
241
   MYSQL_SYSVAR(flush_method),
242
242
   MYSQL_SYSVAR(force_recovery),
243
243
   MYSQL_SYSVAR(locks_unsafe_for_binlog),
244
 
@@ -11352,6 +11468,13 @@
 
244
@@ -11369,6 +11485,13 @@
245
245
   MYSQL_SYSVAR(show_verbose_locks),
246
246
   MYSQL_SYSVAR(show_locks_held),
247
247
   MYSQL_SYSVAR(version),
258
258
diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
259
259
--- a/storage/innobase/ibuf/ibuf0ibuf.c 2010-11-03 07:01:13.000000000 +0900
260
260
+++ b/storage/innobase/ibuf/ibuf0ibuf.c 2010-12-03 15:10:09.073984282 +0900
261
 
@@ -524,8 +524,10 @@
 
261
@@ -514,8 +514,10 @@
262
262
        grow in size, as the references on the upper levels of the tree can
263
263
        change */
264
264
 
271
271
 
272
272
        mutex_create(ibuf_pessimistic_insert_mutex_key,
273
273
                     &ibuf_pessimistic_insert_mutex,
274
 
@@ -2712,9 +2714,11 @@
 
274
@@ -2764,9 +2766,11 @@
275
275
        size = ibuf->size;
276
276
        max_size = ibuf->max_size;
277
277
 
299
299
diff -ruN a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
300
300
--- a/storage/innobase/include/ha_prototypes.h  2010-11-03 07:01:13.000000000 +0900
301
301
+++ b/storage/innobase/include/ha_prototypes.h  2010-12-03 15:10:09.078026360 +0900
302
 
@@ -275,5 +275,12 @@
 
302
@@ -284,5 +284,12 @@
303
303
 /*===================*/
304
304
         void*   thd,   /*!< in: thread handle (THD*) */
305
305
         ulint   value);        /*!< in: time waited for the lock */
540
540
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
541
541
--- a/storage/innobase/srv/srv0srv.c    2010-12-03 15:09:51.301987792 +0900
542
542
+++ b/storage/innobase/srv/srv0srv.c    2010-12-03 15:13:29.369986988 +0900
543
 
@@ -190,7 +190,8 @@
 
543
@@ -189,7 +189,8 @@
544
544
 UNIV_INTERN ulint      srv_log_file_size       = ULINT_MAX;
545
545
 /* size in database pages */
546
546
 UNIV_INTERN ulint      srv_log_buffer_size     = ULINT_MAX;
550
550
 
551
551
 /* Try to flush dirty pages so as to avoid IO bursts at
552
552
 the checkpoints. */
553
 
@@ -409,6 +410,17 @@
 
553
@@ -408,6 +409,17 @@
554
554
 
555
555
 UNIV_INTERN ulong      srv_replication_delay           = 0;
556
556
 
568
568
 /*-------------------------------------------*/
569
569
 UNIV_INTERN ulong      srv_n_spin_wait_rounds  = 30;
570
570
 UNIV_INTERN ulong      srv_n_free_tickets_to_enter = 500;
571
 
@@ -2745,6 +2757,7 @@
 
571
@@ -2733,6 +2745,7 @@
572
572
        ulint           n_pages_purged  = 0;
573
573
        ulint           n_bytes_merged;
574
574
        ulint           n_pages_flushed;
576
576
        ulint           n_bytes_archived;
577
577
        ulint           n_tables_to_drop;
578
578
        ulint           n_ios;
579
 
@@ -2752,7 +2765,20 @@
 
579
@@ -2740,7 +2753,20 @@
580
580
        ulint           n_ios_very_old;
581
581
        ulint           n_pend_ios;
582
582
        ulint           next_itr_time;
597
597
 
598
598
 #ifdef UNIV_DEBUG_THREAD_CREATION
599
599
        fprintf(stderr, "Master thread starts, id %lu\n",
600
 
@@ -2774,6 +2800,9 @@
 
600
@@ -2762,6 +2788,9 @@
601
601
 
602
602
        mutex_exit(&kernel_mutex);
603
603
 
607
607
 loop:
608
608
        /*****************************************************************/
609
609
        /* ---- When there is database activity by users, we cycle in this
610
 
@@ -2804,9 +2833,13 @@
 
610
@@ -2792,9 +2821,13 @@
611
611
        /* Sleep for 1 second on entrying the for loop below the first time. */
612
612
        next_itr_time = ut_time_ms() + 1000;
613
613
 
621
621
                /* ALTER TABLE in MySQL requires on Unix that the table handler
622
622
                can drop tables lazily after there no longer are SELECT
623
623
                queries to them. */
624
 
@@ -2830,6 +2863,7 @@
 
624
@@ -2818,6 +2851,7 @@
625
625
                srv_main_thread_op_info = "sleeping";
626
626
                srv_main_1_second_loops++;
627
627
 
629
629
                if (next_itr_time > cur_time
630
630
                    && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
631
631
 
632
 
@@ -2840,10 +2874,26 @@
 
632
@@ -2828,10 +2862,26 @@
633
633
                                        (next_itr_time - cur_time)
634
634
                                         * 1000));
635
635
                        srv_main_sleeps++;
656
656
 
657
657
                /* Flush logs if needed */
658
658
                srv_sync_log_buffer_in_background();
659
 
@@ -2863,7 +2913,7 @@
 
659
@@ -2851,7 +2901,7 @@
660
660
                if (n_pend_ios < SRV_PEND_IO_THRESHOLD
661
661
                    && (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
662
662
                        srv_main_thread_op_info = "doing insert buffer merge";
665
665
 
666
666
                        /* Flush logs if needed */
667
667
                        srv_sync_log_buffer_in_background();
668
 
@@ -2880,7 +2930,11 @@
 
668
@@ -2868,7 +2918,11 @@
669
669
                        n_pages_flushed = buf_flush_list(
670
670
                                PCT_IO(100), IB_ULONGLONG_MAX);
671
671
 
678
678
 
679
679
                        /* Try to keep the rate of flushing of dirty
680
680
                        pages such that redo log generation does not
681
 
@@ -2896,6 +2950,224 @@
 
681
@@ -2884,6 +2938,224 @@
682
682
                                                n_flush,
683
683
                                                IB_ULONGLONG_MAX);
684
684
                        }
903
903
                }
904
904
 
905
905
                if (srv_activity_count == old_activity_count) {
906
 
@@ -2944,7 +3216,7 @@
 
906
@@ -2932,7 +3204,7 @@
907
907
        even if the server were active */
908
908
 
909
909
        srv_main_thread_op_info = "doing insert buffer merge";
912
912
 
913
913
        /* Flush logs if needed */
914
914
        srv_sync_log_buffer_in_background();
915
 
@@ -3052,7 +3324,7 @@
 
915
@@ -3040,7 +3312,7 @@
916
916
                buf_flush_list below. Otherwise, the system favors
917
917
                clean pages over cleanup throughput. */
918
918
                n_bytes_merged = ibuf_contract_for_n_pages(FALSE,
921
921
        }
922
922
 
923
923
        srv_main_thread_op_info = "reserving kernel mutex";
924
 
@@ -3199,6 +3471,7 @@
 
924
@@ -3184,6 +3456,7 @@
 
925
        srv_slot_t*     slot;
925
926
        ulint           retries = 0;
926
 
        ulint           slot_no = ULINT_UNDEFINED;
927
927
        ulint           n_total_purged = ULINT_UNDEFINED;
928
928
+       ulint           next_itr_time;
929
929
 
930
930
        ut_a(srv_n_purge_threads == 1);
931
931
 
932
 
@@ -3221,9 +3494,12 @@
 
932
@@ -3204,9 +3477,12 @@
933
933
 
934
934
        mutex_exit(&kernel_mutex);
935
935
 
942
942
 
943
943
                /* If there are very few records to purge or the last
944
944
                purge didn't purge any records then wait for activity.
945
 
@@ -3272,6 +3548,16 @@
 
945
@@ -3253,6 +3529,16 @@
946
946
                } while (n_pages_purged > 0 && !srv_fast_shutdown);
947
947
 
948
948
                srv_sync_log_buffer_in_background();
962
962
diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
963
963
--- a/storage/innobase/srv/srv0start.c  2010-11-03 07:01:13.000000000 +0900
964
964
+++ b/storage/innobase/srv/srv0start.c  2010-12-03 15:10:09.103023543 +0900
965
 
@@ -1218,6 +1218,9 @@
 
965
@@ -1217,6 +1217,9 @@
966
966
        } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
967
967
                srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
968
968
 
991
991
diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
992
992
--- a/storage/innobase/trx/trx0trx.c    2010-11-03 07:01:13.000000000 +0900
993
993
+++ b/storage/innobase/trx/trx0trx.c    2010-12-03 15:10:09.106023937 +0900
994
 
@@ -925,6 +925,7 @@
 
994
@@ -924,6 +924,7 @@
995
995
        trx->read_view = NULL;
996
996
 
997
997
        if (lsn) {
999
999
 
1000
1000
                mutex_exit(&kernel_mutex);
1001
1001
 
1002
 
@@ -933,6 +934,12 @@
 
1002
@@ -932,6 +933,12 @@
1003
1003
                        trx_undo_insert_cleanup(trx);
1004
1004
                }
1005
1005
 
1012
1012
                /* NOTE that we could possibly make a group commit more
1013
1013
                efficient here: call os_thread_yield here to allow also other
1014
1014
                trxs to come to commit! */
1015
 
@@ -964,9 +971,9 @@
 
1015
@@ -963,9 +970,9 @@
1016
1016
                if (trx->flush_log_later) {
1017
1017
                        /* Do nothing yet */
1018
1018
                        trx->must_flush_log_later = TRUE;
1024
1024
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1025
1025
                                /* Write the log but do not flush it to disk */
1026
1026
 
1027
 
@@ -978,7 +985,7 @@
 
1027
@@ -977,7 +984,7 @@
1028
1028
 
1029
1029
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1030
1030
                        }
1033
1033
 
1034
1034
                        /* Write the log but do not flush it to disk */
1035
1035
 
1036
 
@@ -1642,16 +1649,23 @@
 
1036
@@ -1641,16 +1648,23 @@
1037
1037
        trx_t*  trx)    /*!< in: trx handle */
1038
1038
 {
1039
1039
        ib_uint64_t     lsn     = trx->commit_lsn;
1059
1059
                if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1060
1060
                        /* Write the log but do not flush it to disk */
1061
1061
 
1062
 
@@ -1662,7 +1676,7 @@
 
1062
@@ -1661,7 +1675,7 @@
1063
1063
 
1064
1064
                        log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1065
1065
                }
1068
1068
 
1069
1069
                /* Write the log but do not flush it to disk */
1070
1070
 
1071
 
@@ -1915,6 +1929,8 @@
 
1071
@@ -1914,6 +1928,8 @@
1072
1072
        /*--------------------------------------*/
1073
1073
 
1074
1074
        if (lsn) {
1077
1077
                /* Depending on the my.cnf options, we may now write the log
1078
1078
                buffer to the log files, making the prepared state of the
1079
1079
                transaction durable if the OS does not crash. We may also
1080
 
@@ -1934,9 +1950,15 @@
 
1080
@@ -1933,9 +1949,15 @@
1081
1081
 
1082
1082
                mutex_exit(&kernel_mutex);
1083
1083
 
1095
1095
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1096
1096
                                /* Write the log but do not flush it to disk */
1097
1097
 
1098
 
@@ -1948,7 +1970,7 @@
 
1098
@@ -1947,7 +1969,7 @@
1099
1099
 
1100
1100
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1101
1101
                        }