Merge lp:~percona-dev/percona-patches/5.0.84-fix-bug-413858 into lp:~percona-dev/percona-patches/5.0.84

Proposed by Yasufumi Kinoshita
Status: Merged
Merged at revision: not available
Proposed branch: lp:~percona-dev/percona-patches/5.0.84-fix-bug-413858
Merge into: lp:~percona-dev/percona-patches/5.0.84
Diff against target: None lines
To merge this branch: bzr merge lp:~percona-dev/percona-patches/5.0.84-fix-bug-413858
Reviewer Review Type Date Requested Status
Vadim Tkachenko Approve
Review via email: mp+10827@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vadim Tkachenko (vadim-tk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'innodb_dict_size_limit.patch'
--- innodb_dict_size_limit.patch 2009-07-03 22:42:33 +0000
+++ innodb_dict_size_limit.patch 2009-08-28 02:14:10 +0000
@@ -1,6 +1,134 @@
1diff -r 6eeee157fd40 innobase/dict/dict0boot.c1diff -ruN a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
2--- a/innobase/dict/dict0boot.c Fri Jul 03 15:41:34 2009 -07002--- a/innobase/btr/btr0sea.c 2009-08-27 18:42:17.000000000 +0900
3+++ b/innobase/dict/dict0boot.c Fri Jul 03 15:41:41 2009 -07003+++ b/innobase/btr/btr0sea.c 2009-08-27 18:43:11.000000000 +0900
4@@ -1077,6 +1077,124 @@
5 }
6
7 /************************************************************************
8+Drops a page hash index based on index */
9+
10+void
11+btr_search_drop_page_hash_index_on_index(
12+/*=====================================*/
13+ dict_index_t* index) /* in: record descriptor */
14+{
15+ page_t* page;
16+ hash_table_t* table;
17+ buf_block_t* block;
18+ ulint n_fields;
19+ ulint n_bytes;
20+ rec_t* rec;
21+ ulint fold;
22+ ulint prev_fold;
23+ dulint tree_id;
24+ ulint n_cached;
25+ ulint n_recs;
26+ ulint* folds;
27+ ulint i;
28+ mem_heap_t* heap = NULL;
29+ ulint* offsets;
30+
31+ rw_lock_x_lock(&btr_search_latch);
32+ mutex_enter(&buf_pool->mutex);
33+
34+ table = btr_search_sys->hash_index;
35+
36+ block = UT_LIST_GET_LAST(buf_pool->LRU);
37+
38+ while (block != NULL) {
39+ if (block->index == index && block->is_hashed) {
40+ page = block->frame;
41+
42+ /* from btr_search_drop_page_hash_index() */
43+ n_fields = block->curr_n_fields;
44+ n_bytes = block->curr_n_bytes;
45+
46+ ut_a(n_fields + n_bytes > 0);
47+
48+ n_recs = page_get_n_recs(page);
49+
50+ /* Calculate and cache fold values into an array for fast deletion
51+ from the hash index */
52+
53+ folds = mem_alloc(n_recs * sizeof(ulint));
54+
55+ n_cached = 0;
56+
57+ rec = page_get_infimum_rec(page);
58+ rec = page_rec_get_next(rec);
59+
60+ tree_id = btr_page_get_index_id(page);
61+
62+ ut_a(0 == ut_dulint_cmp(tree_id, index->id));
63+
64+ prev_fold = 0;
65+
66+ offsets = NULL;
67+
68+ while (!page_rec_is_supremum(rec)) {
69+ /* FIXME: in a mixed tree, not all records may have enough
70+ ordering fields: */
71+ offsets = rec_get_offsets(rec, index, offsets,
72+ n_fields + (n_bytes > 0), &heap);
73+ ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
74+ fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
75+
76+ if (fold == prev_fold && prev_fold != 0) {
77+
78+ goto next_rec;
79+ }
80+
81+ /* Remove all hash nodes pointing to this page from the
82+ hash chain */
83+
84+ folds[n_cached] = fold;
85+ n_cached++;
86+next_rec:
87+ rec = page_rec_get_next(rec);
88+ prev_fold = fold;
89+ }
90+
91+ for (i = 0; i < n_cached; i++) {
92+
93+ ha_remove_all_nodes_to_page(table, folds[i], page);
94+ }
95+
96+ ut_a(index->search_info->ref_count > 0);
97+ index->search_info->ref_count--;
98+
99+ block->is_hashed = FALSE;
100+ block->index = NULL;
101+
102+ if (UNIV_UNLIKELY(block->n_pointers)) {
103+ /* Corruption */
104+ ut_print_timestamp(stderr);
105+ fprintf(stderr,
106+" InnoDB: Corruption of adaptive hash index. After dropping\n"
107+"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
108+ index->name, (ulong) block->n_pointers);
109+ }
110+
111+ mem_free(folds);
112+ }
113+
114+ block = UT_LIST_GET_PREV(LRU, block);
115+ }
116+
117+ mutex_exit(&buf_pool->mutex);
118+ rw_lock_x_unlock(&btr_search_latch);
119+
120+ if (UNIV_LIKELY_NULL(heap)) {
121+ mem_heap_free(heap);
122+ }
123+}
124+
125+/************************************************************************
126 Drops a page hash index when a page is freed from a fseg to the file system.
127 Drops possible hash index if the page happens to be in the buffer pool. */
128
129diff -ruN a/innobase/dict/dict0boot.c b/innobase/dict/dict0boot.c
130--- a/innobase/dict/dict0boot.c 2009-07-07 21:53:58.000000000 +0900
131+++ b/innobase/dict/dict0boot.c 2009-08-27 18:42:59.000000000 +0900
4@@ -247,6 +247,7 @@132@@ -247,6 +247,7 @@
5 system tables */133 system tables */
6 /*-------------------------*/134 /*-------------------------*/
@@ -33,9 +161,9 @@
33 161
34 dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);162 dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
35 dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);163 dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
36diff -r 6eeee157fd40 innobase/dict/dict0crea.c164diff -ruN a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
37--- a/innobase/dict/dict0crea.c Fri Jul 03 15:41:34 2009 -0700165--- a/innobase/dict/dict0crea.c 2009-07-07 21:53:58.000000000 +0900
38+++ b/innobase/dict/dict0crea.c Fri Jul 03 15:41:41 2009 -0700166+++ b/innobase/dict/dict0crea.c 2009-08-27 18:42:59.000000000 +0900
39@@ -1178,6 +1178,9 @@167@@ -1178,6 +1178,9 @@
40 /* Foreign constraint system tables have already been168 /* Foreign constraint system tables have already been
41 created, and they are ok */169 created, and they are ok */
@@ -46,21 +174,21 @@
46 mutex_exit(&(dict_sys->mutex));174 mutex_exit(&(dict_sys->mutex));
47 175
48 return(DB_SUCCESS);176 return(DB_SUCCESS);
49@@ -1266,6 +1269,11 @@177@@ -1267,6 +1270,11 @@
50 que_graph_free(graph);
51 178
52 trx->op_info = "";179 trx->op_info = "";
53+180
54+ table1 = dict_table_get_low("SYS_FOREIGN");181+ table1 = dict_table_get_low("SYS_FOREIGN");
55+ table2 = dict_table_get_low("SYS_FOREIGN_COLS");182+ table2 = dict_table_get_low("SYS_FOREIGN_COLS");
56+ table1->n_mysql_handles_opened = 1; /* for pin */183+ table1->n_mysql_handles_opened = 1; /* for pin */
57+ table2->n_mysql_handles_opened = 1; /* for pin */184+ table2->n_mysql_handles_opened = 1; /* for pin */
58 185+
59 row_mysql_unlock_data_dictionary(trx);186 row_mysql_unlock_data_dictionary(trx);
60 187
61diff -r 6eeee157fd40 innobase/dict/dict0dict.c188 trx_free_for_mysql(trx);
62--- a/innobase/dict/dict0dict.c Fri Jul 03 15:41:34 2009 -0700189diff -ruN a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
63+++ b/innobase/dict/dict0dict.c Fri Jul 03 15:41:41 2009 -0700190--- a/innobase/dict/dict0dict.c 2009-07-07 21:53:58.000000000 +0900
191+++ b/innobase/dict/dict0dict.c 2009-08-27 18:43:11.000000000 +0900
64@@ -638,6 +638,8 @@192@@ -638,6 +638,8 @@
65 mutex_enter(&(dict_sys->mutex));193 mutex_enter(&(dict_sys->mutex));
66 194
@@ -79,15 +207,15 @@
79 mutex_exit(&(dict_sys->mutex));207 mutex_exit(&(dict_sys->mutex));
80 208
81 if (table != NULL) {209 if (table != NULL) {
82@@ -786,6 +790,8 @@210@@ -787,6 +791,8 @@
83
84 table->n_mysql_handles_opened++;211 table->n_mysql_handles_opened++;
85 }212 }
213
214+ dict_table_LRU_trim(table);
86+215+
87+ dict_table_LRU_trim(table);
88
89 mutex_exit(&(dict_sys->mutex));216 mutex_exit(&(dict_sys->mutex));
90 217
218 if (table != NULL) {
91@@ -1267,20 +1273,64 @@219@@ -1267,20 +1273,64 @@
92 too much space. Currently not used! */220 too much space. Currently not used! */
93 221
@@ -100,24 +228,18 @@
100 {228 {
101 dict_table_t* table;229 dict_table_t* table;
102 dict_table_t* prev_table;230 dict_table_t* prev_table;
103-
104- ut_error;
105-
106-#ifdef UNIV_SYNC_DEBUG
107- ut_ad(mutex_own(&(dict_sys->mutex)));
108-#endif /* UNIV_SYNC_DEBUG */
109-
110+ dict_foreign_t* foreign;231+ dict_foreign_t* foreign;
111+ ulint n_removed;232+ ulint n_removed;
112+ ulint n_have_parent;233+ ulint n_have_parent;
113+ ulint cached_foreign_tables;234+ ulint cached_foreign_tables;
114+235
236- ut_error;
115+ //ut_error;237+ //ut_error;
116+238
117+#ifdef UNIV_SYNC_DEBUG239 #ifdef UNIV_SYNC_DEBUG
118+ ut_ad(mutex_own(&(dict_sys->mutex)));240 ut_ad(mutex_own(&(dict_sys->mutex)));
119+#endif /* UNIV_SYNC_DEBUG */241 #endif /* UNIV_SYNC_DEBUG */
120+242
121+retry:243+retry:
122+ n_removed = n_have_parent = 0;244+ n_removed = n_have_parent = 0;
123 table = UT_LIST_GET_LAST(dict_sys->table_LRU);245 table = UT_LIST_GET_LAST(dict_sys->table_LRU);
@@ -170,9 +292,20 @@
170 }292 }
171 293
172 /**************************************************************************294 /**************************************************************************
173diff -r 6eeee157fd40 innobase/ibuf/ibuf0ibuf.c295@@ -1565,6 +1616,10 @@
174--- a/innobase/ibuf/ibuf0ibuf.c Fri Jul 03 15:41:34 2009 -0700296 #ifdef UNIV_SYNC_DEBUG
175+++ b/innobase/ibuf/ibuf0ibuf.c Fri Jul 03 15:41:41 2009 -0700297 ut_ad(mutex_own(&(dict_sys->mutex)));
298 #endif /* UNIV_SYNC_DEBUG */
299+ /* remove all entry of the index from adaptive hash index,
300+ because removing from adaptive hash index needs dict_index */
301+ if (srv_use_adaptive_hash_indexes && srv_dict_size_limit)
302+ btr_search_drop_page_hash_index_on_index(index);
303
304 /* We always create search info whether or not adaptive
305 hash index is enabled or not. */
306diff -ruN a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
307--- a/innobase/ibuf/ibuf0ibuf.c 2009-08-27 18:42:17.000000000 +0900
308+++ b/innobase/ibuf/ibuf0ibuf.c 2009-08-27 18:42:59.000000000 +0900
176@@ -535,6 +535,7 @@309@@ -535,6 +535,7 @@
177 sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space);310 sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space);
178 /* use old-style record format for the insert buffer */311 /* use old-style record format for the insert buffer */
@@ -181,9 +314,26 @@
181 314
182 dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0);315 dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0);
183 dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0);316 dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0);
184diff -r 6eeee157fd40 innobase/include/dict0dict.h317diff -ruN a/innobase/include/btr0sea.h b/innobase/include/btr0sea.h
185--- a/innobase/include/dict0dict.h Fri Jul 03 15:41:34 2009 -0700318--- a/innobase/include/btr0sea.h 2009-07-07 21:54:00.000000000 +0900
186+++ b/innobase/include/dict0dict.h Fri Jul 03 15:41:41 2009 -0700319+++ b/innobase/include/btr0sea.h 2009-08-27 18:43:11.000000000 +0900
320@@ -97,6 +97,13 @@
321 /*============================*/
322 page_t* page); /* in: index page, s- or x-latched */
323 /************************************************************************
324+Drops a page hash index based on index */
325+
326+void
327+btr_search_drop_page_hash_index_on_index(
328+/*=====================================*/
329+ dict_index_t* index); /* in: record descriptor */
330+/************************************************************************
331 Drops a page hash index when a page is freed from a fseg to the file system.
332 Drops possible hash index if the page happens to be in the buffer pool. */
333
334diff -ruN a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
335--- a/innobase/include/dict0dict.h 2009-07-07 21:54:01.000000000 +0900
336+++ b/innobase/include/dict0dict.h 2009-08-27 18:42:59.000000000 +0900
187@@ -938,6 +938,11 @@337@@ -938,6 +938,11 @@
188 const char* ptr, /* in: scan from */338 const char* ptr, /* in: scan from */
189 const char* string);/* in: look for this */339 const char* string);/* in: look for this */
@@ -196,9 +346,9 @@
196 /* Buffers for storing detailed information about the latest foreign key346 /* Buffers for storing detailed information about the latest foreign key
197 and unique key errors */347 and unique key errors */
198 extern FILE* dict_foreign_err_file;348 extern FILE* dict_foreign_err_file;
199diff -r 6eeee157fd40 innobase/include/dict0dict.ic349diff -ruN a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic
200--- a/innobase/include/dict0dict.ic Fri Jul 03 15:41:34 2009 -0700350--- a/innobase/include/dict0dict.ic 2009-07-07 21:54:01.000000000 +0900
201+++ b/innobase/include/dict0dict.ic Fri Jul 03 15:41:41 2009 -0700351+++ b/innobase/include/dict0dict.ic 2009-08-27 18:42:59.000000000 +0900
202@@ -533,6 +533,13 @@352@@ -533,6 +533,13 @@
203 353
204 HASH_SEARCH(name_hash, dict_sys->table_hash, table_fold, table,354 HASH_SEARCH(name_hash, dict_sys->table_hash, table_fold, table,
@@ -224,18 +374,18 @@
224 /* lock_push(trx, table, LOCK_DICT_MEM_FIX) */374 /* lock_push(trx, table, LOCK_DICT_MEM_FIX) */
225 }375 }
226 376
227diff -r 6eeee157fd40 innobase/include/srv0srv.h377diff -ruN a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
228--- a/innobase/include/srv0srv.h Fri Jul 03 15:41:34 2009 -0700378--- a/innobase/include/srv0srv.h 2009-08-27 18:42:17.000000000 +0900
229+++ b/innobase/include/srv0srv.h Fri Jul 03 15:41:41 2009 -0700379+++ b/innobase/include/srv0srv.h 2009-08-27 18:42:59.000000000 +0900
230@@ -146,6 +146,8 @@380@@ -147,6 +147,8 @@
231 extern ulint srv_enable_unsafe_group_commit;
232 extern uint srv_read_ahead;381 extern uint srv_read_ahead;
233 extern uint srv_adaptive_checkpoint;382 extern uint srv_adaptive_checkpoint;
234+383
235+extern ulint srv_dict_size_limit;384+extern ulint srv_dict_size_limit;
236 385+
237 extern volatile ibool srv_io_pattern;386 extern volatile ibool srv_io_pattern;
238 extern ulong srv_io_pattern_trace;387 extern ulong srv_io_pattern_trace;
388 extern ulong srv_io_pattern_trace_running;
239@@ -552,6 +554,7 @@389@@ -552,6 +554,7 @@
240 ulint innodb_data_writes;390 ulint innodb_data_writes;
241 ulint innodb_data_written;391 ulint innodb_data_written;
@@ -244,18 +394,18 @@
244 ulint innodb_buffer_pool_pages_total;394 ulint innodb_buffer_pool_pages_total;
245 ulint innodb_buffer_pool_pages_data;395 ulint innodb_buffer_pool_pages_data;
246 ulint innodb_buffer_pool_pages_dirty;396 ulint innodb_buffer_pool_pages_dirty;
247diff -r 6eeee157fd40 innobase/srv/srv0srv.c397diff -ruN a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
248--- a/innobase/srv/srv0srv.c Fri Jul 03 15:41:34 2009 -0700398--- a/innobase/srv/srv0srv.c 2009-08-27 18:42:17.000000000 +0900
249+++ b/innobase/srv/srv0srv.c Fri Jul 03 15:41:41 2009 -0700399+++ b/innobase/srv/srv0srv.c 2009-08-27 18:42:59.000000000 +0900
250@@ -352,6 +352,8 @@400@@ -353,6 +353,8 @@
251
252 uint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */401 uint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
253 uint srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimate */402 uint srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimate */
254+403
255+ulint srv_dict_size_limit = 0;404+ulint srv_dict_size_limit = 0;
256 405+
257 volatile ibool srv_io_pattern = FALSE;406 volatile ibool srv_io_pattern = FALSE;
258 ulint srv_io_pattern_trace = 0;407 ulint srv_io_pattern_trace = 0;
408 ulint srv_io_pattern_trace_running = 0;
259@@ -1953,6 +1955,7 @@409@@ -1953,6 +1955,7 @@
260 export_vars.innodb_data_reads= os_n_file_reads;410 export_vars.innodb_data_reads= os_n_file_reads;
261 export_vars.innodb_data_writes= os_n_file_writes;411 export_vars.innodb_data_writes= os_n_file_writes;
@@ -264,9 +414,9 @@
264 export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets;414 export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets;
265 export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests;415 export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests;
266 export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free;416 export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free;
267diff -r 6eeee157fd40 mysql-test/r/innodb_dict_size_limit.result417diff -ruN a/mysql-test/r/innodb_dict_size_limit.result b/mysql-test/r/innodb_dict_size_limit.result
268--- /dev/null Thu Jan 01 00:00:00 1970 +0000418--- /dev/null 1970-01-01 09:00:00.000000000 +0900
269+++ b/mysql-test/r/innodb_dict_size_limit.result Fri Jul 03 15:41:41 2009 -0700419+++ b/mysql-test/r/innodb_dict_size_limit.result 2009-08-27 18:42:59.000000000 +0900
270@@ -0,0 +1,60 @@420@@ -0,0 +1,60 @@
271+DROP TABLE IF EXISTS `test_5`;421+DROP TABLE IF EXISTS `test_5`;
272+DROP TABLE IF EXISTS `test_4`;422+DROP TABLE IF EXISTS `test_4`;
@@ -328,9 +478,9 @@
328+DROP TABLE `test_3`;478+DROP TABLE `test_3`;
329+DROP TABLE `test_2`;479+DROP TABLE `test_2`;
330+DROP TABLE `test_1`;480+DROP TABLE `test_1`;
331diff -r 6eeee157fd40 mysql-test/t/innodb_dict_size_limit.test481diff -ruN a/mysql-test/t/innodb_dict_size_limit.test b/mysql-test/t/innodb_dict_size_limit.test
332--- /dev/null Thu Jan 01 00:00:00 1970 +0000482--- /dev/null 1970-01-01 09:00:00.000000000 +0900
333+++ b/mysql-test/t/innodb_dict_size_limit.test Fri Jul 03 15:41:41 2009 -0700483+++ b/mysql-test/t/innodb_dict_size_limit.test 2009-08-27 18:42:59.000000000 +0900
334@@ -0,0 +1,63 @@484@@ -0,0 +1,63 @@
335+#485+#
336+# Test for new variable innodb_dict_size_limit;486+# Test for new variable innodb_dict_size_limit;
@@ -395,9 +545,9 @@
395+DROP TABLE `test_2`;545+DROP TABLE `test_2`;
396+DROP TABLE `test_1`;546+DROP TABLE `test_1`;
397+547+
398diff -r 6eeee157fd40 patch_info/innodb_dict_size_limit.info548diff -ruN a/patch_info/innodb_dict_size_limit.info b/patch_info/innodb_dict_size_limit.info
399--- /dev/null Thu Jan 01 00:00:00 1970 +0000549--- /dev/null 1970-01-01 09:00:00.000000000 +0900
400+++ b/patch_info/innodb_dict_size_limit.info Fri Jul 03 15:41:41 2009 -0700550+++ b/patch_info/innodb_dict_size_limit.info 2009-08-27 18:42:59.000000000 +0900
401@@ -0,0 +1,9 @@551@@ -0,0 +1,9 @@
402+File=innodb_dict_size_limit.patch552+File=innodb_dict_size_limit.patch
403+Name=Limit dictionary cache size553+Name=Limit dictionary cache size
@@ -408,9 +558,9 @@
408+ChangeLog=558+ChangeLog=
409+2009-01-26559+2009-01-26
410+YK: Initial release560+YK: Initial release
411diff -r 6eeee157fd40 sql/ha_innodb.cc561diff -ruN a/sql/ha_innodb.cc b/sql/ha_innodb.cc
412--- a/sql/ha_innodb.cc Fri Jul 03 15:41:34 2009 -0700562--- a/sql/ha_innodb.cc 2009-08-27 18:42:17.000000000 +0900
413+++ b/sql/ha_innodb.cc Fri Jul 03 15:41:41 2009 -0700563+++ b/sql/ha_innodb.cc 2009-08-27 18:42:59.000000000 +0900
414@@ -288,6 +288,8 @@564@@ -288,6 +288,8 @@
415 (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},565 (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
416 {"dblwr_writes",566 {"dblwr_writes",
@@ -420,9 +570,9 @@
420 {"log_waits",570 {"log_waits",
421 (char*) &export_vars.innodb_log_waits, SHOW_LONG},571 (char*) &export_vars.innodb_log_waits, SHOW_LONG},
422 {"log_write_requests",572 {"log_write_requests",
423diff -r 6eeee157fd40 sql/ha_innodb.h573diff -ruN a/sql/ha_innodb.h b/sql/ha_innodb.h
424--- a/sql/ha_innodb.h Fri Jul 03 15:41:34 2009 -0700574--- a/sql/ha_innodb.h 2009-08-27 18:42:17.000000000 +0900
425+++ b/sql/ha_innodb.h Fri Jul 03 15:41:41 2009 -0700575+++ b/sql/ha_innodb.h 2009-08-27 18:42:59.000000000 +0900
426@@ -243,6 +243,7 @@576@@ -243,6 +243,7 @@
427 extern ulong srv_enable_unsafe_group_commit;577 extern ulong srv_enable_unsafe_group_commit;
428 extern uint srv_read_ahead;578 extern uint srv_read_ahead;
@@ -431,9 +581,9 @@
431 extern ulong srv_show_locks_held;581 extern ulong srv_show_locks_held;
432 extern ulong srv_show_verbose_locks;582 extern ulong srv_show_verbose_locks;
433 extern ulong srv_io_pattern_trace;583 extern ulong srv_io_pattern_trace;
434diff -r 6eeee157fd40 sql/mysqld.cc584diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
435--- a/sql/mysqld.cc Fri Jul 03 15:41:34 2009 -0700585--- a/sql/mysqld.cc 2009-08-27 18:42:17.000000000 +0900
436+++ b/sql/mysqld.cc Fri Jul 03 15:41:41 2009 -0700586+++ b/sql/mysqld.cc 2009-08-27 18:42:59.000000000 +0900
437@@ -5101,6 +5101,7 @@587@@ -5101,6 +5101,7 @@
438 OPT_INNODB_ADAPTIVE_CHECKPOINT,588 OPT_INNODB_ADAPTIVE_CHECKPOINT,
439 OPT_INNODB_READ_IO_THREADS,589 OPT_INNODB_READ_IO_THREADS,
@@ -453,9 +603,9 @@
453 {"innodb_io_pattern_trace", OPT_INNODB_IO_PATTERN_TRACE,603 {"innodb_io_pattern_trace", OPT_INNODB_IO_PATTERN_TRACE,
454 "Create/Drop the internal hash table for IO pattern tracing.",604 "Create/Drop the internal hash table for IO pattern tracing.",
455 (gptr*) &srv_io_pattern_trace, (gptr*) &srv_io_pattern_trace,605 (gptr*) &srv_io_pattern_trace, (gptr*) &srv_io_pattern_trace,
456diff -r 6eeee157fd40 sql/set_var.cc606diff -ruN a/sql/set_var.cc b/sql/set_var.cc
457--- a/sql/set_var.cc Fri Jul 03 15:41:34 2009 -0700607--- a/sql/set_var.cc 2009-08-27 18:42:17.000000000 +0900
458+++ b/sql/set_var.cc Fri Jul 03 15:41:41 2009 -0700608+++ b/sql/set_var.cc 2009-08-27 18:42:59.000000000 +0900
459@@ -540,6 +540,8 @@609@@ -540,6 +540,8 @@
460 sys_var_enum sys_innodb_adaptive_checkpoint("innodb_adaptive_checkpoint",610 sys_var_enum sys_innodb_adaptive_checkpoint("innodb_adaptive_checkpoint",
461 &srv_adaptive_checkpoint,611 &srv_adaptive_checkpoint,
462612
=== modified file 'innodb_split_buf_pool_mutex.patch'
--- innodb_split_buf_pool_mutex.patch 2009-07-03 22:42:33 +0000
+++ innodb_split_buf_pool_mutex.patch 2009-08-28 02:14:10 +0000
@@ -1,6 +1,27 @@
1diff -r 7ac364cc9b41 innobase/buf/buf0buf.c1diff -ruN a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
2--- a/innobase/buf/buf0buf.c Fri Jul 03 15:41:50 2009 -07002--- a/innobase/btr/btr0sea.c 2009-08-28 11:08:16.000000000 +0900
3+++ b/innobase/buf/buf0buf.c Fri Jul 03 15:41:57 2009 -07003+++ b/innobase/btr/btr0sea.c 2009-08-28 11:06:20.000000000 +0900
4@@ -1101,7 +1101,7 @@
5 ulint* offsets;
6
7 rw_lock_x_lock(&btr_search_latch);
8- mutex_enter(&buf_pool->mutex);
9+ mutex_enter(&buf_pool->LRU_mutex);
10
11 table = btr_search_sys->hash_index;
12
13@@ -1186,7 +1186,7 @@
14 block = UT_LIST_GET_PREV(LRU, block);
15 }
16
17- mutex_exit(&buf_pool->mutex);
18+ mutex_exit(&buf_pool->LRU_mutex);
19 rw_lock_x_unlock(&btr_search_latch);
20
21 if (UNIV_LIKELY_NULL(heap)) {
22diff -ruN a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
23--- a/innobase/buf/buf0buf.c 2009-08-28 11:08:16.000000000 +0900
24+++ b/innobase/buf/buf0buf.c 2009-08-28 11:06:30.000000000 +0900
4@@ -549,6 +549,17 @@25@@ -549,6 +549,17 @@
5 mutex_create(&(buf_pool->mutex));26 mutex_create(&(buf_pool->mutex));
6 mutex_set_level(&(buf_pool->mutex), SYNC_BUF_POOL);27 mutex_set_level(&(buf_pool->mutex), SYNC_BUF_POOL);
@@ -377,7 +398,7 @@
377 #ifdef UNIV_DEBUG398 #ifdef UNIV_DEBUG
378 if (buf_debug_prints) {399 if (buf_debug_prints) {
379 fputs("Has read ", stderr);400 fputs("Has read ", stderr);
380@@ -2103,10 +2136,23 @@401@@ -2103,11 +2136,24 @@
381 } else {402 } else {
382 ut_ad(io_type == BUF_IO_WRITE);403 ut_ad(io_type == BUF_IO_WRITE);
383 404
@@ -394,13 +415,14 @@
394 routine in the flush system */415 routine in the flush system */
395 416
396 buf_flush_write_complete(block);417 buf_flush_write_complete(block);
397+418
398+ if (flush_type == BUF_FLUSH_LRU) {419+ if (flush_type == BUF_FLUSH_LRU) {
399+ mutex_exit(&(buf_pool->LRU_mutex));420+ mutex_exit(&(buf_pool->LRU_mutex));
400+ }421+ }
401 422+
402 rw_lock_s_unlock_gen(&(block->lock), BUF_IO_WRITE);423 rw_lock_s_unlock_gen(&(block->lock), BUF_IO_WRITE);
403 /* io_counter here */424 /* io_counter here */
425 if (srv_io_pattern && srv_io_pattern_trace_running) {
404@@ -2132,6 +2178,9 @@426@@ -2132,6 +2178,9 @@
405 427
406 buf_pool->n_pages_written++;428 buf_pool->n_pages_written++;
@@ -587,9 +609,9 @@
587 609
588 return(len);610 return(len);
589 }611 }
590diff -r 7ac364cc9b41 innobase/buf/buf0flu.c612diff -ruN a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
591--- a/innobase/buf/buf0flu.c Fri Jul 03 15:41:50 2009 -0700613--- a/innobase/buf/buf0flu.c 2009-08-28 11:08:17.000000000 +0900
592+++ b/innobase/buf/buf0flu.c Fri Jul 03 15:41:57 2009 -0700614+++ b/innobase/buf/buf0flu.c 2009-08-28 11:06:30.000000000 +0900
593@@ -49,7 +49,9 @@615@@ -49,7 +49,9 @@
594 buf_block_t* block) /* in: block which is modified */616 buf_block_t* block) /* in: block which is modified */
595 {617 {
@@ -612,7 +634,7 @@
612 #endif /* UNIV_SYNC_DEBUG */634 #endif /* UNIV_SYNC_DEBUG */
613 635
614 prev_b = NULL;636 prev_b = NULL;
615@@ -113,16 +117,18 @@637@@ -130,16 +134,18 @@
616 BUF_BLOCK_FILE_PAGE and in the LRU list */638 BUF_BLOCK_FILE_PAGE and in the LRU list */
617 {639 {
618 #ifdef UNIV_SYNC_DEBUG640 #ifdef UNIV_SYNC_DEBUG
@@ -634,7 +656,7 @@
634 return(FALSE);656 return(FALSE);
635 }657 }
636 658
637@@ -148,12 +154,13 @@659@@ -165,12 +171,13 @@
638 ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */660 ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
639 {661 {
640 #ifdef UNIV_SYNC_DEBUG662 #ifdef UNIV_SYNC_DEBUG
@@ -651,7 +673,7 @@
651 && (block->io_fix == 0)) {673 && (block->io_fix == 0)) {
652 if (flush_type != BUF_FLUSH_LRU) {674 if (flush_type != BUF_FLUSH_LRU) {
653 675
654@@ -182,15 +189,17 @@676@@ -199,15 +206,17 @@
655 {677 {
656 ut_ad(block);678 ut_ad(block);
657 #ifdef UNIV_SYNC_DEBUG679 #ifdef UNIV_SYNC_DEBUG
@@ -670,7 +692,7 @@
670 692
671 (buf_pool->n_flush[block->flush_type])--;693 (buf_pool->n_flush[block->flush_type])--;
672 694
673@@ -536,18 +545,20 @@695@@ -553,18 +562,20 @@
674 ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST696 ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
675 || flush_type == BUF_FLUSH_SINGLE_PAGE);697 || flush_type == BUF_FLUSH_SINGLE_PAGE);
676 698
@@ -693,7 +715,7 @@
693 715
694 if (flush_type == BUF_FLUSH_LIST716 if (flush_type == BUF_FLUSH_LIST
695 && buf_flush_ready_for_flush(block, flush_type)) {717 && buf_flush_ready_for_flush(block, flush_type)) {
696@@ -744,7 +755,7 @@718@@ -761,7 +772,7 @@
697 high = fil_space_get_size(space);719 high = fil_space_get_size(space);
698 }720 }
699 721
@@ -702,7 +724,7 @@
702 724
703 for (i = low; i < high; i++) {725 for (i = low; i < high; i++) {
704 726
705@@ -778,7 +789,7 @@727@@ -795,7 +806,7 @@
706 728
707 mutex_exit(&block->mutex);729 mutex_exit(&block->mutex);
708 730
@@ -711,7 +733,7 @@
711 733
712 /* Note: as we release the buf_pool mutex734 /* Note: as we release the buf_pool mutex
713 above, in buf_flush_try_page we cannot be sure735 above, in buf_flush_try_page we cannot be sure
714@@ -789,14 +800,14 @@736@@ -806,14 +817,14 @@
715 count += buf_flush_try_page(space, i,737 count += buf_flush_try_page(space, i,
716 flush_type);738 flush_type);
717 739
@@ -728,7 +750,7 @@
728 750
729 return(count);751 return(count);
730 }752 }
731@@ -831,6 +842,7 @@753@@ -848,6 +859,7 @@
732 ulint space;754 ulint space;
733 ulint offset;755 ulint offset;
734 ibool found;756 ibool found;
@@ -736,7 +758,7 @@
736 758
737 ut_ad((flush_type == BUF_FLUSH_LRU)759 ut_ad((flush_type == BUF_FLUSH_LRU)
738 || (flush_type == BUF_FLUSH_LIST)); 760 || (flush_type == BUF_FLUSH_LIST));
739@@ -849,6 +861,12 @@761@@ -866,6 +878,12 @@
740 }762 }
741 763
742 (buf_pool->init_flush)[flush_type] = TRUE;764 (buf_pool->init_flush)[flush_type] = TRUE;
@@ -749,7 +771,7 @@
749 771
750 for (;;) {772 for (;;) {
751 /* If we have flushed enough, leave the loop */773 /* If we have flushed enough, leave the loop */
752@@ -865,7 +883,10 @@774@@ -882,7 +900,10 @@
753 } else {775 } else {
754 ut_ad(flush_type == BUF_FLUSH_LIST);776 ut_ad(flush_type == BUF_FLUSH_LIST);
755 777
@@ -760,7 +782,7 @@
760 if (!block782 if (!block
761 || (ut_dulint_cmp(block->oldest_modification,783 || (ut_dulint_cmp(block->oldest_modification,
762 lsn_limit) >= 0)) {784 lsn_limit) >= 0)) {
763@@ -895,7 +916,9 @@785@@ -912,7 +933,9 @@
764 offset = block->offset;786 offset = block->offset;
765 787
766 mutex_exit(&block->mutex);788 mutex_exit(&block->mutex);
@@ -771,7 +793,7 @@
771 793
772 old_page_count = page_count;794 old_page_count = page_count;
773 795
774@@ -915,7 +938,9 @@796@@ -932,7 +955,9 @@
775 flush_type, offset,797 flush_type, offset,
776 page_count - old_page_count); */798 page_count - old_page_count); */
777 799
@@ -782,7 +804,7 @@
782 804
783 } else if (flush_type == BUF_FLUSH_LRU) {805 } else if (flush_type == BUF_FLUSH_LRU) {
784 806
785@@ -927,16 +952,25 @@807@@ -944,17 +969,26 @@
786 808
787 mutex_exit(&block->mutex);809 mutex_exit(&block->mutex);
788 810
@@ -800,16 +822,17 @@
800 break;822 break;
801 }823 }
802 }824 }
803+825
804+ if (flush_type == BUF_FLUSH_LRU) {826+ if (flush_type == BUF_FLUSH_LRU) {
805+ mutex_exit(&(buf_pool->LRU_mutex));827+ mutex_exit(&(buf_pool->LRU_mutex));
806+ }828+ }
807+829+
808+ mutex_enter(&(buf_pool->mutex));830+ mutex_enter(&(buf_pool->mutex));
809 831+
810 (buf_pool->init_flush)[flush_type] = FALSE;832 (buf_pool->init_flush)[flush_type] = FALSE;
811 833
812@@ -997,7 +1031,7 @@834 if ((buf_pool->n_flush[flush_type] == 0)
835@@ -1014,7 +1048,7 @@
813 ulint n_replaceable;836 ulint n_replaceable;
814 ulint distance = 0;837 ulint distance = 0;
815 838
@@ -818,20 +841,20 @@
818 841
819 n_replaceable = UT_LIST_GET_LEN(buf_pool->free);842 n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
820 843
821@@ -1007,6 +1041,12 @@844@@ -1025,6 +1059,12 @@
822 && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
823 + BUF_FLUSH_EXTRA_MARGIN)845 + BUF_FLUSH_EXTRA_MARGIN)
824 && (distance < BUF_LRU_FREE_SEARCH_LEN)) {846 && (distance < BUF_LRU_FREE_SEARCH_LEN)) {
825+847
826+ if (!block->in_LRU_list) {848+ if (!block->in_LRU_list) {
827+ /* reatart. but it is very optimistic */849+ /* reatart. but it is very optimistic */
828+ block = UT_LIST_GET_LAST(buf_pool->LRU);850+ block = UT_LIST_GET_LAST(buf_pool->LRU);
829+ continue;851+ continue;
830+ }852+ }
831 853+
832 mutex_enter(&block->mutex);854 mutex_enter(&block->mutex);
833 855
834@@ -1021,7 +1061,7 @@856 if (buf_flush_ready_for_replace(block)) {
857@@ -1038,7 +1078,7 @@
835 block = UT_LIST_GET_PREV(LRU, block);858 block = UT_LIST_GET_PREV(LRU, block);
836 }859 }
837 860
@@ -840,7 +863,7 @@
840 863
841 if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {864 if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {
842 865
843@@ -1040,8 +1080,9 @@866@@ -1057,8 +1097,9 @@
844 immediately, without waiting. */ 867 immediately, without waiting. */
845 868
846 void869 void
@@ -851,7 +874,7 @@
851 {874 {
852 ulint n_to_flush;875 ulint n_to_flush;
853 ulint n_flushed;876 ulint n_flushed;
854@@ -1051,7 +1092,7 @@877@@ -1068,7 +1109,7 @@
855 if (n_to_flush > 0) {878 if (n_to_flush > 0) {
856 n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,879 n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
857 ut_dulint_zero);880 ut_dulint_zero);
@@ -860,7 +883,7 @@
860 /* There was an LRU type flush batch already running;883 /* There was an LRU type flush batch already running;
861 let us wait for it to end */884 let us wait for it to end */
862 885
863@@ -1101,11 +1142,11 @@886@@ -1118,11 +1159,11 @@
864 {887 {
865 ibool ret;888 ibool ret;
866 889
@@ -874,9 +897,9 @@
874 897
875 return(ret);898 return(ret);
876 }899 }
877diff -r 7ac364cc9b41 innobase/buf/buf0lru.c900diff -ruN a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c
878--- a/innobase/buf/buf0lru.c Fri Jul 03 15:41:50 2009 -0700901--- a/innobase/buf/buf0lru.c 2009-07-07 21:53:57.000000000 +0900
879+++ b/innobase/buf/buf0lru.c Fri Jul 03 15:41:57 2009 -0700902+++ b/innobase/buf/buf0lru.c 2009-08-28 11:06:30.000000000 +0900
880@@ -108,7 +108,7 @@903@@ -108,7 +108,7 @@
881 904
882 page_arr = ut_malloc(sizeof(ulint)905 page_arr = ut_malloc(sizeof(ulint)
@@ -1242,10 +1265,10 @@
1242- mutex_exit(&(buf_pool->mutex));1265- mutex_exit(&(buf_pool->mutex));
1243+ mutex_exit(&(buf_pool->LRU_mutex));1266+ mutex_exit(&(buf_pool->LRU_mutex));
1244 }1267 }
1245diff -r 7ac364cc9b41 innobase/buf/buf0rea.c1268diff -ruN a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c
1246--- a/innobase/buf/buf0rea.c Fri Jul 03 15:41:50 2009 -07001269--- a/innobase/buf/buf0rea.c 2009-08-28 11:08:17.000000000 +0900
1247+++ b/innobase/buf/buf0rea.c Fri Jul 03 15:41:57 2009 -07001270+++ b/innobase/buf/buf0rea.c 2009-08-28 11:06:30.000000000 +0900
1248@@ -237,10 +237,12 @@1271@@ -277,10 +277,12 @@
1249 1272
1250 return(0);1273 return(0);
1251 } 1274 }
@@ -1258,7 +1281,7 @@
1258 for (i = low; i < high; i++) {1281 for (i = low; i < high; i++) {
1259 block = buf_page_hash_get(space, i);1282 block = buf_page_hash_get(space, i);
1260 1283
1261@@ -252,7 +254,7 @@1284@@ -292,7 +294,7 @@
1262 }1285 }
1263 }1286 }
1264 1287
@@ -1267,7 +1290,7 @@
1267 1290
1268 if (recent_blocks < BUF_READ_AHEAD_RANDOM_THRESHOLD) {1291 if (recent_blocks < BUF_READ_AHEAD_RANDOM_THRESHOLD) {
1269 /* Do nothing */1292 /* Do nothing */
1270@@ -348,7 +350,7 @@1293@@ -388,7 +390,7 @@
1271 }1294 }
1272 1295
1273 /* Flush pages from the end of the LRU list if necessary */1296 /* Flush pages from the end of the LRU list if necessary */
@@ -1276,7 +1299,7 @@
1276 1299
1277 return(count + count2);1300 return(count + count2);
1278 }1301 }
1279@@ -451,6 +453,7 @@1302@@ -491,6 +493,7 @@
1280 1303
1281 return(0);1304 return(0);
1282 } 1305 }
@@ -1284,7 +1307,7 @@
1284 1307
1285 /* Check that almost all pages in the area have been accessed; if1308 /* Check that almost all pages in the area have been accessed; if
1286 offset == low, the accesses must be in a descending order, otherwise,1309 offset == low, the accesses must be in a descending order, otherwise,
1287@@ -464,6 +467,7 @@1310@@ -504,6 +507,7 @@
1288 1311
1289 fail_count = 0;1312 fail_count = 0;
1290 1313
@@ -1292,7 +1315,7 @@
1292 for (i = low; i < high; i++) {1315 for (i = low; i < high; i++) {
1293 block = buf_page_hash_get(space, i);1316 block = buf_page_hash_get(space, i);
1294 1317
1295@@ -480,12 +484,11 @@1318@@ -520,23 +524,23 @@
1296 pred_block = block;1319 pred_block = block;
1297 }1320 }
1298 }1321 }
@@ -1301,12 +1324,12 @@
1301 if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -1324 if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -
1302 BUF_READ_AHEAD_LINEAR_THRESHOLD) {1325 BUF_READ_AHEAD_LINEAR_THRESHOLD) {
1303 /* Too many failures: return */1326 /* Too many failures: return */
1327
1328- mutex_exit(&(buf_pool->mutex));
1304-1329-
1305- mutex_exit(&(buf_pool->mutex));
1306
1307 return(0);1330 return(0);
1308 }1331 }
1309@@ -493,10 +496,11 @@1332
1310 /* If we got this far, we know that enough pages in the area have1333 /* If we got this far, we know that enough pages in the area have
1311 been accessed in the right order: linear read-ahead can be sensible */1334 been accessed in the right order: linear read-ahead can be sensible */
1312 1335
@@ -1319,7 +1342,7 @@
1319 1342
1320 return(0);1343 return(0);
1321 }1344 }
1322@@ -512,7 +516,7 @@1345@@ -552,7 +556,7 @@
1323 pred_offset = fil_page_get_prev(frame);1346 pred_offset = fil_page_get_prev(frame);
1324 succ_offset = fil_page_get_next(frame);1347 succ_offset = fil_page_get_next(frame);
1325 1348
@@ -1328,7 +1351,7 @@
1328 1351
1329 if ((offset == low) && (succ_offset == offset + 1)) {1352 if ((offset == low) && (succ_offset == offset + 1)) {
1330 1353
1331@@ -588,7 +592,7 @@1354@@ -628,7 +632,7 @@
1332 os_aio_simulated_wake_handler_threads();1355 os_aio_simulated_wake_handler_threads();
1333 1356
1334 /* Flush pages from the end of the LRU list if necessary */1357 /* Flush pages from the end of the LRU list if necessary */
@@ -1337,27 +1360,27 @@
1337 1360
1338 #ifdef UNIV_DEBUG1361 #ifdef UNIV_DEBUG
1339 if (buf_debug_prints && (count > 0)) {1362 if (buf_debug_prints && (count > 0)) {
1340@@ -656,7 +660,7 @@1363@@ -696,7 +700,7 @@
1341 os_aio_simulated_wake_handler_threads();1364 os_aio_simulated_wake_handler_threads();
1342 1365
1343 /* Flush pages from the end of the LRU list if necessary */1366 /* Flush pages from the end of the LRU list if necessary */
1344- buf_flush_free_margin();1367- buf_flush_free_margin();
1345+ buf_flush_free_margin(FALSE);1368+ buf_flush_free_margin(FALSE);
1346 1369
1347 #ifdef UNIV_DEBUG1370 #ifdef UNIV_DEBUG
1348 if (buf_debug_prints) {1371 if (buf_debug_prints) {
1349@@ -728,7 +732,7 @@1372@@ -768,7 +772,7 @@
1350 os_aio_simulated_wake_handler_threads();1373 os_aio_simulated_wake_handler_threads();
1351 1374
1352 /* Flush pages from the end of the LRU list if necessary */1375 /* Flush pages from the end of the LRU list if necessary */
1353- buf_flush_free_margin();1376- buf_flush_free_margin();
1354+ buf_flush_free_margin(FALSE);1377+ buf_flush_free_margin(FALSE);
1355 1378
1356 #ifdef UNIV_DEBUG1379 #ifdef UNIV_DEBUG
1357 if (buf_debug_prints) {1380 if (buf_debug_prints) {
1358diff -r 7ac364cc9b41 innobase/include/buf0buf.h1381diff -ruN a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
1359--- a/innobase/include/buf0buf.h Fri Jul 03 15:41:50 2009 -07001382--- a/innobase/include/buf0buf.h 2009-08-28 11:08:16.000000000 +0900
1360+++ b/innobase/include/buf0buf.h Fri Jul 03 15:41:57 2009 -07001383+++ b/innobase/include/buf0buf.h 2009-08-28 11:06:30.000000000 +0900
1361@@ -946,6 +946,7 @@1384@@ -946,6 +946,7 @@
1362 mem_heap_t* io_counter_heap;1385 mem_heap_t* io_counter_heap;
1363 ulint io_counters;1386 ulint io_counters;
@@ -1385,9 +1408,9 @@
1385 buf_block_t* LRU_old; /* pointer to the about 3/8 oldest1408 buf_block_t* LRU_old; /* pointer to the about 3/8 oldest
1386 blocks in the LRU list; NULL if LRU1409 blocks in the LRU list; NULL if LRU
1387 length less than BUF_LRU_OLD_MIN_LEN */1410 length less than BUF_LRU_OLD_MIN_LEN */
1388diff -r 7ac364cc9b41 innobase/include/buf0buf.ic1411diff -ruN a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
1389--- a/innobase/include/buf0buf.ic Fri Jul 03 15:41:50 2009 -07001412--- a/innobase/include/buf0buf.ic 2009-07-07 21:54:00.000000000 +0900
1390+++ b/innobase/include/buf0buf.ic Fri Jul 03 15:41:57 2009 -07001413+++ b/innobase/include/buf0buf.ic 2009-08-28 11:06:30.000000000 +0900
1391@@ -112,7 +112,8 @@1414@@ -112,7 +112,8 @@
1392 buf_block_t* block;1415 buf_block_t* block;
1393 dulint lsn;1416 dulint lsn;
@@ -1505,9 +1528,9 @@
1505 1528
1506 mutex_enter(&block->mutex);1529 mutex_enter(&block->mutex);
1507 1530
1508diff -r 7ac364cc9b41 innobase/include/buf0flu.h1531diff -ruN a/innobase/include/buf0flu.h b/innobase/include/buf0flu.h
1509--- a/innobase/include/buf0flu.h Fri Jul 03 15:41:50 2009 -07001532--- a/innobase/include/buf0flu.h 2009-07-07 21:54:00.000000000 +0900
1510+++ b/innobase/include/buf0flu.h Fri Jul 03 15:41:57 2009 -07001533+++ b/innobase/include/buf0flu.h 2009-08-28 11:06:30.000000000 +0900
1511@@ -26,8 +26,9 @@1534@@ -26,8 +26,9 @@
1512 a margin of replaceable pages there. */1535 a margin of replaceable pages there. */
1513 1536
@@ -1519,9 +1542,9 @@
1519 /************************************************************************1542 /************************************************************************
1520 Initializes a page for writing to the tablespace. */1543 Initializes a page for writing to the tablespace. */
1521 1544
1522diff -r 7ac364cc9b41 innobase/include/buf0flu.ic1545diff -ruN a/innobase/include/buf0flu.ic b/innobase/include/buf0flu.ic
1523--- a/innobase/include/buf0flu.ic Fri Jul 03 15:41:50 2009 -07001546--- a/innobase/include/buf0flu.ic 2009-07-07 21:54:00.000000000 +0900
1524+++ b/innobase/include/buf0flu.ic Fri Jul 03 15:41:57 2009 -07001547+++ b/innobase/include/buf0flu.ic 2009-08-28 11:06:30.000000000 +0900
1525@@ -38,11 +38,14 @@1548@@ -38,11 +38,14 @@
1526 mtr_t* mtr) /* in: mtr */1549 mtr_t* mtr) /* in: mtr */
1527 {1550 {
@@ -1538,7 +1561,7 @@
1538 #endif /* UNIV_SYNC_DEBUG */1561 #endif /* UNIV_SYNC_DEBUG */
1539 1562
1540 ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);1563 ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
1541@@ -52,15 +55,19 @@1564@@ -52,16 +55,20 @@
1542 block->newest_modification = mtr->end_lsn;1565 block->newest_modification = mtr->end_lsn;
1543 1566
1544 if (ut_dulint_is_zero(block->oldest_modification)) {1567 if (ut_dulint_is_zero(block->oldest_modification)) {
@@ -1553,11 +1576,12 @@
1553 ut_ad(ut_dulint_cmp(block->oldest_modification,1576 ut_ad(ut_dulint_cmp(block->oldest_modification,
1554 mtr->start_lsn) <= 0);1577 mtr->start_lsn) <= 0);
1555 }1578 }
1579
1580+ mutex_exit(&block->mutex);
1556+1581+
1557+ mutex_exit(&block->mutex);
1558
1559 ++srv_buf_pool_write_requests;1582 ++srv_buf_pool_write_requests;
1560 }1583 }
1584
1561@@ -78,29 +85,32 @@1585@@ -78,29 +85,32 @@
1562 set of mtr's */1586 set of mtr's */
1563 {1587 {
@@ -1594,9 +1618,9 @@
1594- mutex_exit(&(buf_pool->mutex));1618- mutex_exit(&(buf_pool->mutex));
1595+ mutex_exit(&(block->mutex));1619+ mutex_exit(&(block->mutex));
1596 }1620 }
1597diff -r 7ac364cc9b41 innobase/include/sync0sync.h1621diff -ruN a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
1598--- a/innobase/include/sync0sync.h Fri Jul 03 15:41:50 2009 -07001622--- a/innobase/include/sync0sync.h 2009-07-07 21:54:06.000000000 +0900
1599+++ b/innobase/include/sync0sync.h Fri Jul 03 15:41:57 2009 -07001623+++ b/innobase/include/sync0sync.h 2009-08-28 11:06:30.000000000 +0900
1600@@ -438,8 +438,12 @@1624@@ -438,8 +438,12 @@
1601 SYNC_SEARCH_SYS, as memory allocation1625 SYNC_SEARCH_SYS, as memory allocation
1602 can call routines there! Otherwise1626 can call routines there! Otherwise
@@ -1611,10 +1635,10 @@
1611 #define SYNC_DOUBLEWRITE 1401635 #define SYNC_DOUBLEWRITE 140
1612 #define SYNC_ANY_LATCH 1351636 #define SYNC_ANY_LATCH 135
1613 #define SYNC_THR_LOCAL 1331637 #define SYNC_THR_LOCAL 133
1614diff -r 7ac364cc9b41 innobase/log/log0recv.c1638diff -ruN a/innobase/log/log0recv.c b/innobase/log/log0recv.c
1615--- a/innobase/log/log0recv.c Fri Jul 03 15:41:50 2009 -07001639--- a/innobase/log/log0recv.c 2009-08-28 11:08:17.000000000 +0900
1616+++ b/innobase/log/log0recv.c Fri Jul 03 15:41:57 2009 -07001640+++ b/innobase/log/log0recv.c 2009-08-28 11:06:30.000000000 +0900
1617@@ -1693,11 +1693,11 @@1641@@ -1695,11 +1695,11 @@
1618 1642
1619 mtr_start(&mtr);1643 mtr_start(&mtr);
1620 1644
@@ -1628,9 +1652,9 @@
1628 1652
1629 replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,1653 replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
1630 RW_X_LATCH, &mtr);1654 RW_X_LATCH, &mtr);
1631diff -r 7ac364cc9b41 innobase/mtr/mtr0mtr.c1655diff -ruN a/innobase/mtr/mtr0mtr.c b/innobase/mtr/mtr0mtr.c
1632--- a/innobase/mtr/mtr0mtr.c Fri Jul 03 15:41:50 2009 -07001656--- a/innobase/mtr/mtr0mtr.c 2009-07-07 21:54:08.000000000 +0900
1633+++ b/innobase/mtr/mtr0mtr.c Fri Jul 03 15:41:57 2009 -07001657+++ b/innobase/mtr/mtr0mtr.c 2009-08-28 11:06:30.000000000 +0900
1634@@ -103,6 +103,38 @@1658@@ -103,6 +103,38 @@
1635 }1659 }
1636 }1660 }
@@ -1679,7 +1703,7 @@
1679 }1703 }
1680 1704
1681 /* We first update the modification info to buffer pages, and only1705 /* We first update the modification info to buffer pages, and only
1682@@ -187,11 +221,12 @@1706@@ -187,12 +221,13 @@
1683 required when we insert modified buffer pages in to the flush list1707 required when we insert modified buffer pages in to the flush list
1684 which must be sorted on oldest_modification. */1708 which must be sorted on oldest_modification. */
1685 1709
@@ -1688,12 +1712,13 @@
1688 if (mtr->modifications) {1712 if (mtr->modifications) {
1689 log_release();1713 log_release();
1690 }1714 }
1691+1715
1692+ /* All unlocking has been moved here, after log_sys mutex release. */1716+ /* All unlocking has been moved here, after log_sys mutex release. */
1693+ mtr_memo_pop_all(mtr);1717+ mtr_memo_pop_all(mtr);
1694 1718+
1695 #ifdef UNIV_DEBUG1719 #ifdef UNIV_DEBUG
1696 mtr->state = MTR_COMMITTED;1720 mtr->state = MTR_COMMITTED;
1721 #endif
1697@@ -262,6 +297,12 @@1722@@ -262,6 +297,12 @@
1698 slot = dyn_array_get_element(memo, offset);1723 slot = dyn_array_get_element(memo, offset);
1699 1724
@@ -1707,10 +1732,10 @@
1707 1732
1708 mtr_memo_slot_release(mtr, slot);1733 mtr_memo_slot_release(mtr, slot);
1709 1734
1710diff -r 7ac364cc9b41 innobase/srv/srv0srv.c1735diff -ruN a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
1711--- a/innobase/srv/srv0srv.c Fri Jul 03 15:41:50 2009 -07001736--- a/innobase/srv/srv0srv.c 2009-08-28 11:08:17.000000000 +0900
1712+++ b/innobase/srv/srv0srv.c Fri Jul 03 15:41:57 2009 -07001737+++ b/innobase/srv/srv0srv.c 2009-08-28 11:06:30.000000000 +0900
1713@@ -367,6 +367,7 @@1738@@ -370,6 +370,7 @@
1714 ulong srv_n_free_tickets_to_enter = 500;1739 ulong srv_n_free_tickets_to_enter = 500;
1715 ulong srv_thread_sleep_delay = 10000;1740 ulong srv_thread_sleep_delay = 10000;
1716 ulint srv_spin_wait_delay = 5;1741 ulint srv_spin_wait_delay = 5;
@@ -1718,7 +1743,7 @@
1718 ibool srv_priority_boost = TRUE;1743 ibool srv_priority_boost = TRUE;
1719 1744
1720 ibool srv_print_thread_releases = FALSE;1745 ibool srv_print_thread_releases = FALSE;
1721@@ -673,6 +674,47 @@1746@@ -676,6 +677,47 @@
1722 ulint srv_n_threads_active[SRV_MASTER + 1];1747 ulint srv_n_threads_active[SRV_MASTER + 1];
1723 ulint srv_n_threads[SRV_MASTER + 1];1748 ulint srv_n_threads[SRV_MASTER + 1];
1724 1749
@@ -1766,16 +1791,16 @@
1766 /*************************************************************************1791 /*************************************************************************
1767 Sets the info describing an i/o thread current state. */1792 Sets the info describing an i/o thread current state. */
1768 1793
1769@@ -905,6 +947,8 @@1794@@ -909,6 +951,8 @@
1770 srv_slot_t* slot;
1771 dict_table_t* table;1795 dict_table_t* table;
1772 ulint i;1796 ulint i;
1773+1797
1774+ srv_align_spins_microsec();1798+ srv_align_spins_microsec();
1775 1799+
1776 srv_sys = mem_alloc(sizeof(srv_sys_t));1800 srv_sys = mem_alloc(sizeof(srv_sys_t));
1777 1801
1778@@ -2661,7 +2705,7 @@1802 kernel_mutex_temp = mem_alloc(sizeof(mutex_t));
1803@@ -2665,7 +2709,7 @@
1779 ib_longlong level, bpl;1804 ib_longlong level, bpl;
1780 buf_block_t* bpage;1805 buf_block_t* bpage;
1781 1806
@@ -1784,7 +1809,7 @@
1784 1809
1785 level = 0;1810 level = 0;
1786 bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);1811 bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
1787@@ -2683,7 +2727,7 @@1812@@ -2687,7 +2731,7 @@
1788 bpl = 0;1813 bpl = 0;
1789 }1814 }
1790 1815
@@ -1793,9 +1818,9 @@
1793 1818
1794 if (!srv_use_doublewrite_buf) {1819 if (!srv_use_doublewrite_buf) {
1795 /* flush is faster than when doublewrite */1820 /* flush is faster than when doublewrite */
1796diff -r 7ac364cc9b41 innobase/sync/sync0sync.c1821diff -ruN a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
1797--- a/innobase/sync/sync0sync.c Fri Jul 03 15:41:50 2009 -07001822--- a/innobase/sync/sync0sync.c 2009-07-07 21:54:10.000000000 +0900
1798+++ b/innobase/sync/sync0sync.c Fri Jul 03 15:41:57 2009 -07001823+++ b/innobase/sync/sync0sync.c 2009-08-28 11:06:30.000000000 +0900
1799@@ -1105,11 +1105,19 @@1824@@ -1105,11 +1105,19 @@
1800 } else if (level == SYNC_DOUBLEWRITE) {1825 } else if (level == SYNC_DOUBLEWRITE) {
1801 ut_a(sync_thread_levels_g(array, SYNC_DOUBLEWRITE));1826 ut_a(sync_thread_levels_g(array, SYNC_DOUBLEWRITE));
@@ -1817,9 +1842,9 @@
1817 } else if (level == SYNC_SEARCH_SYS) {1842 } else if (level == SYNC_SEARCH_SYS) {
1818 ut_a(sync_thread_levels_g(array, SYNC_SEARCH_SYS));1843 ut_a(sync_thread_levels_g(array, SYNC_SEARCH_SYS));
1819 } else if (level == SYNC_TRX_LOCK_HEAP) {1844 } else if (level == SYNC_TRX_LOCK_HEAP) {
1820diff -r 7ac364cc9b41 innobase/ut/ut0ut.c1845diff -ruN a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
1821--- a/innobase/ut/ut0ut.c Fri Jul 03 15:41:50 2009 -07001846--- a/innobase/ut/ut0ut.c 2009-07-07 21:54:12.000000000 +0900
1822+++ b/innobase/ut/ut0ut.c Fri Jul 03 15:41:57 2009 -07001847+++ b/innobase/ut/ut0ut.c 2009-08-28 11:06:30.000000000 +0900
1823@@ -347,6 +347,7 @@1848@@ -347,6 +347,7 @@
1824 /*****************************************************************1849 /*****************************************************************
1825 Runs an idle loop on CPU. The argument gives the desired delay1850 Runs an idle loop on CPU. The argument gives the desired delay
@@ -1841,9 +1866,9 @@
1841 j += i;1866 j += i;
1842 }1867 }
1843 1868
1844diff -r 7ac364cc9b41 patch_info/innodb_split_buf_pool_mutex.info1869diff -ruN a/patch_info/innodb_split_buf_pool_mutex.info b/patch_info/innodb_split_buf_pool_mutex.info
1845--- /dev/null Thu Jan 01 00:00:00 1970 +00001870--- /dev/null 1970-01-01 09:00:00.000000000 +0900
1846+++ b/patch_info/innodb_split_buf_pool_mutex.info Fri Jul 03 15:41:57 2009 -07001871+++ b/patch_info/innodb_split_buf_pool_mutex.info 2009-08-28 11:06:30.000000000 +0900
1847@@ -0,0 +1,6 @@1872@@ -0,0 +1,6 @@
1848+File=innodb_split_buf_pool_mutex.patch1873+File=innodb_split_buf_pool_mutex.patch
1849+Name=InnoDB patch to fix buffer pool scalability1874+Name=InnoDB patch to fix buffer pool scalability
@@ -1851,10 +1876,10 @@
1851+Author=Yasufumi Kinoshita1876+Author=Yasufumi Kinoshita
1852+License=BSD1877+License=BSD
1853+Comment=Backport from XtraDB1878+Comment=Backport from XtraDB
1854diff -r 7ac364cc9b41 sql/ha_innodb.cc1879diff -ruN a/sql/ha_innodb.cc b/sql/ha_innodb.cc
1855--- a/sql/ha_innodb.cc Fri Jul 03 15:41:50 2009 -07001880--- a/sql/ha_innodb.cc 2009-08-28 11:08:17.000000000 +0900
1856+++ b/sql/ha_innodb.cc Fri Jul 03 15:41:57 2009 -07001881+++ b/sql/ha_innodb.cc 2009-08-28 11:06:30.000000000 +0900
1857@@ -1503,6 +1503,13 @@1882@@ -1507,6 +1507,13 @@
1858 /* We set srv_pool_size here in units of 1 kB. InnoDB internally1883 /* We set srv_pool_size here in units of 1 kB. InnoDB internally
1859 changes the value so that it becomes the number of database pages. */1884 changes the value so that it becomes the number of database pages. */
1860 1885

Subscribers

People subscribed via source and target branches

to all changes: