Merge lp:~percona-dev/percona-server/release-5.1.50-12-adjust_buffer_pool_shm_2 into lp:percona-server/release-5.1.50-12

Proposed by Yasufumi Kinoshita on 2010-10-01
Status: Merged
Approved by: Vadim Tkachenko on 2010-10-01
Approved revision: 125
Merged at revision: 126
Proposed branch: lp:~percona-dev/percona-server/release-5.1.50-12-adjust_buffer_pool_shm_2
Merge into: lp:percona-server/release-5.1.50-12
Diff against target: 178 lines (+32/-15)
1 file modified
innodb_buffer_pool_shm.patch (+32/-15)
To merge this branch: bzr merge lp:~percona-dev/percona-server/release-5.1.50-12-adjust_buffer_pool_shm_2
Reviewer Review Type Date Requested Status
Vadim Tkachenko 2010-10-01 Approve on 2010-10-01
Review via email: mp+37220@code.launchpad.net
To post a comment you must log in.
Vadim Tkachenko (vadim-tk) wrote :

no docs needed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innodb_buffer_pool_shm.patch'
2--- innodb_buffer_pool_shm.patch 2010-10-01 01:50:14 +0000
3+++ innodb_buffer_pool_shm.patch 2010-10-01 06:41:41 +0000
4@@ -96,7 +96,7 @@
5 /********************************************************************//**
6 Allocates a chunk of buffer frames.
7 @return chunk, or NULL on failure */
8-@@ -768,26 +835,184 @@
9+@@ -768,26 +835,188 @@
10 {
11 buf_block_t* block;
12 byte* frame;
13@@ -110,6 +110,8 @@
14 although it already should be. */
15 mem_size = ut_2pow_round(mem_size, UNIV_PAGE_SIZE);
16 +
17++ srv_buffer_pool_shm_is_reused = FALSE;
18++
19 + if (srv_buffer_pool_shm_key) {
20 + /* zip_hash size */
21 + zip_hash_n = (mem_size / UNIV_PAGE_SIZE) * 2;
22@@ -261,6 +263,8 @@
23 + } else {
24 + /* adjust offset is done later */
25 + hash_create_reuse(zip_hash_tmp);
26++
27++ srv_buffer_pool_shm_is_reused = TRUE;
28 + }
29 + } else {
30 chunk->mem = os_mem_alloc_large(&chunk->mem_size);
31@@ -281,7 +285,7 @@
32
33 /* Align a pointer to the first frame. Note that when
34 os_large_page_size is smaller than UNIV_PAGE_SIZE,
35-@@ -795,8 +1020,13 @@
36+@@ -795,8 +1024,13 @@
37 it is bigger, we may allocate more blocks than requested. */
38
39 frame = ut_align(chunk->mem, UNIV_PAGE_SIZE);
40@@ -295,7 +299,7 @@
41
42 /* Subtract the space needed for block descriptors. */
43 {
44-@@ -810,6 +1040,98 @@
45+@@ -810,6 +1044,98 @@
46 chunk->size = size;
47 }
48
49@@ -394,7 +398,7 @@
50 /* Init block structs and assign frames for them. Then we
51 assign the frames to the first blocks (we already mapped the
52 memory above). */
53-@@ -833,6 +1155,11 @@
54+@@ -833,6 +1159,11 @@
55 block++;
56 frame += UNIV_PAGE_SIZE;
57 }
58@@ -406,7 +410,7 @@
59
60 return(chunk);
61 }
62-@@ -1014,6 +1341,8 @@
63+@@ -1014,6 +1345,8 @@
64 UNIV_MEM_UNDESC(block);
65 }
66
67@@ -415,7 +419,7 @@
68 os_mem_free_large(chunk->mem, chunk->mem_size);
69 }
70
71-@@ -1063,7 +1392,10 @@
72+@@ -1063,7 +1396,10 @@
73 srv_buf_pool_curr_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
74
75 buf_pool->page_hash = hash_create(2 * buf_pool->curr_size);
76@@ -426,7 +430,7 @@
77
78 buf_pool->last_printout_time = time(NULL);
79
80-@@ -1078,6 +1410,86 @@
81+@@ -1078,6 +1414,86 @@
82 --------------------------- */
83 /* All fields are initialized by mem_zalloc(). */
84
85@@ -513,7 +517,7 @@
86 mutex_exit(&LRU_list_mutex);
87 rw_lock_x_unlock(&page_hash_latch);
88 buf_pool_mutex_exit();
89-@@ -1102,6 +1514,34 @@
90+@@ -1102,6 +1518,34 @@
91 buf_chunk_t* chunk;
92 buf_chunk_t* chunks;
93
94@@ -548,7 +552,7 @@
95 chunks = buf_pool->chunks;
96 chunk = chunks + buf_pool->n_chunks;
97
98-@@ -1110,10 +1550,13 @@
99+@@ -1110,10 +1554,13 @@
100 would fail at shutdown. */
101 os_mem_free_large(chunk->mem, chunk->mem_size);
102 }
103@@ -562,7 +566,7 @@
104 mem_free(buf_pool);
105 buf_pool = NULL;
106 }
107-@@ -1308,6 +1751,11 @@
108+@@ -1308,6 +1755,11 @@
109 //buf_pool_mutex_enter();
110 mutex_enter(&LRU_list_mutex);
111
112@@ -574,7 +578,7 @@
113 shrink_again:
114 if (buf_pool->n_chunks <= 1) {
115
116-@@ -1551,6 +1999,11 @@
117+@@ -1551,6 +2003,11 @@
118 buf_pool_resize(void)
119 /*=================*/
120 {
121@@ -852,11 +856,12 @@
122 diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
123 --- a/storage/innodb_plugin/include/srv0srv.h 2010-07-14 16:32:49.695323045 +0900
124 +++ b/storage/innodb_plugin/include/srv0srv.h 2010-07-14 16:40:16.171325784 +0900
125-@@ -156,6 +156,9 @@
126+@@ -156,6 +156,10 @@
127 extern ulint srv_mem_pool_size;
128 extern ulint srv_lock_table_size;
129
130 +extern uint srv_buffer_pool_shm_key;
131++extern ibool srv_buffer_pool_shm_is_reused;
132 +extern ibool srv_buffer_pool_shm_checksum;
133 +
134 extern ibool srv_thread_concurrency_timer_based;
135@@ -914,6 +919,17 @@
136 +
137 #endif
138
139+diff -ruN a/storage/innodb_plugin/log/log0recv.c b/storage/innodb_plugin/log/log0recv.c
140+--- a/storage/innodb_plugin/log/log0recv.c 2010-10-01 15:25:27.106299166 +0900
141++++ b/storage/innodb_plugin/log/log0recv.c 2010-10-01 15:26:33.689261436 +0900
142+@@ -2901,6 +2901,7 @@
143+ /*==========================*/
144+ {
145+ ut_a(!recv_needed_recovery);
146++ ut_a(!srv_buffer_pool_shm_is_reused);
147+
148+ recv_needed_recovery = TRUE;
149+
150 diff -ruN a/storage/innodb_plugin/os/os0proc.c b/storage/innodb_plugin/os/os0proc.c
151 --- a/storage/innodb_plugin/os/os0proc.c 2010-06-04 00:49:59.000000000 +0900
152 +++ b/storage/innodb_plugin/os/os0proc.c 2010-07-14 16:40:16.174322953 +0900
153@@ -1094,12 +1110,13 @@
154 diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
155 --- a/storage/innodb_plugin/srv/srv0srv.c 2010-07-14 16:33:23.848391648 +0900
156 +++ b/storage/innodb_plugin/srv/srv0srv.c 2010-07-14 16:40:16.177323553 +0900
157-@@ -211,6 +211,10 @@
158+@@ -211,6 +211,11 @@
159 UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX;
160 UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX;
161
162 +/* key value for shm */
163 +UNIV_INTERN uint srv_buffer_pool_shm_key = 0;
164++UNIV_INTERN ibool srv_buffer_pool_shm_is_reused = FALSE;
165 +UNIV_INTERN ibool srv_buffer_pool_shm_checksum = TRUE;
166 +
167 /* This parameter is deprecated. Use srv_n_io_[read|write]_threads
168@@ -1112,8 +1129,8 @@
169 Note that this is not as heavy weight as it seems. At
170 this point there will be only ONE page in the buf_LRU
171 and there must be no page in the buf_flush list. */
172-+ /* TODO: treat more correctly */
173-+ if (!srv_buffer_pool_shm_key)
174++ /* buffer_pool_shm should not be reused when recovery was needed. */
175++ if (!srv_buffer_pool_shm_is_reused)
176 buf_pool_invalidate();
177
178 /* We always try to do a recovery, even if the database had

Subscribers

People subscribed via source and target branches

to all changes: