]> git.pld-linux.org Git - packages/mysql.git/blame - mysql-innodb_io_patches.patch
- oudated
[packages/mysql.git] / mysql-innodb_io_patches.patch
CommitLineData
45532174
ER
1diff -r ed298a6e5e10 innobase/buf/buf0flu.c
2--- a/innobase/buf/buf0flu.c Mon Jun 01 00:36:10 2009 -0700
3+++ b/innobase/buf/buf0flu.c Mon Jun 01 00:36:16 2009 -0700
dcc72bc6
ER
4@@ -898,10 +898,17 @@
5
6 old_page_count = page_count;
7
8+ if (srv_flush_neighbor_pages) {
9 /* Try to flush also all the neighbors */
10 page_count +=
11 buf_flush_try_neighbors(space, offset,
12 flush_type);
13+ } else {
14+ /* Try to flush the page only */
15+ page_count +=
16+ buf_flush_try_page(space, offset,
17+ flush_type);
18+ }
19 /* fprintf(stderr,
20 "Flush type %lu, page no %lu, neighb %lu\n",
21 flush_type, offset,
45532174
ER
22diff -r ed298a6e5e10 innobase/buf/buf0rea.c
23--- a/innobase/buf/buf0rea.c Mon Jun 01 00:36:10 2009 -0700
24+++ b/innobase/buf/buf0rea.c Mon Jun 01 00:36:16 2009 -0700
25@@ -20,6 +20,7 @@
26 #include "os0file.h"
27 #include "srv0start.h"
28
29+extern uint srv_read_ahead;
30 extern ulint srv_read_ahead_rnd;
31 extern ulint srv_read_ahead_seq;
32 extern ulint srv_buf_pool_reads;
33@@ -189,6 +190,10 @@
eccb488f
ER
34 ulint err;
35 ulint i;
dcc72bc6 36
eccb488f
ER
37+ if (!(srv_read_ahead & 1)) {
38+ return(0);
39+ }
dcc72bc6 40+
eccb488f
ER
41 if (srv_startup_is_before_trx_rollback_phase) {
42 /* No read-ahead to avoid thread deadlocks */
dcc72bc6 43 return(0);
45532174 44@@ -396,6 +401,10 @@
eccb488f
ER
45 ulint err;
46 ulint i;
47
48+ if (!(srv_read_ahead & 2)) {
49+ return(0);
50+ }
51+
52 if (srv_startup_is_before_trx_rollback_phase) {
53 /* No read-ahead to avoid thread deadlocks */
54 return(0);
45532174
ER
55diff -r ed298a6e5e10 innobase/ibuf/ibuf0ibuf.c
56--- a/innobase/ibuf/ibuf0ibuf.c Mon Jun 01 00:36:10 2009 -0700
57+++ b/innobase/ibuf/ibuf0ibuf.c Mon Jun 01 00:36:16 2009 -0700
dcc72bc6
ER
58@@ -370,8 +370,9 @@
59 grow in size, as the references on the upper levels of the tree can
60 change */
61
62- ibuf->max_size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE
63- / IBUF_POOL_SIZE_PER_MAX_SIZE;
64+ ibuf->max_size = ut_min( buf_pool_get_curr_size() / UNIV_PAGE_SIZE
65+ / IBUF_POOL_SIZE_PER_MAX_SIZE, (ulint) srv_ibuf_max_size / UNIV_PAGE_SIZE);
66+ srv_ibuf_max_size = (long long) ibuf->max_size * UNIV_PAGE_SIZE;
67 ibuf->meter = IBUF_THRESHOLD + 1;
68
69 UT_LIST_INIT(ibuf->data_list);
70@@ -2258,11 +2259,13 @@
71
72 mutex_enter(&ibuf_mutex);
73
74+ if (!srv_ibuf_active_contract) {
75 if (ibuf->size < ibuf->max_size + IBUF_CONTRACT_ON_INSERT_NON_SYNC) {
76 mutex_exit(&ibuf_mutex);
77
78 return;
79 }
80+ }
81
82 sync = FALSE;
83
45532174
ER
84diff -r ed298a6e5e10 innobase/include/os0file.h
85--- a/innobase/include/os0file.h Mon Jun 01 00:36:10 2009 -0700
86+++ b/innobase/include/os0file.h Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
87@@ -551,8 +551,10 @@
88 /*========*/
89 ulint n, /* in: maximum number of pending aio operations
90 allowed; n must be divisible by n_segments */
91- ulint n_segments, /* in: combined number of segments in the four
92- first aio arrays; must be >= 4 */
93+// ulint n_segments, /* in: combined number of segments in the four
94+// first aio arrays; must be >= 4 */
95+ ulint n_read_threads, /* n_segments == 2 + n_read_threads + n_write_threads */
96+ ulint n_write_threads, /**/
97 ulint n_slots_sync); /* in: number of slots in the sync aio array */
98 /***********************************************************************
99 Requests an asynchronous i/o operation. */
45532174
ER
100diff -r ed298a6e5e10 innobase/include/srv0srv.h
101--- a/innobase/include/srv0srv.h Mon Jun 01 00:36:10 2009 -0700
102+++ b/innobase/include/srv0srv.h Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
103@@ -89,6 +89,8 @@
104 extern ulint srv_lock_table_size;
105
106 extern ulint srv_n_file_io_threads;
107+extern ulint srv_n_read_io_threads;
108+extern ulint srv_n_write_io_threads;
109
110 #ifdef UNIV_LOG_ARCHIVE
111 extern ibool srv_log_archive_on;
45532174 112@@ -133,6 +135,15 @@
eccb488f
ER
113 extern ulong srv_max_purge_lag;
114 extern ibool srv_use_awe;
115 extern ibool srv_use_adaptive_hash_indexes;
116+
117+extern ulint srv_io_capacity;
dcc72bc6
ER
118+extern long long srv_ibuf_max_size;
119+extern ulint srv_ibuf_active_contract;
120+extern ulint srv_ibuf_accel_rate;
121+extern ulint srv_flush_neighbor_pages;
45532174 122+extern ulint srv_enable_unsafe_group_commit;
dcc72bc6 123+extern uint srv_read_ahead;
eccb488f
ER
124+extern ulint srv_adaptive_checkpoint;
125 /*-------------------------------------------*/
126
127 extern ulint srv_n_rows_inserted;
45532174
ER
128diff -r ed298a6e5e10 innobase/log/log0log.c
129--- a/innobase/log/log0log.c Mon Jun 01 00:36:10 2009 -0700
130+++ b/innobase/log/log0log.c Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
131@@ -3326,6 +3326,15 @@
132 (ulong) ut_dulint_get_high(log_sys->last_checkpoint_lsn),
133 (ulong) ut_dulint_get_low(log_sys->last_checkpoint_lsn));
134
135+ fprintf(file,
136+ "Max checkpoint age %lu\n"
137+ "Modified age %lu\n"
138+ "Checkpoint age %lu\n",
139+ (ulong) log_sys->max_checkpoint_age,
140+ (ulong) ut_dulint_minus(log_sys->lsn,
141+ log_buf_pool_get_oldest_modification()),
142+ (ulong) ut_dulint_minus(log_sys->lsn, log_sys->last_checkpoint_lsn));
143+
144 current_time = time(NULL);
145
146 time_elapsed = 0.001 + difftime(current_time,
45532174
ER
147diff -r ed298a6e5e10 innobase/os/os0file.c
148--- a/innobase/os/os0file.c Mon Jun 01 00:36:10 2009 -0700
149+++ b/innobase/os/os0file.c Mon Jun 01 00:36:16 2009 -0700
150@@ -2878,8 +2878,10 @@
eccb488f
ER
151 /*========*/
152 ulint n, /* in: maximum number of pending aio operations
153 allowed; n must be divisible by n_segments */
154- ulint n_segments, /* in: combined number of segments in the four
155- first aio arrays; must be >= 4 */
156+// ulint n_segments, /* in: combined number of segments in the four
157+// first aio arrays; must be >= 4 */
158+ ulint n_read_threads, /* n_segments == 2 + n_read_threads + n_write_threads*/
159+ ulint n_write_threads, /**/
160 ulint n_slots_sync) /* in: number of slots in the sync aio array */
161 {
162 ulint n_read_segs;
45532174 163@@ -2889,6 +2891,8 @@
eccb488f
ER
164 #ifdef POSIX_ASYNC_IO
165 sigset_t sigset;
166 #endif
167+ ulint n_segments = 2 + n_read_threads + n_write_threads;
168+
169 ut_ad(n % n_segments == 0);
170 ut_ad(n_segments >= 4);
171
45532174 172@@ -2899,8 +2903,8 @@
eccb488f
ER
173 }
174
175 n_per_seg = n / n_segments;
176- n_write_segs = (n_segments - 2) / 2;
177- n_read_segs = n_segments - 2 - n_write_segs;
178+ n_write_segs = n_write_threads;
179+ n_read_segs = n_read_threads;
180
181 /* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */
182
45532174 183@@ -3181,6 +3185,13 @@
eccb488f
ER
184 struct aiocb* control;
185 #endif
186 ulint i;
187+ ulint prim_segment;
188+ ulint n;
189+
190+ n = array->n_slots / array->n_segments;
191+ /* 64 blocks' striping ( aligning max(BUF_READ_AHEAD_AREA) ) */
192+ prim_segment = ( offset >> (UNIV_PAGE_SIZE_SHIFT + 6) ) % (array->n_segments);
193+
194 loop:
195 os_mutex_enter(array->mutex);
196
45532174 197@@ -3199,6 +3210,16 @@
eccb488f
ER
198 goto loop;
199 }
200
201+ for (i = prim_segment * n; i < array->n_slots; i++) {
202+ slot = os_aio_array_get_nth_slot(array, i);
203+
204+ if (slot->reserved == FALSE) {
205+ break;
206+ }
207+ }
208+
209+ if (slot->reserved == TRUE){
210+ /* Not found after the intended segment. So we should search before. */
211 for (i = 0;; i++) {
212 slot = os_aio_array_get_nth_slot(array, i);
213
45532174 214@@ -3206,6 +3227,7 @@
eccb488f
ER
215 break;
216 }
eccb488f 217 }
dcc72bc6 218+ }
eccb488f
ER
219
220 array->n_reserved++;
dcc72bc6 221
45532174
ER
222diff -r ed298a6e5e10 innobase/srv/srv0srv.c
223--- a/innobase/srv/srv0srv.c Mon Jun 01 00:36:10 2009 -0700
224+++ b/innobase/srv/srv0srv.c Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
225@@ -167,6 +167,8 @@
226 ulint srv_lock_table_size = ULINT_MAX;
227
228 ulint srv_n_file_io_threads = ULINT_MAX;
229+ulint srv_n_read_io_threads = 1;
230+ulint srv_n_write_io_threads = 1;
231
232 #ifdef UNIV_LOG_ARCHIVE
233 ibool srv_log_archive_on = FALSE;
45532174 234@@ -330,6 +332,24 @@
eccb488f
ER
235 ibool srv_use_awe = FALSE;
236 ibool srv_use_adaptive_hash_indexes = TRUE;
237
238+ulint srv_io_capacity = 100;
239+
240+/* Returns the number of IO operations that is X percent of the capacity.
241+PCT_IO(5) -> returns the number of IO operations that is 5% of the max
242+where max is srv_io_capacity. */
243+#define PCT_IO(pct) ((ulint) (srv_io_capacity * ((double) pct / 100.0)))
244+
dcc72bc6
ER
245+long long srv_ibuf_max_size = 0;
246+ulint srv_ibuf_active_contract = 0; /* 0:disable 1:enable */
247+ulint srv_ibuf_accel_rate = 100;
248+#define PCT_IBUF_IO(pct) ((ulint) (srv_io_capacity * srv_ibuf_accel_rate * ((double) pct / 10000.0)))
249+
250+ulint srv_flush_neighbor_pages = 1; /* 0:disable 1:enable */
251+
45532174
ER
252+ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
253+
dcc72bc6 254+uint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
eccb488f
ER
255+ulint srv_adaptive_checkpoint = 0; /* 0:disable 1:enable */
256 /*-------------------------------------------*/
257 ulong srv_n_spin_wait_rounds = 20;
258 ulong srv_n_free_tickets_to_enter = 500;
45532174 259@@ -2229,6 +2249,8 @@
eccb488f
ER
260 ibool skip_sleep = FALSE;
261 ulint i;
262
263+ dulint oldest_lsn;
264+
265 #ifdef UNIV_DEBUG_THREAD_CREATION
266 fprintf(stderr, "Master thread starts, id %lu\n",
267 os_thread_pf(os_thread_get_curr_id()));
45532174 268@@ -2317,9 +2339,9 @@
eccb488f
ER
269 + log_sys->n_pending_writes;
270 n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
271 + buf_pool->n_pages_written;
272- if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
273+ if (n_pend_ios < 3 && (n_ios - n_ios_old < PCT_IO(5))) {
274 srv_main_thread_op_info = "doing insert buffer merge";
275- ibuf_contract_for_n_pages(TRUE, 5);
dcc72bc6 276+ ibuf_contract_for_n_pages(TRUE, PCT_IBUF_IO(5));
eccb488f
ER
277
278 srv_main_thread_op_info = "flushing log";
279
45532174 280@@ -2332,7 +2354,7 @@
eccb488f
ER
281 /* Try to keep the number of modified pages in the
282 buffer pool under the limit wished by the user */
283
284- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
285+ n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100),
286 ut_dulint_max);
287
288 /* If we had to do the flush, it may have taken
45532174 289@@ -2341,6 +2363,49 @@
eccb488f
ER
290 iteration of this loop. */
291
292 skip_sleep = TRUE;
293+ } else if (srv_adaptive_checkpoint) {
294+
295+ /* Try to keep modified age not to exceed
296+ max_checkpoint_age * 7/8 line */
297+
298+ mutex_enter(&(log_sys->mutex));
299+
300+ oldest_lsn = buf_pool_get_oldest_modification();
301+ if (ut_dulint_is_zero(oldest_lsn)) {
302+
303+ mutex_exit(&(log_sys->mutex));
304+
305+ } else {
306+ if (ut_dulint_minus(log_sys->lsn, oldest_lsn)
dcc72bc6
ER
307+ > (log_sys->max_checkpoint_age) - ((log_sys->max_checkpoint_age) / 8)) {
308+ /* LOG_POOL_PREFLUSH_RATIO_ASYNC is exceeded. */
309+ /* We should not flush from here. */
310+ mutex_exit(&(log_sys->mutex));
311+ } else if (ut_dulint_minus(log_sys->lsn, oldest_lsn)
eccb488f
ER
312+ > (log_sys->max_checkpoint_age) - ((log_sys->max_checkpoint_age) / 4)) {
313+
314+ /* 2nd defence line (max_checkpoint_age * 3/4) */
315+
316+ mutex_exit(&(log_sys->mutex));
317+
318+ n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100),
319+ ut_dulint_max);
320+ skip_sleep = TRUE;
321+ } else if (ut_dulint_minus(log_sys->lsn, oldest_lsn)
322+ > (log_sys->max_checkpoint_age)/2 ) {
323+
324+ /* 1st defence line (max_checkpoint_age * 1/2) */
325+
326+ mutex_exit(&(log_sys->mutex));
327+
328+ n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(10),
329+ ut_dulint_max);
330+ skip_sleep = TRUE;
331+ } else {
332+ mutex_exit(&(log_sys->mutex));
333+ }
334+ }
335+
336 }
337
338 if (srv_activity_count == old_activity_count) {
45532174 339@@ -2367,10 +2432,10 @@
eccb488f
ER
340 n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes;
341 n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
342 + buf_pool->n_pages_written;
343- if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
344+ if (n_pend_ios < 3 && (n_ios - n_ios_very_old < PCT_IO(200))) {
345
346 srv_main_thread_op_info = "flushing buffer pool pages";
347- buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
348+ buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100), ut_dulint_max);
349
350 srv_main_thread_op_info = "flushing log";
351 log_buffer_flush_to_disk();
45532174 352@@ -2380,7 +2445,7 @@
eccb488f
ER
353 even if the server were active */
354
355 srv_main_thread_op_info = "doing insert buffer merge";
356- ibuf_contract_for_n_pages(TRUE, 5);
dcc72bc6 357+ ibuf_contract_for_n_pages(TRUE, PCT_IBUF_IO(5));
eccb488f
ER
358
359 srv_main_thread_op_info = "flushing log";
360 log_buffer_flush_to_disk();
45532174 361@@ -2422,14 +2487,14 @@
eccb488f
ER
362 (> 70 %), we assume we can afford reserving the disk(s) for
363 the time it requires to flush 100 pages */
364
365- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
366+ n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100),
367 ut_dulint_max);
368 } else {
369 /* Otherwise, we only flush a small number of pages so that
370 we do not unnecessarily use much disk i/o capacity from
371 other work */
372
373- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10,
374+ n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(10),
375 ut_dulint_max);
376 }
377
45532174 378@@ -2518,7 +2583,7 @@
eccb488f
ER
379 if (srv_fast_shutdown && srv_shutdown_state > 0) {
380 n_bytes_merged = 0;
381 } else {
382- n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
dcc72bc6 383+ n_bytes_merged = ibuf_contract_for_n_pages(TRUE, PCT_IBUF_IO(100));
eccb488f
ER
384 }
385
386 srv_main_thread_op_info = "reserving kernel mutex";
45532174 387@@ -2535,7 +2600,7 @@
eccb488f
ER
388
389 if (srv_fast_shutdown < 2) {
390 n_pages_flushed =
391- buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
392+ buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100), ut_dulint_max);
393 } else {
394 /* In the fastest shutdown we do not flush the buffer pool
395 to data files: we set n_pages_flushed to 0 artificially. */
45532174
ER
396diff -r ed298a6e5e10 innobase/srv/srv0start.c
397--- a/innobase/srv/srv0start.c Mon Jun 01 00:36:10 2009 -0700
398+++ b/innobase/srv/srv0start.c Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
399@@ -1205,24 +1205,28 @@
400 return(DB_ERROR);
401 }
402
403+ /* over write innodb_file_io_threads */
404+ srv_n_file_io_threads = 2 + srv_n_read_io_threads + srv_n_write_io_threads;
405+
406 /* Restrict the maximum number of file i/o threads */
407 if (srv_n_file_io_threads > SRV_MAX_N_IO_THREADS) {
408
409 srv_n_file_io_threads = SRV_MAX_N_IO_THREADS;
410+ srv_n_read_io_threads = srv_n_write_io_threads = (SRV_MAX_N_IO_THREADS - 2) / 2;
411 }
412
413 if (!os_aio_use_native_aio) {
414 /* In simulated aio we currently have use only for 4 threads */
415- srv_n_file_io_threads = 4;
416+ /*srv_n_file_io_threads = 4;*/
417
418 os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD
419 * srv_n_file_io_threads,
420- srv_n_file_io_threads,
421- SRV_MAX_N_PENDING_SYNC_IOS);
422+ srv_n_read_io_threads, srv_n_write_io_threads,
423+ SRV_MAX_N_PENDING_SYNC_IOS * 8);
424 } else {
425 os_aio_init(SRV_N_PENDING_IOS_PER_THREAD
426 * srv_n_file_io_threads,
427- srv_n_file_io_threads,
428+ srv_n_read_io_threads, srv_n_write_io_threads,
429 SRV_MAX_N_PENDING_SYNC_IOS);
430 }
431
45532174
ER
432diff -r ed298a6e5e10 patch_info/innodb_io_patches.info
433--- /dev/null Thu Jan 01 00:00:00 1970 +0000
434+++ b/patch_info/innodb_io_patches.info Mon Jun 01 00:36:16 2009 -0700
dcc72bc6 435@@ -0,0 +1,11 @@
eccb488f
ER
436+File=innodb_io_patches.patch
437+Name=Cluster of past InnoDB IO patches
dcc72bc6 438+Version=1.1
eccb488f
ER
439+Author=Percona
440+License=GPL
441+Comment=This patch contains fixed (control_flush_and_merge_and_read, control_io-threads, adaptive_flush)
442+ChangeLog=
443+2008-11-06
444+YK: Initial release
dcc72bc6
ER
445+2009-01-09
446+YK: Some parameters are added
45532174
ER
447diff -r ed298a6e5e10 sql/ha_innodb.cc
448--- a/sql/ha_innodb.cc Mon Jun 01 00:36:10 2009 -0700
449+++ b/sql/ha_innodb.cc Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
450@@ -149,6 +149,7 @@
451 innobase_lock_wait_timeout, innobase_force_recovery,
452 innobase_open_files;
453
454+long innobase_read_io_threads, innobase_write_io_threads;
455 longlong innobase_buffer_pool_size, innobase_log_file_size;
456
457 /* The default values for the following char* start-up parameters
45532174 458@@ -1417,6 +1418,8 @@
eccb488f
ER
459 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
460
461 srv_n_file_io_threads = (ulint) innobase_file_io_threads;
462+ srv_n_read_io_threads = (ulint) innobase_read_io_threads;
463+ srv_n_write_io_threads = (ulint) innobase_write_io_threads;
464
465 srv_lock_wait_timeout = (ulint) innobase_lock_wait_timeout;
466 srv_force_recovery = (ulint) innobase_force_recovery;
45532174
ER
467@@ -7330,6 +7333,10 @@
468 trx_t* trx = check_trx_exists(thd);
469
470 if (thd->lex->sql_command != SQLCOM_XA_PREPARE) {
471+ if (srv_enable_unsafe_group_commit && !thd->variables.innodb_support_xa) {
472+ /* choose group commit rather than binlog order */
473+ return(0);
474+ }
475
476 /* For ibbackup to work the order of transactions in binlog
477 and InnoDB must be the same. Consider the situation
478diff -r ed298a6e5e10 sql/ha_innodb.h
479--- a/sql/ha_innodb.h Mon Jun 01 00:36:10 2009 -0700
480+++ b/sql/ha_innodb.h Mon Jun 01 00:36:16 2009 -0700
eccb488f
ER
481@@ -204,6 +204,7 @@
482 extern long innobase_additional_mem_pool_size;
483 extern long innobase_buffer_pool_awe_mem_mb;
484 extern long innobase_file_io_threads, innobase_lock_wait_timeout;
485+extern long innobase_read_io_threads, innobase_write_io_threads;
486 extern long innobase_force_recovery;
487 extern long innobase_open_files;
488 extern char *innobase_data_home_dir, *innobase_data_file_path;
45532174
ER
489@@ -234,6 +235,15 @@
490 extern ulong srv_thread_concurrency;
491 extern ulong srv_commit_concurrency;
492 extern ulong srv_flush_log_at_trx_commit;
eccb488f 493+extern ulong srv_io_capacity;
dcc72bc6
ER
494+extern long long srv_ibuf_max_size;
495+extern ulong srv_ibuf_active_contract;
496+extern ulong srv_ibuf_accel_rate;
497+extern ulong srv_flush_neighbor_pages;
45532174 498+extern ulong srv_enable_unsafe_group_commit;
dcc72bc6 499+extern uint srv_read_ahead;
eccb488f 500+extern ulong srv_adaptive_checkpoint;
45532174
ER
501+
502 /* An option to enable the fix for "Bug#43660 SHOW INDEXES/ANALYZE does
503 NOT update cardinality for indexes of InnoDB table". By default we are
504 running with the fix disabled because MySQL 5.1 is frozen for such
505diff -r ed298a6e5e10 sql/mysqld.cc
506--- a/sql/mysqld.cc Mon Jun 01 00:36:10 2009 -0700
507+++ b/sql/mysqld.cc Mon Jun 01 00:36:16 2009 -0700
508@@ -5086,6 +5086,16 @@
eccb488f
ER
509 OPT_INNODB_ROLLBACK_ON_TIMEOUT,
510 OPT_SECURE_FILE_PRIV,
511 OPT_KEEP_FILES_ON_CREATE,
512+ OPT_INNODB_IO_CAPACITY,
dcc72bc6
ER
513+ OPT_INNODB_IBUF_MAX_SIZE,
514+ OPT_INNODB_IBUF_ACTIVE_CONTRACT,
515+ OPT_INNODB_IBUF_ACCEL_RATE,
516+ OPT_INNODB_FLUSH_NEIGHBOR_PAGES,
45532174 517+ OPT_INNODB_ENABLE_UNSAFE_GROUP_COMMIT,
eccb488f
ER
518+ OPT_INNODB_READ_AHEAD,
519+ OPT_INNODB_ADAPTIVE_CHECKPOINT,
520+ OPT_INNODB_READ_IO_THREADS,
521+ OPT_INNODB_WRITE_IO_THREADS,
522 OPT_INNODB_ADAPTIVE_HASH_INDEX,
45532174
ER
523 OPT_FEDERATED,
524 OPT_INNODB_USE_LEGACY_CARDINALITY_ALGORITHM
525@@ -5403,6 +5413,45 @@
526 (gptr*) &srv_use_legacy_cardinality_algorithm,
527 (gptr*) &srv_use_legacy_cardinality_algorithm,
eccb488f
ER
528 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
529+ {"innodb_io_capacity", OPT_INNODB_IO_CAPACITY,
530+ "Number of IO operations per second the server can do. Tunes background IO rate.",
531+ (gptr*) &srv_io_capacity, (gptr*) &srv_io_capacity,
532+ 0, GET_ULONG, REQUIRED_ARG, 100, 100, 999999999, 0, 0, 0},
dcc72bc6
ER
533+ {"innodb_ibuf_max_size", OPT_INNODB_IBUF_MAX_SIZE,
534+ "The maximum size of the insert buffer. (in bytes)",
535+ (gptr*) &srv_ibuf_max_size, (gptr*) &srv_ibuf_max_size, 0,
536+ GET_LL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
537+ {"innodb_ibuf_active_contract", OPT_INNODB_IBUF_ACTIVE_CONTRACT,
538+ "Enable/Disable active_contract of insert buffer. 0:disable 1:enable",
539+ (gptr*) &srv_ibuf_active_contract, (gptr*) &srv_ibuf_active_contract,
540+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 0, 0},
541+ {"innodb_ibuf_accel_rate", OPT_INNODB_IBUF_ACCEL_RATE,
542+ "Tunes amount of insert buffer processing of background, in addition to innodb_io_capacity. (in percentage)",
543+ (gptr*) &srv_ibuf_accel_rate, (gptr*) &srv_ibuf_accel_rate,
544+ 0, GET_ULONG, REQUIRED_ARG, 100, 100, 999999999, 0, 0, 0},
545+ {"innodb_flush_neighbor_pages", OPT_INNODB_FLUSH_NEIGHBOR_PAGES,
546+ "Enable/Disable flushing also neighbor pages. 0:disable 1:enable",
547+ (gptr*) &srv_flush_neighbor_pages, (gptr*) &srv_flush_neighbor_pages,
548+ 0, GET_ULONG, REQUIRED_ARG, 1, 0, 1, 0, 0, 0},
eccb488f 549+ {"innodb_read_ahead", OPT_INNODB_READ_AHEAD,
dcc72bc6
ER
550+ "Control read ahead activity. (none, random, linear, [both])",
551+ 0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
eccb488f 552+ {"innodb_adaptive_checkpoint", OPT_INNODB_ADAPTIVE_CHECKPOINT,
dcc72bc6 553+ "Enable/Diasable flushing along modified age. 0:disable 1:enable",
eccb488f
ER
554+ (gptr*) &srv_adaptive_checkpoint, (gptr*) &srv_adaptive_checkpoint,
555+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 0, 0},
45532174
ER
556+ {"innodb_enable_unsafe_group_commit", OPT_INNODB_ENABLE_UNSAFE_GROUP_COMMIT,
557+ "Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine.",
558+ (gptr*) &srv_enable_unsafe_group_commit, (gptr*) &srv_enable_unsafe_group_commit,
559+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 0, 0},
eccb488f
ER
560+ {"innodb_read_io_threads", OPT_INNODB_READ_IO_THREADS,
561+ "Number of background read I/O threads in InnoDB.",
562+ (gptr*) &innobase_read_io_threads, (gptr*) &innobase_read_io_threads,
563+ 0, GET_LONG, REQUIRED_ARG, 1, 1, 64, 0, 0, 0},
564+ {"innodb_write_io_threads", OPT_INNODB_WRITE_IO_THREADS,
565+ "Number of background write I/O threads in InnoDB.",
566+ (gptr*) &innobase_write_io_threads, (gptr*) &innobase_write_io_threads,
567+ 0, GET_LONG, REQUIRED_ARG, 1, 1, 64, 0, 0, 0},
568 #endif /* End HAVE_INNOBASE_DB */
569 {"isam", OPT_ISAM, "Obsolete. ISAM storage engine is no longer supported.",
570 (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 0, 0, 0,
45532174 571@@ -7644,6 +7693,22 @@
dcc72bc6
ER
572 case OPT_INNODB_LOG_ARCHIVE:
573 innobase_log_archive= argument ? test(atoi(argument)) : 1;
574 break;
575+ case OPT_INNODB_READ_AHEAD:
576+ if (argument == disabled_my_option)
577+ srv_read_ahead = 0;
578+ else if (! argument)
579+ srv_read_ahead = 3;
580+ else
581+ {
582+ int type;
583+ if ((type=find_type(argument, &innodb_read_ahead_typelib, 2)) <= 0)
584+ {
585+ fprintf(stderr,"Unknown innodb_read_ahead type: %s\n",argument);
586+ exit(1);
587+ }
588+ srv_read_ahead = (uint) ((type - 1) & 3);
589+ }
590+ break;
591 #endif /* HAVE_INNOBASE_DB */
592 case OPT_MYISAM_RECOVER:
593 {
45532174
ER
594diff -r ed298a6e5e10 sql/set_var.cc
595--- a/sql/set_var.cc Mon Jun 01 00:36:10 2009 -0700
596+++ b/sql/set_var.cc Mon Jun 01 00:36:16 2009 -0700
597@@ -489,6 +489,39 @@
eccb488f
ER
598 sys_var_long_ptr sys_innodb_flush_log_at_trx_commit(
599 "innodb_flush_log_at_trx_commit",
600 &srv_flush_log_at_trx_commit);
601+sys_var_long_ptr sys_innodb_io_capacity("innodb_io_capacity",
602+ &srv_io_capacity);
dcc72bc6
ER
603+sys_var_long_ptr sys_innodb_ibuf_active_contract("innodb_ibuf_active_contract",
604+ &srv_ibuf_active_contract);
605+sys_var_long_ptr sys_innodb_ibuf_accel_rate("innodb_ibuf_accel_rate",
606+ &srv_ibuf_accel_rate);
607+sys_var_long_ptr sys_innodb_flush_neighbor_pages("innodb_flush_neighbor_pages",
608+ &srv_flush_neighbor_pages);
609+
610+const char *innodb_read_ahead_names[]=
611+{
612+ "none", /* 0 */
613+ "random",
614+ "linear",
615+ "both", /* 3 */
616+ /* For compatibility of the older patch */
617+ "0", /* 4 ("none" + 4) */
618+ "1",
619+ "2",
620+ "3", /* 7 ("both" + 4) */
621+ NullS
622+};
623+TYPELIB innodb_read_ahead_typelib=
624+{
625+ array_elements(innodb_read_ahead_names) - 1, "innodb_read_ahead_typelib",
626+ innodb_read_ahead_names, NULL
627+};
628+sys_var_enum sys_innodb_read_ahead("innodb_read_ahead", &srv_read_ahead,
629+ &innodb_read_ahead_typelib, fix_innodb_read_ahead);
45532174
ER
630+sys_var_long_ptr sys_innodb_enable_unsafe_group_commit("innodb_enable_unsafe_group_commit",
631+ &srv_enable_unsafe_group_commit);
eccb488f
ER
632+sys_var_long_ptr sys_innodb_adaptive_checkpoint("innodb_adaptive_checkpoint",
633+ &srv_adaptive_checkpoint);
634 sys_var_const_os_str_ptr sys_innodb_data_file_path("innodb_data_file_path",
635 &innobase_data_file_path);
636 sys_var_const_os_str_ptr sys_innodb_data_home_dir("innodb_data_home_dir",
45532174 637@@ -860,6 +893,13 @@
eccb488f
ER
638 &sys_innodb_thread_concurrency,
639 &sys_innodb_commit_concurrency,
640 &sys_innodb_flush_log_at_trx_commit,
641+ &sys_innodb_io_capacity,
dcc72bc6
ER
642+ &sys_innodb_ibuf_active_contract,
643+ &sys_innodb_ibuf_accel_rate,
644+ &sys_innodb_flush_neighbor_pages,
eccb488f 645+ &sys_innodb_read_ahead,
45532174 646+ &sys_innodb_enable_unsafe_group_commit,
eccb488f
ER
647+ &sys_innodb_adaptive_checkpoint,
648 #endif
649 &sys_trust_routine_creators,
650 &sys_trust_function_creators,
45532174
ER
651@@ -997,6 +1037,16 @@
652 {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
653 {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS},
eccb488f
ER
654 {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS},
655+ {sys_innodb_io_capacity.name, (char*) &sys_innodb_io_capacity, SHOW_SYS},
dcc72bc6
ER
656+ {"innodb_ibuf_max_size", (char*) &srv_ibuf_max_size, SHOW_LONGLONG},
657+ {sys_innodb_ibuf_active_contract.name, (char*) &sys_innodb_ibuf_active_contract, SHOW_SYS},
658+ {sys_innodb_ibuf_accel_rate.name, (char*) &sys_innodb_ibuf_accel_rate, SHOW_SYS},
659+ {sys_innodb_flush_neighbor_pages.name, (char*) &sys_innodb_flush_neighbor_pages, SHOW_SYS},
eccb488f 660+ {sys_innodb_read_ahead.name, (char*) &sys_innodb_read_ahead, SHOW_SYS},
45532174 661+ {sys_innodb_enable_unsafe_group_commit.name, (char*) &sys_innodb_enable_unsafe_group_commit, SHOW_SYS},
eccb488f
ER
662+ {sys_innodb_adaptive_checkpoint.name, (char*) &sys_innodb_adaptive_checkpoint, SHOW_SYS},
663+ {"innodb_read_io_threads", (char*) &innobase_read_io_threads, SHOW_LONG},
664+ {"innodb_write_io_threads", (char*) &innobase_write_io_threads, SHOW_LONG},
45532174
ER
665 {sys_innodb_use_legacy_cardinality_algorithm.name,
666 (char*) &sys_innodb_use_legacy_cardinality_algorithm, SHOW_SYS},
eccb488f 667 #endif
45532174 668@@ -1459,6 +1509,13 @@
dcc72bc6
ER
669 }
670 }
45532174 671
dcc72bc6
ER
672+#ifdef HAVE_INNOBASE_DB
673+extern void fix_innodb_read_ahead(THD *thd, enum_var_type type)
674+{
675+ srv_read_ahead &= 3;
676+}
677+#endif /* HAVE_INNOBASE_DB */
678+
679 static void fix_max_binlog_size(THD *thd, enum_var_type type)
680 {
681 DBUG_ENTER("fix_max_binlog_size");
45532174
ER
682diff -r ed298a6e5e10 sql/set_var.h
683--- a/sql/set_var.h Mon Jun 01 00:36:10 2009 -0700
684+++ b/sql/set_var.h Mon Jun 01 00:36:16 2009 -0700
dcc72bc6 685@@ -31,6 +31,10 @@
45532174 686
dcc72bc6 687 extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
45532174 688
dcc72bc6
ER
689+#ifdef HAVE_INNOBASE_DB
690+extern TYPELIB innodb_read_ahead_typelib;
691+#endif /* HAVE_INNOBASE_DB */
692+
693 typedef int (*sys_check_func)(THD *, set_var *);
694 typedef bool (*sys_update_func)(THD *, set_var *);
695 typedef void (*sys_after_update_func)(THD *,enum_var_type);
45532174 696@@ -1148,6 +1152,9 @@
dcc72bc6
ER
697 int sql_set_variables(THD *thd, List<set_var_base> *var_list);
698 bool not_all_support_one_shot(List<set_var_base> *var_list);
699 void fix_delay_key_write(THD *thd, enum_var_type type);
700+#ifdef HAVE_INNOBASE_DB
701+void fix_innodb_read_ahead(THD *thd, enum_var_type type);
702+#endif /* HAVE_INNOBASE_DB */
703 ulong fix_sql_mode(ulong sql_mode);
704 extern sys_var_const_str sys_charset_system;
705 extern sys_var_str sys_init_connect;
This page took 0.194663 seconds and 4 git commands to generate.