~percona-dev/percona-server/5.5.8-show-LRU-flushed

« back to all changes in this revision

Viewing changes to innodb_io_patches.patch

  • Committer: Yasufumi Kinoshita
  • Date: 2010-12-29 06:47:06 UTC
  • Revision ID: kinoyasu@rynex6-20101229064706-z8wpa0yjfqsqece4
port Yasufumi's patches to 5.5.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
28
28
--- a/storage/innobase/buf/buf0flu.c    2010-11-03 07:01:13.000000000 +0900
29
29
+++ b/storage/innobase/buf/buf0flu.c    2010-12-03 15:10:08.934990091 +0900
30
 
@@ -1271,7 +1271,7 @@
 
30
@@ -1348,7 +1348,7 @@
31
31
 
32
32
        ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
33
33
 
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
 
@@ -431,6 +431,12 @@
 
56
@@ -425,6 +425,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
 
@@ -823,6 +829,17 @@
 
69
@@ -817,6 +823,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
 
@@ -2361,6 +2378,9 @@
 
87
@@ -2388,6 +2405,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
 
@@ -10084,6 +10104,10 @@
98
 
        if (thd_sql_command(thd) != SQLCOM_XA_PREPARE &&
99
 
            (all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
100
 
        {
 
97
@@ -10105,6 +10125,10 @@
 
98
            && (all
 
99
                || !thd_test_options(
 
100
                        thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
101
101
+               if (srv_enable_unsafe_group_commit && !THDVAR(thd, support_xa)) {
102
102
+                       /* choose group commit rather than binlog order */
103
103
+                       return(error);
105
105
 
106
106
                /* For ibbackup to work the order of transactions in binlog
107
107
                and InnoDB must be the same. Consider the situation
108
 
@@ -10894,9 +10918,9 @@
 
108
@@ -10915,9 +10939,9 @@
109
109
 
110
110
 static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
111
111
   PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
117
117
   0,                   /* Minimum value */
118
118
   1, 0);               /* Maximum value */
119
119
 
120
 
@@ -10986,7 +11010,7 @@
 
120
@@ -11007,7 +11031,7 @@
121
121
 static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
122
122
   PLUGIN_VAR_NOCMDARG,
123
123
   "Attempt flushing dirty pages to avoid IO bursts at checkpoints.",
126
126
 
127
127
 static MYSQL_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
128
128
   PLUGIN_VAR_RQCMDARG,
129
 
@@ -11038,7 +11062,7 @@
 
129
@@ -11059,7 +11083,7 @@
130
130
 static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
131
131
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
132
132
   "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
135
135
 
136
136
 static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
137
137
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
138
 
@@ -11176,6 +11200,102 @@
 
138
@@ -11204,6 +11228,102 @@
139
139
   "trigger a readahead.",
140
140
   NULL, NULL, 56, 0, 64, 0);
141
141
 
238
238
 static struct st_mysql_sys_var* innobase_system_variables[]= {
239
239
   MYSQL_SYSVAR(additional_mem_pool_size),
240
240
   MYSQL_SYSVAR(autoextend_increment),
241
 
@@ -11232,6 +11352,15 @@
 
241
@@ -11260,6 +11380,15 @@
242
242
   MYSQL_SYSVAR(show_verbose_locks),
243
243
   MYSQL_SYSVAR(show_locks_held),
244
244
   MYSQL_SYSVAR(version),
267
267
diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
268
268
--- a/storage/innobase/ibuf/ibuf0ibuf.c 2010-11-03 07:01:13.000000000 +0900
269
269
+++ b/storage/innobase/ibuf/ibuf0ibuf.c 2010-12-03 15:10:09.073984282 +0900
270
 
@@ -518,8 +518,10 @@
 
270
@@ -524,8 +524,10 @@
271
271
        grow in size, as the references on the upper levels of the tree can
272
272
        change */
273
273
 
280
280
 
281
281
        mutex_create(ibuf_pessimistic_insert_mutex_key,
282
282
                     &ibuf_pessimistic_insert_mutex,
283
 
@@ -2645,9 +2647,11 @@
 
283
@@ -2651,9 +2653,11 @@
284
284
        size = ibuf->size;
285
285
        max_size = ibuf->max_size;
286
286
 
324
324
diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
325
325
--- a/storage/innobase/include/srv0srv.h        2010-12-03 15:09:51.291955835 +0900
326
326
+++ b/storage/innobase/include/srv0srv.h        2010-12-03 15:10:09.079029047 +0900
327
 
@@ -205,6 +205,16 @@
 
327
@@ -214,6 +214,16 @@
328
328
 extern ulong   srv_max_purge_lag;
329
329
 
330
330
 extern ulong   srv_replication_delay;
341
341
 /*-------------------------------------------*/
342
342
 
343
343
 extern ulint   srv_n_rows_inserted;
344
 
@@ -378,8 +388,9 @@
 
344
@@ -387,8 +397,9 @@
345
345
                                when writing data files, but do flush
346
346
                                after writing to log files */
347
347
        SRV_UNIX_NOSYNC,        /*!< do not flush after writing */
355
355
diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
356
356
--- a/storage/innobase/include/trx0trx.h        2010-11-03 07:01:13.000000000 +0900
357
357
+++ b/storage/innobase/include/trx0trx.h        2010-12-03 15:10:09.081029243 +0900
358
 
@@ -487,6 +487,7 @@
 
358
@@ -501,6 +501,7 @@
359
359
                                        FALSE, one can save CPU time and about
360
360
                                        150 bytes in the undo log size as then
361
361
                                        we skip XA steps */
468
468
                /* A checkpoint is not urgent: do it asynchronously */
469
469
 
470
470
                do_checkpoint = TRUE;
471
 
@@ -3342,6 +3372,17 @@
 
471
@@ -3349,6 +3379,17 @@
472
472
                log_sys->flushed_to_disk_lsn,
473
473
                log_sys->last_checkpoint_lsn);
474
474
 
506
506
diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
507
507
--- a/storage/innobase/os/os0file.c     2010-11-03 07:01:13.000000000 +0900
508
508
+++ b/storage/innobase/os/os0file.c     2010-12-03 15:10:09.093023540 +0900
509
 
@@ -1558,6 +1558,11 @@
 
509
@@ -1560,6 +1560,11 @@
510
510
                os_file_set_nocache(file, name, mode_str);
511
511
        }
512
512
 
539
539
 /*-------------------------------------------*/
540
540
 UNIV_INTERN ulong      srv_n_spin_wait_rounds  = 30;
541
541
 UNIV_INTERN ulong      srv_n_free_tickets_to_enter = 500;
542
 
@@ -2668,6 +2679,7 @@
 
542
@@ -2690,6 +2701,7 @@
543
543
        ulint           n_pages_purged  = 0;
544
544
        ulint           n_bytes_merged;
545
545
        ulint           n_pages_flushed;
547
547
        ulint           n_bytes_archived;
548
548
        ulint           n_tables_to_drop;
549
549
        ulint           n_ios;
550
 
@@ -2675,7 +2687,20 @@
 
550
@@ -2697,7 +2709,20 @@
551
551
        ulint           n_ios_very_old;
552
552
        ulint           n_pend_ios;
553
553
        ulint           next_itr_time;
568
568
 
569
569
 #ifdef UNIV_DEBUG_THREAD_CREATION
570
570
        fprintf(stderr, "Master thread starts, id %lu\n",
571
 
@@ -2697,6 +2722,9 @@
 
571
@@ -2719,6 +2744,9 @@
572
572
 
573
573
        mutex_exit(&kernel_mutex);
574
574
 
578
578
 loop:
579
579
        /*****************************************************************/
580
580
        /* ---- When there is database activity by users, we cycle in this
581
 
@@ -2727,6 +2755,8 @@
 
581
@@ -2749,6 +2777,8 @@
582
582
        /* Sleep for 1 second on entrying the for loop below the first time. */
583
583
        next_itr_time = ut_time_ms() + 1000;
584
584
 
587
587
        for (i = 0; i < 10; i++) {
588
588
                ulint   cur_time = ut_time_ms();
589
589
 
590
 
@@ -2738,6 +2768,7 @@
 
590
@@ -2775,6 +2805,7 @@
591
591
                srv_main_thread_op_info = "sleeping";
592
592
                srv_main_1_second_loops++;
593
593
 
594
594
+               if (!skip_sleep) {
595
 
                if (next_itr_time > cur_time) {
 
595
                if (next_itr_time > cur_time
 
596
                    && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
596
597
 
597
 
                        /* Get sleep interval in micro seconds. We use
598
 
@@ -2747,10 +2778,26 @@
 
598
@@ -2785,10 +2816,26 @@
599
599
                                        (next_itr_time - cur_time)
600
600
                                         * 1000));
601
601
                        srv_main_sleeps++;
620
620
+
621
621
+               skip_sleep = FALSE;
622
622
 
623
 
                /* ALTER TABLE in MySQL requires on Unix that the table handler
624
 
                can drop tables lazily after there no longer are SELECT
625
 
@@ -2785,7 +2832,7 @@
 
623
                /* Flush logs if needed */
 
624
                srv_sync_log_buffer_in_background();
 
625
@@ -2808,7 +2855,7 @@
626
626
                if (n_pend_ios < SRV_PEND_IO_THRESHOLD
627
627
                    && (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
628
628
                        srv_main_thread_op_info = "doing insert buffer merge";
631
631
 
632
632
                        /* Flush logs if needed */
633
633
                        srv_sync_log_buffer_in_background();
634
 
@@ -2802,6 +2849,10 @@
 
634
@@ -2825,6 +2872,10 @@
635
635
                        n_pages_flushed = buf_flush_list(
636
636
                                PCT_IO(100), IB_ULONGLONG_MAX);
637
637
 
642
642
                } else if (srv_adaptive_flushing) {
643
643
 
644
644
                        /* Try to keep the rate of flushing of dirty
645
 
@@ -2818,6 +2869,267 @@
 
645
@@ -2841,6 +2892,267 @@
646
646
                                                n_flush,
647
647
                                                IB_ULONGLONG_MAX);
648
648
                        }
910
910
                }
911
911
 
912
912
                if (srv_activity_count == old_activity_count) {
913
 
@@ -2866,7 +3178,7 @@
 
913
@@ -2889,7 +3201,7 @@
914
914
        even if the server were active */
915
915
 
916
916
        srv_main_thread_op_info = "doing insert buffer merge";
919
919
 
920
920
        /* Flush logs if needed */
921
921
        srv_sync_log_buffer_in_background();
922
 
@@ -2972,7 +3284,7 @@
 
922
@@ -2997,7 +3309,7 @@
923
923
                buf_flush_list below. Otherwise, the system favors
924
924
                clean pages over cleanup throughput. */
925
925
                n_bytes_merged = ibuf_contract_for_n_pages(FALSE,
928
928
        }
929
929
 
930
930
        srv_main_thread_op_info = "reserving kernel mutex";
931
 
@@ -3118,6 +3430,7 @@
 
931
@@ -3143,6 +3455,7 @@
932
932
        srv_slot_t*     slot;
933
933
        ulint           slot_no = ULINT_UNDEFINED;
934
934
        ulint           n_total_purged = ULINT_UNDEFINED;
936
936
 
937
937
        ut_a(srv_n_purge_threads == 1);
938
938
 
939
 
@@ -3140,9 +3453,12 @@
 
939
@@ -3165,9 +3478,12 @@
940
940
 
941
941
        mutex_exit(&kernel_mutex);
942
942
 
949
949
 
950
950
                /* If there are very few records to purge or the last
951
951
                purge didn't purge any records then wait for activity.
952
 
@@ -3183,6 +3499,16 @@
 
952
@@ -3208,6 +3524,16 @@
953
953
                } while (n_pages_purged > 0 && !srv_fast_shutdown);
954
954
 
955
955
                srv_sync_log_buffer_in_background();
969
969
diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
970
970
--- a/storage/innobase/srv/srv0start.c  2010-11-03 07:01:13.000000000 +0900
971
971
+++ b/storage/innobase/srv/srv0start.c  2010-12-03 15:10:09.103023543 +0900
972
 
@@ -1205,6 +1205,9 @@
 
972
@@ -1184,6 +1184,9 @@
973
973
        } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
974
974
                srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
975
975
 
982
982
diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
983
983
--- a/storage/innobase/trx/trx0trx.c    2010-11-03 07:01:13.000000000 +0900
984
984
+++ b/storage/innobase/trx/trx0trx.c    2010-12-03 15:10:09.106023937 +0900
985
 
@@ -114,6 +114,8 @@
 
985
@@ -118,6 +118,8 @@
986
986
 
987
987
        trx->support_xa = TRUE;
988
988
 
991
991
        trx->check_foreigns = TRUE;
992
992
        trx->check_unique_secondary = TRUE;
993
993
 
994
 
@@ -706,6 +708,9 @@
 
994
@@ -709,6 +711,9 @@
995
995
        generated by the same transaction, doesn't. */
996
996
        trx->support_xa = thd_supports_xa(trx->mysql_thd);
997
997
 
1001
1001
        mutex_enter(&kernel_mutex);
1002
1002
 
1003
1003
        ret = trx_start_low(trx, rseg_id);
1004
 
@@ -863,6 +868,7 @@
 
1004
@@ -865,6 +870,7 @@
1005
1005
        trx->read_view = NULL;
1006
1006
 
1007
1007
        if (lsn) {
1009
1009
 
1010
1010
                mutex_exit(&kernel_mutex);
1011
1011
 
1012
 
@@ -871,6 +877,12 @@
 
1012
@@ -873,6 +879,12 @@
1013
1013
                        trx_undo_insert_cleanup(trx);
1014
1014
                }
1015
1015
 
1022
1022
                /* NOTE that we could possibly make a group commit more
1023
1023
                efficient here: call os_thread_yield here to allow also other
1024
1024
                trxs to come to commit! */
1025
 
@@ -902,9 +914,9 @@
 
1025
@@ -904,9 +916,9 @@
1026
1026
                if (trx->flush_log_later) {
1027
1027
                        /* Do nothing yet */
1028
1028
                        trx->must_flush_log_later = TRUE;
1034
1034
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1035
1035
                                /* Write the log but do not flush it to disk */
1036
1036
 
1037
 
@@ -916,7 +928,7 @@
 
1037
@@ -918,7 +930,7 @@
1038
1038
 
1039
1039
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1040
1040
                        }
1043
1043
 
1044
1044
                        /* Write the log but do not flush it to disk */
1045
1045
 
1046
 
@@ -1580,16 +1592,23 @@
 
1046
@@ -1582,16 +1594,23 @@
1047
1047
        trx_t*  trx)    /*!< in: trx handle */
1048
1048
 {
1049
1049
        ib_uint64_t     lsn     = trx->commit_lsn;
1069
1069
                if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1070
1070
                        /* Write the log but do not flush it to disk */
1071
1071
 
1072
 
@@ -1600,7 +1619,7 @@
 
1072
@@ -1602,7 +1621,7 @@
1073
1073
 
1074
1074
                        log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1075
1075
                }
1078
1078
 
1079
1079
                /* Write the log but do not flush it to disk */
1080
1080
 
1081
 
@@ -1853,6 +1872,8 @@
 
1081
@@ -1855,6 +1874,8 @@
1082
1082
        /*--------------------------------------*/
1083
1083
 
1084
1084
        if (lsn) {
1087
1087
                /* Depending on the my.cnf options, we may now write the log
1088
1088
                buffer to the log files, making the prepared state of the
1089
1089
                transaction durable if the OS does not crash. We may also
1090
 
@@ -1872,9 +1893,15 @@
 
1090
@@ -1874,9 +1895,15 @@
1091
1091
 
1092
1092
                mutex_exit(&kernel_mutex);
1093
1093
 
1105
1105
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1106
1106
                                /* Write the log but do not flush it to disk */
1107
1107
 
1108
 
@@ -1886,7 +1913,7 @@
 
1108
@@ -1888,7 +1915,7 @@
1109
1109
 
1110
1110
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1111
1111
                        }