Merge lp:~akopytov/percona-server/ahi-fixes-5.6 into lp:percona-server/5.6
- ahi-fixes-5.6
- Merge into 5.6
Status: | Merged |
---|---|
Approved by: | Laurynas Biveinis |
Approved revision: | no longer in the source branch. |
Merged at revision: | 421 |
Proposed branch: | lp:~akopytov/percona-server/ahi-fixes-5.6 |
Merge into: | lp:percona-server/5.6 |
Diff against target: |
1957 lines (+482/-381) 25 files modified
Percona-Server/mysql-test/r/percona_bug1218330.result (+14/-0) Percona-Server/mysql-test/t/percona_bug1218330-master.opt (+1/-0) Percona-Server/mysql-test/t/percona_bug1218330.test (+72/-0) Percona-Server/storage/innobase/btr/btr0cur.cc (+7/-7) Percona-Server/storage/innobase/btr/btr0sea.cc (+109/-132) Percona-Server/storage/innobase/buf/buf0buf.cc (+0/-2) Percona-Server/storage/innobase/dict/dict0boot.cc (+6/-0) Percona-Server/storage/innobase/dict/dict0dict.cc (+5/-3) Percona-Server/storage/innobase/dict/dict0load.cc (+1/-0) Percona-Server/storage/innobase/ha/ha0ha.cc (+2/-2) Percona-Server/storage/innobase/handler/ha_innodb.cc (+21/-19) Percona-Server/storage/innobase/handler/xtradb_i_s.cc (+35/-33) Percona-Server/storage/innobase/ibuf/ibuf0ibuf.cc (+2/-0) Percona-Server/storage/innobase/include/btr0sea.h (+35/-9) Percona-Server/storage/innobase/include/btr0sea.ic (+66/-11) Percona-Server/storage/innobase/include/btr0types.h (+7/-6) Percona-Server/storage/innobase/include/buf0buf.h (+0/-2) Percona-Server/storage/innobase/include/dict0mem.h (+4/-0) Percona-Server/storage/innobase/include/trx0trx.h (+7/-5) Percona-Server/storage/innobase/include/trx0trx.ic (+5/-12) Percona-Server/storage/innobase/row/row0ftsort.cc (+3/-0) Percona-Server/storage/innobase/row/row0sel.cc (+32/-91) Percona-Server/storage/innobase/srv/srv0srv.cc (+42/-44) Percona-Server/storage/innobase/sync/sync0sync.cc (+3/-3) Percona-Server/storage/innobase/trx/trx0trx.cc (+3/-0) |
To merge this branch: | bzr merge lp:~akopytov/percona-server/ahi-fixes-5.6 |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Approve | ||
Review via email: mp+183473@code.launchpad.net |
Commit message
Description of the change
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Alexey Kopytov (akopytov) wrote : | # |
Hi Laurynas,
On Wed, 04 Sep 2013 15:00:11 -0000, Laurynas Biveinis wrote:
> Review: Needs Fixing
>
> - Same comments as for the 5.5 MP.
> - Diff line 182--185: missing arg comment, and, uhm, why add more
> "=====" ?
Oh noes :)
> - Diff line 385--391 drops MONITOR_INC call.
>
This is a good catch, will fix.
Alexey Kopytov (akopytov) wrote : | # |
Hi Laurynas,
On Wed, 04 Sep 2013 15:00:11 -0000, Laurynas Biveinis wrote:
> Review: Needs Fixing
>
> - Same comments as for the 5.5 MP.
> - Diff line 182--185: missing arg comment, and, uhm, why add more
> "=====" ?
Actually, this is how the diff looks in my tree:
@@ -133,17 +130,17 @@
void
btr_search_
/*===
- index_id_t key)
+ dict_index_t* index)
I.e. it doesn't touch the comment part. But will fix anyway.
Alexey Kopytov (akopytov) wrote : | # |
Hi Laurynas,
On Wed, 04 Sep 2013 15:00:11 -0000, Laurynas Biveinis wrote:
> - Diff line 385--391 drops MONITOR_INC call.
>
Same here. It appears to be some bogus change. This is how rev. diff
looks in my tree:
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_
+ ut_ad(rw_
+ RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- ha_insert_
- block, rec);
+ ha_insert_
+ fold, block, rec);
}
}
I.e. there was simply no MONITOR_INC call. Not sure whom to blame here,
bzr or LP diff viewer.
Laurynas Biveinis (laurynas-biveinis) : | # |
Preview Diff
1 | === added file 'Percona-Server/mysql-test/r/percona_bug1218330.result' | |||
2 | --- Percona-Server/mysql-test/r/percona_bug1218330.result 1970-01-01 00:00:00 +0000 | |||
3 | +++ Percona-Server/mysql-test/r/percona_bug1218330.result 2013-09-02 14:08:46 +0000 | |||
4 | @@ -0,0 +1,14 @@ | |||
5 | 1 | CREATE TABLE t1 ( | ||
6 | 2 | a INT PRIMARY KEY, b INT, | ||
7 | 3 | c CHAR(200), | ||
8 | 4 | UNIQUE INDEX b(b)) ENGINE=InnoDB; | ||
9 | 5 | INSERT INTO t1 VALUES (1, 1, REPEAT("a", 200)); | ||
10 | 6 | should_be_1 | ||
11 | 7 | 1 | ||
12 | 8 | should_be_1 | ||
13 | 9 | 1 | ||
14 | 10 | should_be_1 | ||
15 | 11 | 1 | ||
16 | 12 | should_be_1 | ||
17 | 13 | 1 | ||
18 | 14 | DROP TABLE t1; | ||
19 | 0 | 15 | ||
20 | === added file 'Percona-Server/mysql-test/t/percona_bug1218330-master.opt' | |||
21 | --- Percona-Server/mysql-test/t/percona_bug1218330-master.opt 1970-01-01 00:00:00 +0000 | |||
22 | +++ Percona-Server/mysql-test/t/percona_bug1218330-master.opt 2013-09-02 14:08:46 +0000 | |||
23 | @@ -0,0 +1,1 @@ | |||
24 | 1 | --innodb-adaptive-hash-index-partitions=32 | ||
25 | 0 | 2 | ||
26 | === added file 'Percona-Server/mysql-test/t/percona_bug1218330.test' | |||
27 | --- Percona-Server/mysql-test/t/percona_bug1218330.test 1970-01-01 00:00:00 +0000 | |||
28 | +++ Percona-Server/mysql-test/t/percona_bug1218330.test 2013-09-02 14:08:46 +0000 | |||
29 | @@ -0,0 +1,72 @@ | |||
30 | 1 | ############################################################################ | ||
31 | 2 | # Bug #1218330: Adaptive hash index memory is incorrectly calculated in SHOW | ||
32 | 3 | # ENGINE INNODB STATUS and I_S | ||
33 | 4 | ############################################################################ | ||
34 | 5 | |||
35 | 6 | --source include/have_innodb.inc | ||
36 | 7 | |||
37 | 8 | let $adaptive_hash_mem_1=`SELECT VARIABLE_VALUE FROM | ||
38 | 9 | INFORMATION_SCHEMA.GLOBAL_STATUS WHERE | ||
39 | 10 | VARIABLE_NAME='Innodb_mem_adaptive_hash'`; | ||
40 | 11 | |||
41 | 12 | let $is_adaptive_hash_mem_constant_1=`SELECT CONSTANT_MEMORY FROM | ||
42 | 13 | INFORMATION_SCHEMA.XTRADB_INTERNAL_HASH_TABLES WHERE | ||
43 | 14 | INTERNAL_HASH_TABLE_NAME='Adaptive hash index'`; | ||
44 | 15 | |||
45 | 16 | let $is_adaptive_hash_mem_variable_1=`SELECT VARIABLE_MEMORY FROM | ||
46 | 17 | INFORMATION_SCHEMA.XTRADB_INTERNAL_HASH_TABLES WHERE | ||
47 | 18 | INTERNAL_HASH_TABLE_NAME='Adaptive hash index'`; | ||
48 | 19 | |||
49 | 20 | let $is_adaptive_hash_mem_total_1=`SELECT TOTAL_MEMORY FROM | ||
50 | 21 | INFORMATION_SCHEMA.XTRADB_INTERNAL_HASH_TABLES WHERE | ||
51 | 22 | INTERNAL_HASH_TABLE_NAME='Adaptive hash index'`; | ||
52 | 23 | |||
53 | 24 | CREATE TABLE t1 ( | ||
54 | 25 | a INT PRIMARY KEY, b INT, | ||
55 | 26 | c CHAR(200), | ||
56 | 27 | UNIQUE INDEX b(b)) ENGINE=InnoDB; | ||
57 | 28 | |||
58 | 29 | INSERT INTO t1 VALUES (1, 1, REPEAT("a", 200)); | ||
59 | 30 | |||
60 | 31 | --disable_query_log | ||
61 | 32 | |||
62 | 33 | --let $i=200 | ||
63 | 34 | --disable_result_log | ||
64 | 35 | while ($i) | ||
65 | 36 | { | ||
66 | 37 | SELECT a FROM t1 WHERE a=1; | ||
67 | 38 | SELECT b FROM t1 WHERE b=1; | ||
68 | 39 | --dec $i | ||
69 | 40 | } | ||
70 | 41 | --enable_result_log | ||
71 | 42 | |||
72 | 43 | let $adaptive_hash_mem_2=`SELECT VARIABLE_VALUE FROM | ||
73 | 44 | INFORMATION_SCHEMA.GLOBAL_STATUS WHERE | ||
74 | 45 | VARIABLE_NAME='Innodb_mem_adaptive_hash'`; | ||
75 | 46 | |||
76 | 47 | let $is_adaptive_hash_mem_constant_2=`SELECT CONSTANT_MEMORY FROM | ||
77 | 48 | INFORMATION_SCHEMA.XTRADB_INTERNAL_HASH_TABLES WHERE | ||
78 | 49 | INTERNAL_HASH_TABLE_NAME='Adaptive hash index'`; | ||
79 | 50 | |||
80 | 51 | let $is_adaptive_hash_mem_variable_2=`SELECT VARIABLE_MEMORY FROM | ||
81 | 52 | INFORMATION_SCHEMA.XTRADB_INTERNAL_HASH_TABLES WHERE | ||
82 | 53 | INTERNAL_HASH_TABLE_NAME='Adaptive hash index'`; | ||
83 | 54 | |||
84 | 55 | let $is_adaptive_hash_mem_total_2=`SELECT TOTAL_MEMORY FROM | ||
85 | 56 | INFORMATION_SCHEMA.XTRADB_INTERNAL_HASH_TABLES WHERE | ||
86 | 57 | INTERNAL_HASH_TABLE_NAME='Adaptive hash index'`; | ||
87 | 58 | |||
88 | 59 | # The original implementation would should identical values in | ||
89 | 60 | # adaptive_hash_mem_1 and adaptive_hash_mem_2 | ||
90 | 61 | |||
91 | 62 | --eval SELECT $adaptive_hash_mem_1 != $adaptive_hash_mem_2 as should_be_1 | ||
92 | 63 | |||
93 | 64 | # Should show identical constant, but different variable parts | ||
94 | 65 | |||
95 | 66 | --eval SELECT $is_adaptive_hash_mem_total_1 != $is_adaptive_hash_mem_total_2 as should_be_1 | ||
96 | 67 | --eval SELECT $is_adaptive_hash_mem_constant_1 = $is_adaptive_hash_mem_constant_2 as should_be_1 | ||
97 | 68 | --eval SELECT $is_adaptive_hash_mem_variable_1 != $is_adaptive_hash_mem_variable_2 as should_be_1 | ||
98 | 69 | |||
99 | 70 | --enable_query_log | ||
100 | 71 | |||
101 | 72 | DROP TABLE t1; | ||
102 | 0 | 73 | ||
103 | === modified file 'Percona-Server/storage/innobase/btr/btr0cur.cc' | |||
104 | --- Percona-Server/storage/innobase/btr/btr0cur.cc 2013-08-29 17:05:40 +0000 | |||
105 | +++ Percona-Server/storage/innobase/btr/btr0cur.cc 2013-09-02 14:08:46 +0000 | |||
106 | @@ -535,9 +535,9 @@ | |||
107 | 535 | 535 | ||
108 | 536 | # ifdef UNIV_SEARCH_PERF_STAT | 536 | # ifdef UNIV_SEARCH_PERF_STAT |
109 | 537 | info->n_searches++; | 537 | info->n_searches++; |
113 | 538 | # endif | 538 | #endif |
114 | 539 | if ((rw_lock_get_writer(btr_search_get_latch(cursor->index->id)) | 539 | if (rw_lock_get_writer(btr_search_get_latch(cursor->index)) == |
115 | 540 | == RW_LOCK_NOT_LOCKED) | 540 | RW_LOCK_NOT_LOCKED |
116 | 541 | && latch_mode <= BTR_MODIFY_LEAF | 541 | && latch_mode <= BTR_MODIFY_LEAF |
117 | 542 | && info->last_hash_succ | 542 | && info->last_hash_succ |
118 | 543 | && !estimate | 543 | && !estimate |
119 | @@ -573,7 +573,7 @@ | |||
120 | 573 | 573 | ||
121 | 574 | if (has_search_latch) { | 574 | if (has_search_latch) { |
122 | 575 | /* Release possible search latch to obey latching order */ | 575 | /* Release possible search latch to obey latching order */ |
124 | 576 | rw_lock_s_unlock(btr_search_get_latch(cursor->index->id)); | 576 | rw_lock_s_unlock(btr_search_get_latch(cursor->index)); |
125 | 577 | } | 577 | } |
126 | 578 | 578 | ||
127 | 579 | /* Store the position of the tree latch we push to mtr so that we | 579 | /* Store the position of the tree latch we push to mtr so that we |
128 | @@ -896,7 +896,7 @@ | |||
129 | 896 | 896 | ||
130 | 897 | if (has_search_latch) { | 897 | if (has_search_latch) { |
131 | 898 | 898 | ||
133 | 899 | rw_lock_s_lock(btr_search_get_latch(cursor->index->id)); | 899 | rw_lock_s_lock(btr_search_get_latch(cursor->index)); |
134 | 900 | } | 900 | } |
135 | 901 | } | 901 | } |
136 | 902 | 902 | ||
137 | @@ -2163,13 +2163,13 @@ | |||
138 | 2163 | btr_search_update_hash_on_delete(cursor); | 2163 | btr_search_update_hash_on_delete(cursor); |
139 | 2164 | } | 2164 | } |
140 | 2165 | 2165 | ||
142 | 2166 | rw_lock_x_lock(btr_search_get_latch(cursor->index->id)); | 2166 | rw_lock_x_lock(btr_search_get_latch(cursor->index)); |
143 | 2167 | } | 2167 | } |
144 | 2168 | 2168 | ||
145 | 2169 | row_upd_rec_in_place(rec, index, offsets, update, page_zip); | 2169 | row_upd_rec_in_place(rec, index, offsets, update, page_zip); |
146 | 2170 | 2170 | ||
147 | 2171 | if (is_hashed) { | 2171 | if (is_hashed) { |
149 | 2172 | rw_lock_x_unlock(btr_search_get_latch(cursor->index->id)); | 2172 | rw_lock_x_unlock(btr_search_get_latch(cursor->index)); |
150 | 2173 | } | 2173 | } |
151 | 2174 | 2174 | ||
152 | 2175 | btr_cur_update_in_place_log(flags, rec, index, update, | 2175 | btr_cur_update_in_place_log(flags, rec, index, update, |
153 | 2176 | 2176 | ||
154 | === modified file 'Percona-Server/storage/innobase/btr/btr0sea.cc' | |||
155 | --- Percona-Server/storage/innobase/btr/btr0sea.cc 2013-08-29 17:05:40 +0000 | |||
156 | +++ Percona-Server/storage/innobase/btr/btr0sea.cc 2013-09-02 14:08:46 +0000 | |||
157 | @@ -65,15 +65,14 @@ | |||
158 | 65 | cache line as btr_search_latch */ | 65 | cache line as btr_search_latch */ |
159 | 66 | UNIV_INTERN byte btr_sea_pad1[64]; | 66 | UNIV_INTERN byte btr_sea_pad1[64]; |
160 | 67 | 67 | ||
164 | 68 | /** The latch protecting the adaptive search system: this latch protects the | 68 | /** Array of latches protecting individual AHI partitions. The latches |
165 | 69 | (1) positions of records on those pages where a hash index has been built. | 69 | protect: (1) positions of records on those pages where a hash index from the |
166 | 70 | NOTE: It does not protect values of non-ordering fields within a record from | 70 | corresponding AHI partition has been built. |
167 | 71 | NOTE: They do not protect values of non-ordering fields within a record from | ||
168 | 71 | being updated in-place! We can use fact (1) to perform unique searches to | 72 | being updated in-place! We can use fact (1) to perform unique searches to |
169 | 72 | indexes. */ | 73 | indexes. */ |
170 | 73 | 74 | ||
174 | 74 | /* We will allocate the latches from dynamic memory to get them to the | 75 | UNIV_INTERN rw_lock_t* btr_search_latch_arr; |
172 | 75 | same DRAM page as other hotspot semaphores */ | ||
173 | 76 | UNIV_INTERN rw_lock_t** btr_search_latch_arr; | ||
175 | 77 | 76 | ||
176 | 78 | /** padding to prevent other memory update hotspots from residing on | 77 | /** padding to prevent other memory update hotspots from residing on |
177 | 79 | the same memory cache line */ | 78 | the same memory cache line */ |
178 | @@ -126,18 +125,18 @@ | |||
179 | 126 | static | 125 | static |
180 | 127 | void | 126 | void |
181 | 128 | btr_search_check_free_space_in_heap( | 127 | btr_search_check_free_space_in_heap( |
184 | 129 | /*================================*/ | 128 | /*=====================================*/ |
185 | 130 | index_id_t key) /*!<in: id of the hashed index tree */ | 129 | dict_index_t* index) |
186 | 131 | { | 130 | { |
187 | 132 | hash_table_t* table; | 131 | hash_table_t* table; |
188 | 133 | mem_heap_t* heap; | 132 | mem_heap_t* heap; |
189 | 134 | 133 | ||
190 | 135 | #ifdef UNIV_SYNC_DEBUG | 134 | #ifdef UNIV_SYNC_DEBUG |
193 | 136 | ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_SHARED)); | 135 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_SHARED)); |
194 | 137 | ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_EX)); | 136 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_EX)); |
195 | 138 | #endif /* UNIV_SYNC_DEBUG */ | 137 | #endif /* UNIV_SYNC_DEBUG */ |
196 | 139 | 138 | ||
198 | 140 | table = btr_search_get_hash_index(key); | 139 | table = btr_search_get_hash_table(index); |
199 | 141 | 140 | ||
200 | 142 | heap = table->heap; | 141 | heap = table->heap; |
201 | 143 | 142 | ||
202 | @@ -148,7 +147,7 @@ | |||
203 | 148 | if (heap->free_block == NULL) { | 147 | if (heap->free_block == NULL) { |
204 | 149 | buf_block_t* block = buf_block_alloc(NULL); | 148 | buf_block_t* block = buf_block_alloc(NULL); |
205 | 150 | 149 | ||
207 | 151 | rw_lock_x_lock(btr_search_get_latch(key)); | 150 | rw_lock_x_lock(btr_search_get_latch(index)); |
208 | 152 | 151 | ||
209 | 153 | if (heap->free_block == NULL) { | 152 | if (heap->free_block == NULL) { |
210 | 154 | heap->free_block = block; | 153 | heap->free_block = block; |
211 | @@ -156,7 +155,7 @@ | |||
212 | 156 | buf_block_free(block); | 155 | buf_block_free(block); |
213 | 157 | } | 156 | } |
214 | 158 | 157 | ||
216 | 159 | rw_lock_x_unlock(btr_search_get_latch(key)); | 158 | rw_lock_x_unlock(btr_search_get_latch(index)); |
217 | 160 | } | 159 | } |
218 | 161 | } | 160 | } |
219 | 162 | 161 | ||
220 | @@ -182,31 +181,28 @@ | |||
221 | 182 | /* We allocate the search latch from dynamic memory: | 181 | /* We allocate the search latch from dynamic memory: |
222 | 183 | see above at the global variable definition */ | 182 | see above at the global variable definition */ |
223 | 184 | 183 | ||
227 | 185 | /* btr_search_index_num should be no greater than bits of | 184 | /* btr_search_index_num is constrained to machine word size for |
228 | 186 | trx->has_search_latch, which is ulint. */ | 185 | historical reasons. This limitation can be easily removed later. */ |
226 | 187 | ut_ad(btr_search_index_num <= sizeof(ulint)); | ||
229 | 188 | 186 | ||
232 | 189 | btr_search_latch_arr = (rw_lock_t**) | 187 | btr_search_latch_arr = (rw_lock_t *) |
233 | 190 | mem_alloc(sizeof(rw_lock_t *) * btr_search_index_num); | 188 | mem_alloc(sizeof(rw_lock_t) * btr_search_index_num); |
234 | 191 | 189 | ||
235 | 192 | btr_search_sys = (btr_search_sys_t*) | 190 | btr_search_sys = (btr_search_sys_t*) |
236 | 193 | mem_alloc(sizeof(btr_search_sys_t)); | 191 | mem_alloc(sizeof(btr_search_sys_t)); |
237 | 194 | 192 | ||
239 | 195 | btr_search_sys->hash_index = (hash_table_t **) | 193 | btr_search_sys->hash_tables = (hash_table_t **) |
240 | 196 | mem_alloc(sizeof(hash_table_t *) * btr_search_index_num); | 194 | mem_alloc(sizeof(hash_table_t *) * btr_search_index_num); |
241 | 197 | 195 | ||
242 | 198 | for (i = 0; i < btr_search_index_num; i++) { | 196 | for (i = 0; i < btr_search_index_num; i++) { |
250 | 199 | btr_search_latch_arr[i] = (rw_lock_t *) | 197 | |
251 | 200 | mem_alloc(sizeof(rw_lock_t)); | 198 | rw_lock_create(btr_search_latch_key, |
252 | 201 | 199 | &btr_search_latch_arr[i], SYNC_SEARCH_SYS); | |
253 | 202 | rw_lock_create(btr_search_latch_key, btr_search_latch_arr[i], | 200 | |
254 | 203 | SYNC_SEARCH_SYS); | 201 | btr_search_sys->hash_tables[i] |
248 | 204 | |||
249 | 205 | btr_search_sys->hash_index[i] | ||
255 | 206 | = ha_create(hash_size, 0, MEM_HEAP_FOR_BTR_SEARCH, 0); | 202 | = ha_create(hash_size, 0, MEM_HEAP_FOR_BTR_SEARCH, 0); |
256 | 207 | 203 | ||
257 | 208 | #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG | 204 | #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG |
259 | 209 | btr_search_sys->hash_index[i]->adaptive = TRUE; | 205 | btr_search_sys->hash_tables[i]->adaptive = TRUE; |
260 | 210 | #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ | 206 | #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ |
261 | 211 | } | 207 | } |
262 | 212 | } | 208 | } |
263 | @@ -222,20 +218,18 @@ | |||
264 | 222 | 218 | ||
265 | 223 | for (i = 0; i < btr_search_index_num; i++) { | 219 | for (i = 0; i < btr_search_index_num; i++) { |
266 | 224 | 220 | ||
274 | 225 | rw_lock_free(btr_search_latch_arr[i]); | 221 | rw_lock_free(&btr_search_latch_arr[i]); |
275 | 226 | 222 | ||
276 | 227 | mem_free(btr_search_latch_arr[i]); | 223 | mem_heap_free(btr_search_sys->hash_tables[i]->heap); |
277 | 228 | 224 | ||
278 | 229 | mem_heap_free(btr_search_sys->hash_index[i]->heap); | 225 | hash_table_free(btr_search_sys->hash_tables[i]); |
272 | 230 | |||
273 | 231 | hash_table_free(btr_search_sys->hash_index[i]); | ||
279 | 232 | 226 | ||
280 | 233 | } | 227 | } |
281 | 234 | 228 | ||
282 | 235 | mem_free(btr_search_latch_arr); | 229 | mem_free(btr_search_latch_arr); |
283 | 236 | btr_search_latch_arr = NULL; | 230 | btr_search_latch_arr = NULL; |
284 | 237 | 231 | ||
286 | 238 | mem_free(btr_search_sys->hash_index); | 232 | mem_free(btr_search_sys->hash_tables); |
287 | 239 | 233 | ||
288 | 240 | mem_free(btr_search_sys); | 234 | mem_free(btr_search_sys); |
289 | 241 | btr_search_sys = NULL; | 235 | btr_search_sys = NULL; |
290 | @@ -257,7 +251,7 @@ | |||
291 | 257 | index = dict_table_get_next_index(index)) { | 251 | index = dict_table_get_next_index(index)) { |
292 | 258 | 252 | ||
293 | 259 | #ifdef UNIV_SYNC_DEBUG | 253 | #ifdef UNIV_SYNC_DEBUG |
295 | 260 | ut_ad(rw_lock_own(btr_search_get_latch(index->id), | 254 | ut_ad(rw_lock_own(btr_search_get_latch(index), |
296 | 261 | RW_LOCK_EX)); | 255 | RW_LOCK_EX)); |
297 | 262 | #endif /* UNIV_SYNC_DEBUG */ | 256 | #endif /* UNIV_SYNC_DEBUG */ |
298 | 263 | index->search_info->ref_count = 0; | 257 | index->search_info->ref_count = 0; |
299 | @@ -300,8 +294,8 @@ | |||
300 | 300 | 294 | ||
301 | 301 | /* Clear the adaptive hash index. */ | 295 | /* Clear the adaptive hash index. */ |
302 | 302 | for (i = 0; i < btr_search_index_num; i++) { | 296 | for (i = 0; i < btr_search_index_num; i++) { |
305 | 303 | hash_table_clear(btr_search_sys->hash_index[i]); | 297 | hash_table_clear(btr_search_sys->hash_tables[i]); |
306 | 304 | mem_heap_empty(btr_search_sys->hash_index[i]->heap); | 298 | mem_heap_empty(btr_search_sys->hash_tables[i]->heap); |
307 | 305 | } | 299 | } |
308 | 306 | 300 | ||
309 | 307 | btr_search_x_unlock_all(); | 301 | btr_search_x_unlock_all(); |
310 | @@ -364,27 +358,27 @@ | |||
311 | 364 | 358 | ||
312 | 365 | /*****************************************************************//** | 359 | /*****************************************************************//** |
313 | 366 | Returns the value of ref_count. The value is protected by | 360 | Returns the value of ref_count. The value is protected by |
315 | 367 | btr_search_latch. | 361 | the . |
316 | 368 | @return ref_count value. */ | 362 | @return ref_count value. */ |
317 | 369 | UNIV_INTERN | 363 | UNIV_INTERN |
318 | 370 | ulint | 364 | ulint |
319 | 371 | btr_search_info_get_ref_count( | 365 | btr_search_info_get_ref_count( |
320 | 372 | /*==========================*/ | 366 | /*==========================*/ |
321 | 373 | btr_search_t* info, /*!< in: search info. */ | 367 | btr_search_t* info, /*!< in: search info. */ |
323 | 374 | index_id_t key) /*!< in: id of the index owning search info */ | 368 | dict_index_t* index) /*!< in: index */ |
324 | 375 | { | 369 | { |
325 | 376 | ulint ret; | 370 | ulint ret; |
326 | 377 | 371 | ||
327 | 378 | ut_ad(info); | 372 | ut_ad(info); |
328 | 379 | 373 | ||
329 | 380 | #ifdef UNIV_SYNC_DEBUG | 374 | #ifdef UNIV_SYNC_DEBUG |
332 | 381 | ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_SHARED)); | 375 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_SHARED)); |
333 | 382 | ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_EX)); | 376 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_EX)); |
334 | 383 | #endif /* UNIV_SYNC_DEBUG */ | 377 | #endif /* UNIV_SYNC_DEBUG */ |
335 | 384 | 378 | ||
337 | 385 | rw_lock_s_lock(btr_search_get_latch(key)); | 379 | rw_lock_s_lock(btr_search_get_latch(index)); |
338 | 386 | ret = info->ref_count; | 380 | ret = info->ref_count; |
340 | 387 | rw_lock_s_unlock(btr_search_get_latch(key)); | 381 | rw_lock_s_unlock(btr_search_get_latch(index)); |
341 | 388 | 382 | ||
342 | 389 | return(ret); | 383 | return(ret); |
343 | 390 | } | 384 | } |
344 | @@ -405,8 +399,8 @@ | |||
345 | 405 | int cmp; | 399 | int cmp; |
346 | 406 | 400 | ||
347 | 407 | #ifdef UNIV_SYNC_DEBUG | 401 | #ifdef UNIV_SYNC_DEBUG |
350 | 408 | ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_SHARED)); | 402 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_SHARED)); |
351 | 409 | ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_EX)); | 403 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_EX)); |
352 | 410 | #endif /* UNIV_SYNC_DEBUG */ | 404 | #endif /* UNIV_SYNC_DEBUG */ |
353 | 411 | 405 | ||
354 | 412 | if (dict_index_is_ibuf(index)) { | 406 | if (dict_index_is_ibuf(index)) { |
355 | @@ -522,9 +516,9 @@ | |||
356 | 522 | /*!< in: cursor */ | 516 | /*!< in: cursor */ |
357 | 523 | { | 517 | { |
358 | 524 | #ifdef UNIV_SYNC_DEBUG | 518 | #ifdef UNIV_SYNC_DEBUG |
360 | 525 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), | 519 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index), |
361 | 526 | RW_LOCK_SHARED)); | 520 | RW_LOCK_SHARED)); |
363 | 527 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), | 521 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index), |
364 | 528 | RW_LOCK_EX)); | 522 | RW_LOCK_EX)); |
365 | 529 | ut_ad(rw_lock_own(&block->lock, RW_LOCK_SHARED) | 523 | ut_ad(rw_lock_own(&block->lock, RW_LOCK_SHARED) |
366 | 530 | || rw_lock_own(&block->lock, RW_LOCK_EX)); | 524 | || rw_lock_own(&block->lock, RW_LOCK_EX)); |
367 | @@ -609,7 +603,7 @@ | |||
368 | 609 | 603 | ||
369 | 610 | ut_ad(cursor->flag == BTR_CUR_HASH_FAIL); | 604 | ut_ad(cursor->flag == BTR_CUR_HASH_FAIL); |
370 | 611 | #ifdef UNIV_SYNC_DEBUG | 605 | #ifdef UNIV_SYNC_DEBUG |
372 | 612 | ut_ad(rw_lock_own(btr_search_get_latch(cursor->index->id), | 606 | ut_ad(rw_lock_own(btr_search_get_latch(cursor->index), |
373 | 613 | RW_LOCK_EX)); | 607 | RW_LOCK_EX)); |
374 | 614 | ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) | 608 | ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) |
375 | 615 | || rw_lock_own(&(block->lock), RW_LOCK_EX)); | 609 | || rw_lock_own(&(block->lock), RW_LOCK_EX)); |
376 | @@ -651,15 +645,12 @@ | |||
377 | 651 | mem_heap_free(heap); | 645 | mem_heap_free(heap); |
378 | 652 | } | 646 | } |
379 | 653 | #ifdef UNIV_SYNC_DEBUG | 647 | #ifdef UNIV_SYNC_DEBUG |
381 | 654 | ut_ad(rw_lock_own(btr_search_get_latch(cursor->index->id), | 648 | ut_ad(rw_lock_own(btr_search_get_latch(cursor->index), |
382 | 655 | RW_LOCK_EX)); | 649 | RW_LOCK_EX)); |
383 | 656 | #endif /* UNIV_SYNC_DEBUG */ | 650 | #endif /* UNIV_SYNC_DEBUG */ |
384 | 657 | 651 | ||
390 | 658 | ha_insert_for_fold( | 652 | ha_insert_for_fold(btr_search_get_hash_table(cursor->index), |
391 | 659 | btr_search_get_hash_index(cursor->index->id), fold, | 653 | fold, block, rec); |
387 | 660 | block, rec); | ||
388 | 661 | |||
389 | 662 | MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_ADDED); | ||
392 | 663 | } | 654 | } |
393 | 664 | } | 655 | } |
394 | 665 | 656 | ||
395 | @@ -678,9 +669,9 @@ | |||
396 | 678 | ulint* params2; | 669 | ulint* params2; |
397 | 679 | 670 | ||
398 | 680 | #ifdef UNIV_SYNC_DEBUG | 671 | #ifdef UNIV_SYNC_DEBUG |
400 | 681 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), | 672 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index), |
401 | 682 | RW_LOCK_SHARED)); | 673 | RW_LOCK_SHARED)); |
403 | 683 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), | 674 | ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index), |
404 | 684 | RW_LOCK_EX)); | 675 | RW_LOCK_EX)); |
405 | 685 | #endif /* UNIV_SYNC_DEBUG */ | 676 | #endif /* UNIV_SYNC_DEBUG */ |
406 | 686 | 677 | ||
407 | @@ -699,7 +690,7 @@ | |||
408 | 699 | 690 | ||
409 | 700 | if (build_index || (cursor->flag == BTR_CUR_HASH_FAIL)) { | 691 | if (build_index || (cursor->flag == BTR_CUR_HASH_FAIL)) { |
410 | 701 | 692 | ||
412 | 702 | btr_search_check_free_space_in_heap(cursor->index->id); | 693 | btr_search_check_free_space_in_heap(cursor->index); |
413 | 703 | } | 694 | } |
414 | 704 | 695 | ||
415 | 705 | if (cursor->flag == BTR_CUR_HASH_FAIL) { | 696 | if (cursor->flag == BTR_CUR_HASH_FAIL) { |
416 | @@ -709,11 +700,11 @@ | |||
417 | 709 | btr_search_n_hash_fail++; | 700 | btr_search_n_hash_fail++; |
418 | 710 | #endif /* UNIV_SEARCH_PERF_STAT */ | 701 | #endif /* UNIV_SEARCH_PERF_STAT */ |
419 | 711 | 702 | ||
421 | 712 | rw_lock_x_lock(btr_search_get_latch(cursor->index->id)); | 703 | rw_lock_x_lock(btr_search_get_latch(cursor->index)); |
422 | 713 | 704 | ||
423 | 714 | btr_search_update_hash_ref(info, block, cursor); | 705 | btr_search_update_hash_ref(info, block, cursor); |
424 | 715 | 706 | ||
426 | 716 | rw_lock_x_unlock(btr_search_get_latch(cursor->index->id)); | 707 | rw_lock_x_unlock(btr_search_get_latch(cursor->index)); |
427 | 717 | } | 708 | } |
428 | 718 | 709 | ||
429 | 719 | if (build_index) { | 710 | if (build_index) { |
430 | @@ -958,19 +949,18 @@ | |||
431 | 958 | cursor->flag = BTR_CUR_HASH; | 949 | cursor->flag = BTR_CUR_HASH; |
432 | 959 | 950 | ||
433 | 960 | if (UNIV_LIKELY(!has_search_latch)) { | 951 | if (UNIV_LIKELY(!has_search_latch)) { |
435 | 961 | rw_lock_s_lock(btr_search_get_latch(index_id)); | 952 | rw_lock_s_lock(btr_search_get_latch(index)); |
436 | 962 | 953 | ||
437 | 963 | if (UNIV_UNLIKELY(!btr_search_enabled)) { | 954 | if (UNIV_UNLIKELY(!btr_search_enabled)) { |
438 | 964 | goto failure_unlock; | 955 | goto failure_unlock; |
439 | 965 | } | 956 | } |
440 | 966 | } | 957 | } |
441 | 967 | 958 | ||
445 | 968 | ut_ad(rw_lock_get_writer(btr_search_get_latch(index_id)) | 959 | ut_ad(rw_lock_get_writer(btr_search_get_latch(index)) != RW_LOCK_EX); |
446 | 969 | != RW_LOCK_EX); | 960 | ut_ad(rw_lock_get_reader_count(btr_search_get_latch(index)) > 0); |
444 | 970 | ut_ad(rw_lock_get_reader_count(btr_search_get_latch(index_id)) > 0); | ||
447 | 971 | 961 | ||
448 | 972 | rec = (rec_t*) ha_search_and_get_data( | 962 | rec = (rec_t*) ha_search_and_get_data( |
450 | 973 | btr_search_get_hash_index(index_id), fold); | 963 | btr_search_get_hash_table(index), fold); |
451 | 974 | 964 | ||
452 | 975 | if (UNIV_UNLIKELY(!rec)) { | 965 | if (UNIV_UNLIKELY(!rec)) { |
453 | 976 | goto failure_unlock; | 966 | goto failure_unlock; |
454 | @@ -988,7 +978,7 @@ | |||
455 | 988 | goto failure_unlock; | 978 | goto failure_unlock; |
456 | 989 | } | 979 | } |
457 | 990 | 980 | ||
459 | 991 | rw_lock_s_unlock(btr_search_get_latch(index_id)); | 981 | rw_lock_s_unlock(btr_search_get_latch(index)); |
460 | 992 | 982 | ||
461 | 993 | buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH); | 983 | buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH); |
462 | 994 | } | 984 | } |
463 | @@ -1085,7 +1075,7 @@ | |||
464 | 1085 | /*-------------------------------------------*/ | 1075 | /*-------------------------------------------*/ |
465 | 1086 | failure_unlock: | 1076 | failure_unlock: |
466 | 1087 | if (UNIV_LIKELY(!has_search_latch)) { | 1077 | if (UNIV_LIKELY(!has_search_latch)) { |
468 | 1088 | rw_lock_s_unlock(btr_search_get_latch(index_id)); | 1078 | rw_lock_s_unlock(btr_search_get_latch(index)); |
469 | 1089 | } | 1079 | } |
470 | 1090 | failure: | 1080 | failure: |
471 | 1091 | cursor->flag = BTR_CUR_HASH_FAIL; | 1081 | cursor->flag = BTR_CUR_HASH_FAIL; |
472 | @@ -1133,41 +1123,31 @@ | |||
473 | 1133 | const dict_index_t* index; | 1123 | const dict_index_t* index; |
474 | 1134 | ulint* offsets; | 1124 | ulint* offsets; |
475 | 1135 | btr_search_t* info; | 1125 | btr_search_t* info; |
476 | 1136 | rw_lock_t* btr_search_latch; | ||
477 | 1137 | 1126 | ||
478 | 1138 | retry: | 1127 | retry: |
489 | 1139 | /* Do a dirty check on block->index, return if the block is | 1128 | /* Do a dirty check on block->index, return if the block is not in the |
490 | 1140 | not in the adaptive hash index. This is to avoid acquiring | 1129 | adaptive hash index. This is to avoid acquiring an AHI latch for |
491 | 1141 | shared btr_search_latch for performance consideration. */ | 1130 | performance considerations. */ |
492 | 1142 | if (!block->index) { | 1131 | |
493 | 1143 | return; | 1132 | index = block->index; |
494 | 1144 | } | 1133 | if (!index) { |
495 | 1145 | 1134 | ||
486 | 1146 | btr_search_latch = block->btr_search_latch; | ||
487 | 1147 | |||
488 | 1148 | if (UNIV_UNLIKELY(!btr_search_latch)) { | ||
496 | 1149 | return; | 1135 | return; |
497 | 1150 | } | 1136 | } |
498 | 1151 | 1137 | ||
499 | 1152 | #ifdef UNIV_SYNC_DEBUG | 1138 | #ifdef UNIV_SYNC_DEBUG |
502 | 1153 | ut_ad(!rw_lock_own(btr_search_latch, RW_LOCK_SHARED)); | 1139 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_SHARED)); |
503 | 1154 | ut_ad(!rw_lock_own(btr_search_latch, RW_LOCK_EX)); | 1140 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_EX)); |
504 | 1155 | #endif /* UNIV_SYNC_DEBUG */ | 1141 | #endif /* UNIV_SYNC_DEBUG */ |
509 | 1156 | 1142 | rw_lock_s_lock(btr_search_get_latch(index)); | |
510 | 1157 | rw_lock_s_lock(btr_search_latch); | 1143 | |
511 | 1158 | if (UNIV_UNLIKELY(btr_search_latch != block->btr_search_latch)) { | 1144 | if (UNIV_UNLIKELY(index != block->index)) { |
512 | 1159 | rw_lock_s_unlock(btr_search_latch); | 1145 | |
513 | 1146 | rw_lock_s_unlock(btr_search_get_latch(index)); | ||
514 | 1147 | |||
515 | 1160 | goto retry; | 1148 | goto retry; |
516 | 1161 | } | 1149 | } |
517 | 1162 | 1150 | ||
518 | 1163 | index = block->index; | ||
519 | 1164 | if (UNIV_UNLIKELY(!index)) { | ||
520 | 1165 | rw_lock_s_unlock(btr_search_latch); | ||
521 | 1166 | return; | ||
522 | 1167 | } | ||
523 | 1168 | |||
524 | 1169 | ut_ad(btr_search_latch == btr_search_get_latch(index->id)); | ||
525 | 1170 | |||
526 | 1171 | ut_a(!dict_index_is_ibuf(index)); | 1151 | ut_a(!dict_index_is_ibuf(index)); |
527 | 1172 | #ifdef UNIV_DEBUG | 1152 | #ifdef UNIV_DEBUG |
528 | 1173 | switch (dict_index_get_online_status(index)) { | 1153 | switch (dict_index_get_online_status(index)) { |
529 | @@ -1190,7 +1170,7 @@ | |||
530 | 1190 | } | 1170 | } |
531 | 1191 | #endif /* UNIV_DEBUG */ | 1171 | #endif /* UNIV_DEBUG */ |
532 | 1192 | 1172 | ||
534 | 1193 | table = btr_search_get_hash_index(index->id); | 1173 | table = btr_search_get_hash_table(index); |
535 | 1194 | 1174 | ||
536 | 1195 | #ifdef UNIV_SYNC_DEBUG | 1175 | #ifdef UNIV_SYNC_DEBUG |
537 | 1196 | ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) | 1176 | ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) |
538 | @@ -1206,7 +1186,7 @@ | |||
539 | 1206 | releasing btr_search_latch, as the index page might only | 1186 | releasing btr_search_latch, as the index page might only |
540 | 1207 | be s-latched! */ | 1187 | be s-latched! */ |
541 | 1208 | 1188 | ||
543 | 1209 | rw_lock_s_unlock(btr_search_latch); | 1189 | rw_lock_s_unlock(btr_search_get_latch(index)); |
544 | 1210 | 1190 | ||
545 | 1211 | ut_a(n_fields + n_bytes > 0); | 1191 | ut_a(n_fields + n_bytes > 0); |
546 | 1212 | 1192 | ||
547 | @@ -1257,7 +1237,7 @@ | |||
548 | 1257 | mem_heap_free(heap); | 1237 | mem_heap_free(heap); |
549 | 1258 | } | 1238 | } |
550 | 1259 | 1239 | ||
552 | 1260 | rw_lock_x_lock(btr_search_get_latch(index->id)); | 1240 | rw_lock_x_lock(btr_search_get_latch(index)); |
553 | 1261 | 1241 | ||
554 | 1262 | if (UNIV_UNLIKELY(!block->index)) { | 1242 | if (UNIV_UNLIKELY(!block->index)) { |
555 | 1263 | /* Someone else has meanwhile dropped the hash index */ | 1243 | /* Someone else has meanwhile dropped the hash index */ |
556 | @@ -1273,7 +1253,7 @@ | |||
557 | 1273 | /* Someone else has meanwhile built a new hash index on the | 1253 | /* Someone else has meanwhile built a new hash index on the |
558 | 1274 | page, with different parameters */ | 1254 | page, with different parameters */ |
559 | 1275 | 1255 | ||
561 | 1276 | rw_lock_x_unlock(btr_search_get_latch(index->id)); | 1256 | rw_lock_x_unlock(btr_search_get_latch(index)); |
562 | 1277 | 1257 | ||
563 | 1278 | mem_free(folds); | 1258 | mem_free(folds); |
564 | 1279 | goto retry; | 1259 | goto retry; |
565 | @@ -1289,7 +1269,6 @@ | |||
566 | 1289 | info->ref_count--; | 1269 | info->ref_count--; |
567 | 1290 | 1270 | ||
568 | 1291 | block->index = NULL; | 1271 | block->index = NULL; |
569 | 1292 | block->btr_search_latch = NULL; | ||
570 | 1293 | 1272 | ||
571 | 1294 | MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_REMOVED); | 1273 | MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_REMOVED); |
572 | 1295 | MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_REMOVED, n_cached); | 1274 | MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_REMOVED, n_cached); |
573 | @@ -1305,14 +1284,14 @@ | |||
574 | 1305 | "InnoDB: the hash index to a page of %s," | 1284 | "InnoDB: the hash index to a page of %s," |
575 | 1306 | " still %lu hash nodes remain.\n", | 1285 | " still %lu hash nodes remain.\n", |
576 | 1307 | index->name, (ulong) block->n_pointers); | 1286 | index->name, (ulong) block->n_pointers); |
578 | 1308 | rw_lock_x_unlock(btr_search_get_latch(index->id)); | 1287 | rw_lock_x_unlock(btr_search_get_latch(index)); |
579 | 1309 | 1288 | ||
580 | 1310 | ut_ad(btr_search_validate()); | 1289 | ut_ad(btr_search_validate()); |
581 | 1311 | } else { | 1290 | } else { |
583 | 1312 | rw_lock_x_unlock(btr_search_get_latch(index->id)); | 1291 | rw_lock_x_unlock(btr_search_get_latch(index)); |
584 | 1313 | } | 1292 | } |
585 | 1314 | #else /* UNIV_AHI_DEBUG || UNIV_DEBUG */ | 1293 | #else /* UNIV_AHI_DEBUG || UNIV_DEBUG */ |
587 | 1315 | rw_lock_x_unlock(btr_search_get_latch(index->id)); | 1294 | rw_lock_x_unlock(btr_search_get_latch(index)); |
588 | 1316 | #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ | 1295 | #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ |
589 | 1317 | 1296 | ||
590 | 1318 | mem_free(folds); | 1297 | mem_free(folds); |
591 | @@ -1391,30 +1370,30 @@ | |||
592 | 1391 | ut_a(!dict_index_is_ibuf(index)); | 1370 | ut_a(!dict_index_is_ibuf(index)); |
593 | 1392 | 1371 | ||
594 | 1393 | #ifdef UNIV_SYNC_DEBUG | 1372 | #ifdef UNIV_SYNC_DEBUG |
596 | 1394 | ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_EX)); | 1373 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_EX)); |
597 | 1395 | ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) | 1374 | ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) |
598 | 1396 | || rw_lock_own(&(block->lock), RW_LOCK_EX)); | 1375 | || rw_lock_own(&(block->lock), RW_LOCK_EX)); |
599 | 1397 | #endif /* UNIV_SYNC_DEBUG */ | 1376 | #endif /* UNIV_SYNC_DEBUG */ |
600 | 1398 | 1377 | ||
602 | 1399 | rw_lock_s_lock(btr_search_get_latch(index->id)); | 1378 | rw_lock_s_lock(btr_search_get_latch(index)); |
603 | 1400 | 1379 | ||
604 | 1401 | if (!btr_search_enabled) { | 1380 | if (!btr_search_enabled) { |
606 | 1402 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1381 | rw_lock_s_unlock(btr_search_get_latch(index)); |
607 | 1403 | return; | 1382 | return; |
608 | 1404 | } | 1383 | } |
609 | 1405 | 1384 | ||
611 | 1406 | table = btr_search_get_hash_index(index->id); | 1385 | table = btr_search_get_hash_table(index); |
612 | 1407 | page = buf_block_get_frame(block); | 1386 | page = buf_block_get_frame(block); |
613 | 1408 | 1387 | ||
614 | 1409 | if (block->index && ((block->curr_n_fields != n_fields) | 1388 | if (block->index && ((block->curr_n_fields != n_fields) |
615 | 1410 | || (block->curr_n_bytes != n_bytes) | 1389 | || (block->curr_n_bytes != n_bytes) |
616 | 1411 | || (block->curr_left_side != left_side))) { | 1390 | || (block->curr_left_side != left_side))) { |
617 | 1412 | 1391 | ||
619 | 1413 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1392 | rw_lock_s_unlock(btr_search_get_latch(index)); |
620 | 1414 | 1393 | ||
621 | 1415 | btr_search_drop_page_hash_index(block); | 1394 | btr_search_drop_page_hash_index(block); |
622 | 1416 | } else { | 1395 | } else { |
624 | 1417 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1396 | rw_lock_s_unlock(btr_search_get_latch(index)); |
625 | 1418 | } | 1397 | } |
626 | 1419 | 1398 | ||
627 | 1420 | n_recs = page_get_n_recs(page); | 1399 | n_recs = page_get_n_recs(page); |
628 | @@ -1508,9 +1487,9 @@ | |||
629 | 1508 | fold = next_fold; | 1487 | fold = next_fold; |
630 | 1509 | } | 1488 | } |
631 | 1510 | 1489 | ||
633 | 1511 | btr_search_check_free_space_in_heap(index->id); | 1490 | btr_search_check_free_space_in_heap(index); |
634 | 1512 | 1491 | ||
636 | 1513 | rw_lock_x_lock(btr_search_get_latch(index->id)); | 1492 | rw_lock_x_lock(btr_search_get_latch(index)); |
637 | 1514 | 1493 | ||
638 | 1515 | if (UNIV_UNLIKELY(!btr_search_enabled)) { | 1494 | if (UNIV_UNLIKELY(!btr_search_enabled)) { |
639 | 1516 | goto exit_func; | 1495 | goto exit_func; |
640 | @@ -1537,7 +1516,6 @@ | |||
641 | 1537 | block->curr_n_bytes = n_bytes; | 1516 | block->curr_n_bytes = n_bytes; |
642 | 1538 | block->curr_left_side = left_side; | 1517 | block->curr_left_side = left_side; |
643 | 1539 | block->index = index; | 1518 | block->index = index; |
644 | 1540 | block->btr_search_latch = btr_search_get_latch(index->id); | ||
645 | 1541 | 1519 | ||
646 | 1542 | for (i = 0; i < n_cached; i++) { | 1520 | for (i = 0; i < n_cached; i++) { |
647 | 1543 | 1521 | ||
648 | @@ -1547,7 +1525,7 @@ | |||
649 | 1547 | MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_ADDED); | 1525 | MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_ADDED); |
650 | 1548 | MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_ADDED, n_cached); | 1526 | MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_ADDED, n_cached); |
651 | 1549 | exit_func: | 1527 | exit_func: |
653 | 1550 | rw_lock_x_unlock(btr_search_get_latch(index->id)); | 1528 | rw_lock_x_unlock(btr_search_get_latch(index)); |
654 | 1551 | 1529 | ||
655 | 1552 | mem_free(folds); | 1530 | mem_free(folds); |
656 | 1553 | mem_free(recs); | 1531 | mem_free(recs); |
657 | @@ -1582,7 +1560,7 @@ | |||
658 | 1582 | ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_EX)); | 1560 | ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_EX)); |
659 | 1583 | #endif /* UNIV_SYNC_DEBUG */ | 1561 | #endif /* UNIV_SYNC_DEBUG */ |
660 | 1584 | 1562 | ||
662 | 1585 | rw_lock_s_lock(btr_search_get_latch(index->id)); | 1563 | rw_lock_s_lock(btr_search_get_latch(index)); |
663 | 1586 | 1564 | ||
664 | 1587 | ut_a(!new_block->index || new_block->index == index); | 1565 | ut_a(!new_block->index || new_block->index == index); |
665 | 1588 | ut_a(!block->index || block->index == index); | 1566 | ut_a(!block->index || block->index == index); |
666 | @@ -1591,7 +1569,7 @@ | |||
667 | 1591 | 1569 | ||
668 | 1592 | if (new_block->index) { | 1570 | if (new_block->index) { |
669 | 1593 | 1571 | ||
671 | 1594 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1572 | rw_lock_s_unlock(btr_search_get_latch(index)); |
672 | 1595 | 1573 | ||
673 | 1596 | btr_search_drop_page_hash_index(block); | 1574 | btr_search_drop_page_hash_index(block); |
674 | 1597 | 1575 | ||
675 | @@ -1608,7 +1586,7 @@ | |||
676 | 1608 | new_block->n_bytes = block->curr_n_bytes; | 1586 | new_block->n_bytes = block->curr_n_bytes; |
677 | 1609 | new_block->left_side = left_side; | 1587 | new_block->left_side = left_side; |
678 | 1610 | 1588 | ||
680 | 1611 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1589 | rw_lock_s_unlock(btr_search_get_latch(index)); |
681 | 1612 | 1590 | ||
682 | 1613 | ut_a(n_fields + n_bytes > 0); | 1591 | ut_a(n_fields + n_bytes > 0); |
683 | 1614 | 1592 | ||
684 | @@ -1620,7 +1598,7 @@ | |||
685 | 1620 | return; | 1598 | return; |
686 | 1621 | } | 1599 | } |
687 | 1622 | 1600 | ||
689 | 1623 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1601 | rw_lock_s_unlock(btr_search_get_latch(index)); |
690 | 1624 | } | 1602 | } |
691 | 1625 | 1603 | ||
692 | 1626 | /********************************************************************//** | 1604 | /********************************************************************//** |
693 | @@ -1659,7 +1637,7 @@ | |||
694 | 1659 | ut_a(block->curr_n_fields + block->curr_n_bytes > 0); | 1637 | ut_a(block->curr_n_fields + block->curr_n_bytes > 0); |
695 | 1660 | ut_a(!dict_index_is_ibuf(index)); | 1638 | ut_a(!dict_index_is_ibuf(index)); |
696 | 1661 | 1639 | ||
698 | 1662 | table = btr_search_get_hash_index(cursor->index->id); | 1640 | table = btr_search_get_hash_table(cursor->index); |
699 | 1663 | 1641 | ||
700 | 1664 | rec = btr_cur_get_rec(cursor); | 1642 | rec = btr_cur_get_rec(cursor); |
701 | 1665 | 1643 | ||
702 | @@ -1670,7 +1648,7 @@ | |||
703 | 1670 | mem_heap_free(heap); | 1648 | mem_heap_free(heap); |
704 | 1671 | } | 1649 | } |
705 | 1672 | 1650 | ||
707 | 1673 | rw_lock_x_lock(btr_search_get_latch(cursor->index->id)); | 1651 | rw_lock_x_lock(btr_search_get_latch(cursor->index)); |
708 | 1674 | 1652 | ||
709 | 1675 | if (block->index) { | 1653 | if (block->index) { |
710 | 1676 | ut_a(block->index == index); | 1654 | ut_a(block->index == index); |
711 | @@ -1683,7 +1661,7 @@ | |||
712 | 1683 | } | 1661 | } |
713 | 1684 | } | 1662 | } |
714 | 1685 | 1663 | ||
716 | 1686 | rw_lock_x_unlock(btr_search_get_latch(cursor->index->id)); | 1664 | rw_lock_x_unlock(btr_search_get_latch(cursor->index)); |
717 | 1687 | } | 1665 | } |
718 | 1688 | 1666 | ||
719 | 1689 | /********************************************************************//** | 1667 | /********************************************************************//** |
720 | @@ -1720,7 +1698,7 @@ | |||
721 | 1720 | ut_a(cursor->index == index); | 1698 | ut_a(cursor->index == index); |
722 | 1721 | ut_a(!dict_index_is_ibuf(index)); | 1699 | ut_a(!dict_index_is_ibuf(index)); |
723 | 1722 | 1700 | ||
725 | 1723 | rw_lock_x_lock(btr_search_get_latch(cursor->index->id)); | 1701 | rw_lock_x_lock(btr_search_get_latch(cursor->index)); |
726 | 1724 | 1702 | ||
727 | 1725 | if (!block->index) { | 1703 | if (!block->index) { |
728 | 1726 | 1704 | ||
729 | @@ -1734,7 +1712,7 @@ | |||
730 | 1734 | && (cursor->n_bytes == block->curr_n_bytes) | 1712 | && (cursor->n_bytes == block->curr_n_bytes) |
731 | 1735 | && !block->curr_left_side) { | 1713 | && !block->curr_left_side) { |
732 | 1736 | 1714 | ||
734 | 1737 | table = btr_search_get_hash_index(cursor->index->id); | 1715 | table = btr_search_get_hash_table(cursor->index); |
735 | 1738 | 1716 | ||
736 | 1739 | if (ha_search_and_update_if_found( | 1717 | if (ha_search_and_update_if_found( |
737 | 1740 | table, cursor->fold, rec, block, | 1718 | table, cursor->fold, rec, block, |
738 | @@ -1743,9 +1721,9 @@ | |||
739 | 1743 | } | 1721 | } |
740 | 1744 | 1722 | ||
741 | 1745 | func_exit: | 1723 | func_exit: |
743 | 1746 | rw_lock_x_unlock(btr_search_get_latch(cursor->index->id)); | 1724 | rw_lock_x_unlock(btr_search_get_latch(cursor->index)); |
744 | 1747 | } else { | 1725 | } else { |
746 | 1748 | rw_lock_x_unlock(btr_search_get_latch(cursor->index->id)); | 1726 | rw_lock_x_unlock(btr_search_get_latch(cursor->index)); |
747 | 1749 | 1727 | ||
748 | 1750 | btr_search_update_hash_on_insert(cursor); | 1728 | btr_search_update_hash_on_insert(cursor); |
749 | 1751 | } | 1729 | } |
750 | @@ -1793,9 +1771,9 @@ | |||
751 | 1793 | return; | 1771 | return; |
752 | 1794 | } | 1772 | } |
753 | 1795 | 1773 | ||
755 | 1796 | btr_search_check_free_space_in_heap(cursor->index->id); | 1774 | btr_search_check_free_space_in_heap(cursor->index); |
756 | 1797 | 1775 | ||
758 | 1798 | table = btr_search_get_hash_index(cursor->index->id); | 1776 | table = btr_search_get_hash_table(cursor->index); |
759 | 1799 | 1777 | ||
760 | 1800 | rec = btr_cur_get_rec(cursor); | 1778 | rec = btr_cur_get_rec(cursor); |
761 | 1801 | 1779 | ||
762 | @@ -1827,7 +1805,7 @@ | |||
763 | 1827 | } else { | 1805 | } else { |
764 | 1828 | if (left_side) { | 1806 | if (left_side) { |
765 | 1829 | 1807 | ||
767 | 1830 | rw_lock_x_lock(btr_search_get_latch(index->id)); | 1808 | rw_lock_x_lock(btr_search_get_latch(index)); |
768 | 1831 | 1809 | ||
769 | 1832 | locked = TRUE; | 1810 | locked = TRUE; |
770 | 1833 | 1811 | ||
771 | @@ -1845,7 +1823,7 @@ | |||
772 | 1845 | 1823 | ||
773 | 1846 | if (!locked) { | 1824 | if (!locked) { |
774 | 1847 | 1825 | ||
776 | 1848 | rw_lock_x_lock(btr_search_get_latch(index->id)); | 1826 | rw_lock_x_lock(btr_search_get_latch(index)); |
777 | 1849 | 1827 | ||
778 | 1850 | locked = TRUE; | 1828 | locked = TRUE; |
779 | 1851 | 1829 | ||
780 | @@ -1867,8 +1845,7 @@ | |||
781 | 1867 | if (!left_side) { | 1845 | if (!left_side) { |
782 | 1868 | 1846 | ||
783 | 1869 | if (!locked) { | 1847 | if (!locked) { |
786 | 1870 | rw_lock_x_lock(btr_search_get_latch( | 1848 | rw_lock_x_lock(btr_search_get_latch(index)); |
785 | 1871 | index->id)); | ||
787 | 1872 | 1849 | ||
788 | 1873 | locked = TRUE; | 1850 | locked = TRUE; |
789 | 1874 | 1851 | ||
790 | @@ -1887,7 +1864,7 @@ | |||
791 | 1887 | 1864 | ||
792 | 1888 | if (!locked) { | 1865 | if (!locked) { |
793 | 1889 | 1866 | ||
795 | 1890 | rw_lock_x_lock(btr_search_get_latch(index->id)); | 1867 | rw_lock_x_lock(btr_search_get_latch(index)); |
796 | 1891 | 1868 | ||
797 | 1892 | locked = TRUE; | 1869 | locked = TRUE; |
798 | 1893 | 1870 | ||
799 | @@ -1914,7 +1891,7 @@ | |||
800 | 1914 | mem_heap_free(heap); | 1891 | mem_heap_free(heap); |
801 | 1915 | } | 1892 | } |
802 | 1916 | if (locked) { | 1893 | if (locked) { |
804 | 1917 | rw_lock_x_unlock(btr_search_get_latch(index->id)); | 1894 | rw_lock_x_unlock(btr_search_get_latch(index)); |
805 | 1918 | } | 1895 | } |
806 | 1919 | } | 1896 | } |
807 | 1920 | 1897 | ||
808 | @@ -1945,7 +1922,7 @@ | |||
809 | 1945 | 1922 | ||
810 | 1946 | buf_pool_mutex_enter_all(); | 1923 | buf_pool_mutex_enter_all(); |
811 | 1947 | 1924 | ||
813 | 1948 | cell_count = hash_get_n_cells(btr_search_sys->hash_index[t]); | 1925 | cell_count = hash_get_n_cells(btr_search_sys->hash_tables[t]); |
814 | 1949 | 1926 | ||
815 | 1950 | for (i = 0; i < cell_count; i++) { | 1927 | for (i = 0; i < cell_count; i++) { |
816 | 1951 | /* We release btr_search_latch every once in a while to | 1928 | /* We release btr_search_latch every once in a while to |
817 | @@ -1959,7 +1936,7 @@ | |||
818 | 1959 | } | 1936 | } |
819 | 1960 | 1937 | ||
820 | 1961 | node = (ha_node_t*) | 1938 | node = (ha_node_t*) |
822 | 1962 | hash_get_nth_cell(btr_search_sys->hash_index[t], | 1939 | hash_get_nth_cell(btr_search_sys->hash_tables[t], |
823 | 1963 | i)->node; | 1940 | i)->node; |
824 | 1964 | 1941 | ||
825 | 1965 | for (; node != NULL; node = node->next) { | 1942 | for (; node != NULL; node = node->next) { |
826 | @@ -2075,7 +2052,7 @@ | |||
827 | 2075 | buf_pool_mutex_enter_all(); | 2052 | buf_pool_mutex_enter_all(); |
828 | 2076 | } | 2053 | } |
829 | 2077 | 2054 | ||
831 | 2078 | if (!ha_validate(btr_search_sys->hash_index[t], i, | 2055 | if (!ha_validate(btr_search_sys->hash_tables[t], i, |
832 | 2079 | end_index)) { | 2056 | end_index)) { |
833 | 2080 | ok = FALSE; | 2057 | ok = FALSE; |
834 | 2081 | } | 2058 | } |
835 | 2082 | 2059 | ||
836 | === modified file 'Percona-Server/storage/innobase/buf/buf0buf.cc' | |||
837 | --- Percona-Server/storage/innobase/buf/buf0buf.cc 2013-08-29 17:46:30 +0000 | |||
838 | +++ Percona-Server/storage/innobase/buf/buf0buf.cc 2013-09-02 14:08:46 +0000 | |||
839 | @@ -1013,7 +1013,6 @@ | |||
840 | 1013 | 1013 | ||
841 | 1014 | block->check_index_page_at_flush = FALSE; | 1014 | block->check_index_page_at_flush = FALSE; |
842 | 1015 | block->index = NULL; | 1015 | block->index = NULL; |
843 | 1016 | block->btr_search_latch = NULL; | ||
844 | 1017 | 1016 | ||
845 | 1018 | #ifdef UNIV_DEBUG | 1017 | #ifdef UNIV_DEBUG |
846 | 1019 | block->page.in_page_hash = FALSE; | 1018 | block->page.in_page_hash = FALSE; |
847 | @@ -2209,7 +2208,6 @@ | |||
848 | 2209 | { | 2208 | { |
849 | 2210 | block->check_index_page_at_flush = FALSE; | 2209 | block->check_index_page_at_flush = FALSE; |
850 | 2211 | block->index = NULL; | 2210 | block->index = NULL; |
851 | 2212 | block->btr_search_latch = NULL; | ||
852 | 2213 | 2211 | ||
853 | 2214 | block->n_hash_helps = 0; | 2212 | block->n_hash_helps = 0; |
854 | 2215 | block->n_fields = 1; | 2213 | block->n_fields = 1; |
855 | 2216 | 2214 | ||
856 | === modified file 'Percona-Server/storage/innobase/dict/dict0boot.cc' | |||
857 | --- Percona-Server/storage/innobase/dict/dict0boot.cc 2013-08-06 15:16:34 +0000 | |||
858 | +++ Percona-Server/storage/innobase/dict/dict0boot.cc 2013-09-02 14:08:46 +0000 | |||
859 | @@ -31,6 +31,7 @@ | |||
860 | 31 | 31 | ||
861 | 32 | #include "dict0crea.h" | 32 | #include "dict0crea.h" |
862 | 33 | #include "btr0btr.h" | 33 | #include "btr0btr.h" |
863 | 34 | #include "btr0sea.h" | ||
864 | 34 | #include "dict0load.h" | 35 | #include "dict0load.h" |
865 | 35 | #include "trx0trx.h" | 36 | #include "trx0trx.h" |
866 | 36 | #include "srv0srv.h" | 37 | #include "srv0srv.h" |
867 | @@ -331,6 +332,7 @@ | |||
868 | 331 | dict_mem_index_add_field(index, "NAME", 0); | 332 | dict_mem_index_add_field(index, "NAME", 0); |
869 | 332 | 333 | ||
870 | 333 | index->id = DICT_TABLES_ID; | 334 | index->id = DICT_TABLES_ID; |
871 | 335 | btr_search_index_init(index); | ||
872 | 334 | 336 | ||
873 | 335 | error = dict_index_add_to_cache(table, index, | 337 | error = dict_index_add_to_cache(table, index, |
874 | 336 | mtr_read_ulint(dict_hdr | 338 | mtr_read_ulint(dict_hdr |
875 | @@ -345,6 +347,7 @@ | |||
876 | 345 | dict_mem_index_add_field(index, "ID", 0); | 347 | dict_mem_index_add_field(index, "ID", 0); |
877 | 346 | 348 | ||
878 | 347 | index->id = DICT_TABLE_IDS_ID; | 349 | index->id = DICT_TABLE_IDS_ID; |
879 | 350 | btr_search_index_init(index); | ||
880 | 348 | error = dict_index_add_to_cache(table, index, | 351 | error = dict_index_add_to_cache(table, index, |
881 | 349 | mtr_read_ulint(dict_hdr | 352 | mtr_read_ulint(dict_hdr |
882 | 350 | + DICT_HDR_TABLE_IDS, | 353 | + DICT_HDR_TABLE_IDS, |
883 | @@ -377,6 +380,7 @@ | |||
884 | 377 | dict_mem_index_add_field(index, "POS", 0); | 380 | dict_mem_index_add_field(index, "POS", 0); |
885 | 378 | 381 | ||
886 | 379 | index->id = DICT_COLUMNS_ID; | 382 | index->id = DICT_COLUMNS_ID; |
887 | 383 | btr_search_index_init(index); | ||
888 | 380 | error = dict_index_add_to_cache(table, index, | 384 | error = dict_index_add_to_cache(table, index, |
889 | 381 | mtr_read_ulint(dict_hdr | 385 | mtr_read_ulint(dict_hdr |
890 | 382 | + DICT_HDR_COLUMNS, | 386 | + DICT_HDR_COLUMNS, |
891 | @@ -409,6 +413,7 @@ | |||
892 | 409 | dict_mem_index_add_field(index, "ID", 0); | 413 | dict_mem_index_add_field(index, "ID", 0); |
893 | 410 | 414 | ||
894 | 411 | index->id = DICT_INDEXES_ID; | 415 | index->id = DICT_INDEXES_ID; |
895 | 416 | btr_search_index_init(index); | ||
896 | 412 | error = dict_index_add_to_cache(table, index, | 417 | error = dict_index_add_to_cache(table, index, |
897 | 413 | mtr_read_ulint(dict_hdr | 418 | mtr_read_ulint(dict_hdr |
898 | 414 | + DICT_HDR_INDEXES, | 419 | + DICT_HDR_INDEXES, |
899 | @@ -437,6 +442,7 @@ | |||
900 | 437 | dict_mem_index_add_field(index, "POS", 0); | 442 | dict_mem_index_add_field(index, "POS", 0); |
901 | 438 | 443 | ||
902 | 439 | index->id = DICT_FIELDS_ID; | 444 | index->id = DICT_FIELDS_ID; |
903 | 445 | btr_search_index_init(index); | ||
904 | 440 | error = dict_index_add_to_cache(table, index, | 446 | error = dict_index_add_to_cache(table, index, |
905 | 441 | mtr_read_ulint(dict_hdr | 447 | mtr_read_ulint(dict_hdr |
906 | 442 | + DICT_HDR_FIELDS, | 448 | + DICT_HDR_FIELDS, |
907 | 443 | 449 | ||
908 | === modified file 'Percona-Server/storage/innobase/dict/dict0dict.cc' | |||
909 | --- Percona-Server/storage/innobase/dict/dict0dict.cc 2013-08-29 17:05:40 +0000 | |||
910 | +++ Percona-Server/storage/innobase/dict/dict0dict.cc 2013-09-02 14:08:46 +0000 | |||
911 | @@ -1208,8 +1208,7 @@ | |||
912 | 1208 | 1208 | ||
913 | 1209 | See also: dict_index_remove_from_cache_low() */ | 1209 | See also: dict_index_remove_from_cache_low() */ |
914 | 1210 | 1210 | ||
917 | 1211 | if (btr_search_info_get_ref_count(info, index->id) | 1211 | if (btr_search_info_get_ref_count(info, index) > 0) { |
916 | 1212 | > 0) { | ||
918 | 1213 | return(FALSE); | 1212 | return(FALSE); |
919 | 1214 | } | 1213 | } |
920 | 1215 | } | 1214 | } |
921 | @@ -2485,7 +2484,7 @@ | |||
922 | 2485 | 2484 | ||
923 | 2486 | do { | 2485 | do { |
924 | 2487 | ulint ref_count = btr_search_info_get_ref_count(info, | 2486 | ulint ref_count = btr_search_info_get_ref_count(info, |
926 | 2488 | index->id); | 2487 | index); |
927 | 2489 | 2488 | ||
928 | 2490 | if (ref_count == 0) { | 2489 | if (ref_count == 0) { |
929 | 2491 | break; | 2490 | break; |
930 | @@ -2777,6 +2776,7 @@ | |||
931 | 2777 | new_index->n_user_defined_cols = index->n_fields; | 2776 | new_index->n_user_defined_cols = index->n_fields; |
932 | 2778 | 2777 | ||
933 | 2779 | new_index->id = index->id; | 2778 | new_index->id = index->id; |
934 | 2779 | btr_search_index_init(new_index); | ||
935 | 2780 | 2780 | ||
936 | 2781 | /* Copy the fields of index */ | 2781 | /* Copy the fields of index */ |
937 | 2782 | dict_index_copy(new_index, index, table, 0, index->n_fields); | 2782 | dict_index_copy(new_index, index, table, 0, index->n_fields); |
938 | @@ -2948,6 +2948,7 @@ | |||
939 | 2948 | new_index->n_user_defined_cols = index->n_fields; | 2948 | new_index->n_user_defined_cols = index->n_fields; |
940 | 2949 | 2949 | ||
941 | 2950 | new_index->id = index->id; | 2950 | new_index->id = index->id; |
942 | 2951 | btr_search_index_init(new_index); | ||
943 | 2951 | 2952 | ||
944 | 2952 | /* Copy fields from index to new_index */ | 2953 | /* Copy fields from index to new_index */ |
945 | 2953 | dict_index_copy(new_index, index, table, 0, index->n_fields); | 2954 | dict_index_copy(new_index, index, table, 0, index->n_fields); |
946 | @@ -3031,6 +3032,7 @@ | |||
947 | 3031 | new_index->n_user_defined_cols = index->n_fields; | 3032 | new_index->n_user_defined_cols = index->n_fields; |
948 | 3032 | 3033 | ||
949 | 3033 | new_index->id = index->id; | 3034 | new_index->id = index->id; |
950 | 3035 | btr_search_index_init(new_index); | ||
951 | 3034 | 3036 | ||
952 | 3035 | /* Copy fields from index to new_index */ | 3037 | /* Copy fields from index to new_index */ |
953 | 3036 | dict_index_copy(new_index, index, table, 0, index->n_fields); | 3038 | dict_index_copy(new_index, index, table, 0, index->n_fields); |
954 | 3037 | 3039 | ||
955 | === modified file 'Percona-Server/storage/innobase/dict/dict0load.cc' | |||
956 | --- Percona-Server/storage/innobase/dict/dict0load.cc 2013-08-14 03:57:21 +0000 | |||
957 | +++ Percona-Server/storage/innobase/dict/dict0load.cc 2013-09-02 14:08:46 +0000 | |||
958 | @@ -1748,6 +1748,7 @@ | |||
959 | 1748 | 1748 | ||
960 | 1749 | (*index)->id = id; | 1749 | (*index)->id = id; |
961 | 1750 | (*index)->page = mach_read_from_4(field); | 1750 | (*index)->page = mach_read_from_4(field); |
962 | 1751 | btr_search_index_init(*index); | ||
963 | 1751 | ut_ad((*index)->page); | 1752 | ut_ad((*index)->page); |
964 | 1752 | 1753 | ||
965 | 1753 | return(NULL); | 1754 | return(NULL); |
966 | 1754 | 1755 | ||
967 | === modified file 'Percona-Server/storage/innobase/ha/ha0ha.cc' | |||
968 | --- Percona-Server/storage/innobase/ha/ha0ha.cc 2013-08-29 17:05:40 +0000 | |||
969 | +++ Percona-Server/storage/innobase/ha/ha0ha.cc 2013-09-02 14:08:46 +0000 | |||
970 | @@ -113,13 +113,13 @@ | |||
971 | 113 | ut_ad(table->adaptive); | 113 | ut_ad(table->adaptive); |
972 | 114 | 114 | ||
973 | 115 | for (i = 0; i < btr_search_index_num; i++) { | 115 | for (i = 0; i < btr_search_index_num; i++) { |
975 | 116 | if (btr_search_sys->hash_index[i] == table) { | 116 | if (btr_search_sys->hash_tables[i] == table) { |
976 | 117 | break; | 117 | break; |
977 | 118 | } | 118 | } |
978 | 119 | } | 119 | } |
979 | 120 | 120 | ||
980 | 121 | ut_ad(i < btr_search_index_num); | 121 | ut_ad(i < btr_search_index_num); |
982 | 122 | ut_ad(rw_lock_own(btr_search_latch_arr[i], RW_LOCK_EX)); | 122 | ut_ad(rw_lock_own(&btr_search_latch_arr[i], RW_LOCK_EX)); |
983 | 123 | 123 | ||
984 | 124 | return(true); | 124 | return(true); |
985 | 125 | } | 125 | } |
986 | 126 | 126 | ||
987 | === modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc' | |||
988 | --- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-08-29 17:46:30 +0000 | |||
989 | +++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-02 14:08:46 +0000 | |||
990 | @@ -1473,20 +1473,21 @@ | |||
991 | 1473 | } | 1473 | } |
992 | 1474 | 1474 | ||
993 | 1475 | /********************************************************************//** | 1475 | /********************************************************************//** |
998 | 1476 | Call this function when mysqld passes control to the client. That is to | 1476 | In XtraDB it is impossible for a transaction to own a search latch outside of |
999 | 1477 | avoid deadlocks on the adaptive hash S-latch possibly held by thd. For more | 1477 | InnoDB code, so there is nothing to release on demand. We keep this function to |
1000 | 1478 | documentation, see handler.cc. | 1478 | simplify maintenance. |
1001 | 1479 | @return 0 */ | 1479 | @return 0 */ |
1002 | 1480 | static | 1480 | static |
1003 | 1481 | int | 1481 | int |
1004 | 1482 | innobase_release_temporary_latches( | 1482 | innobase_release_temporary_latches( |
1005 | 1483 | /*===============================*/ | 1483 | /*===============================*/ |
1008 | 1484 | handlerton* hton, /*!< in: handlerton */ | 1484 | handlerton* hton __attribute__((unused)), /*!< in: handlerton */ |
1009 | 1485 | THD* thd) /*!< in: MySQL thread */ | 1485 | THD* thd __attribute__((unused))) /*!< in: MySQL thread */ |
1010 | 1486 | { | 1486 | { |
1011 | 1487 | #ifdef UNIV_DEBUG | ||
1012 | 1487 | DBUG_ASSERT(hton == innodb_hton_ptr); | 1488 | DBUG_ASSERT(hton == innodb_hton_ptr); |
1013 | 1488 | 1489 | ||
1015 | 1489 | if (!innodb_inited) { | 1490 | if (!innodb_inited || thd == NULL) { |
1016 | 1490 | 1491 | ||
1017 | 1491 | return(0); | 1492 | return(0); |
1018 | 1492 | } | 1493 | } |
1019 | @@ -1494,8 +1495,12 @@ | |||
1020 | 1494 | trx_t* trx = thd_to_trx(thd); | 1495 | trx_t* trx = thd_to_trx(thd); |
1021 | 1495 | 1496 | ||
1022 | 1496 | if (trx != NULL) { | 1497 | if (trx != NULL) { |
1023 | 1498 | #ifdef UNIV_SYNC_DEBUG | ||
1024 | 1499 | ut_ad(!btr_search_own_any()); | ||
1025 | 1500 | #endif | ||
1026 | 1497 | trx_search_latch_release_if_reserved(trx); | 1501 | trx_search_latch_release_if_reserved(trx); |
1027 | 1498 | } | 1502 | } |
1028 | 1503 | #endif | ||
1029 | 1499 | 1504 | ||
1030 | 1500 | return(0); | 1505 | return(0); |
1031 | 1501 | } | 1506 | } |
1032 | @@ -3772,9 +3777,8 @@ | |||
1033 | 3772 | /* Since we will reserve the trx_sys->mutex, we have to release | 3777 | /* Since we will reserve the trx_sys->mutex, we have to release |
1034 | 3773 | the search system latch first to obey the latching order. */ | 3778 | the search system latch first to obey the latching order. */ |
1035 | 3774 | 3779 | ||
1039 | 3775 | if (trx->has_search_latch) { | 3780 | /* No-op in XtraDB */ |
1040 | 3776 | trx_search_latch_release_if_reserved(trx); | 3781 | trx_search_latch_release_if_reserved(trx); |
1038 | 3777 | } | ||
1041 | 3778 | 3782 | ||
1042 | 3779 | if (trx->fake_changes && | 3783 | if (trx->fake_changes && |
1043 | 3780 | (commit_trx || | 3784 | (commit_trx || |
1044 | @@ -4972,12 +4976,8 @@ | |||
1045 | 4972 | 4976 | ||
1046 | 4973 | thd = ha_thd(); | 4977 | thd = ha_thd(); |
1047 | 4974 | 4978 | ||
1054 | 4975 | /* Under some cases MySQL seems to call this function while | 4979 | /* No-op in XtraDB */ |
1055 | 4976 | holding btr_search_latch. This breaks the latching order as | 4980 | innobase_release_temporary_latches(ht, thd); |
1050 | 4977 | we acquire dict_sys->mutex below and leads to a deadlock. */ | ||
1051 | 4978 | if (thd != NULL) { | ||
1052 | 4979 | innobase_release_temporary_latches(ht, thd); | ||
1053 | 4980 | } | ||
1056 | 4981 | 4981 | ||
1057 | 4982 | normalize_table_name(norm_name, name); | 4982 | normalize_table_name(norm_name, name); |
1058 | 4983 | 4983 | ||
1059 | @@ -5398,9 +5398,9 @@ | |||
1060 | 5398 | DBUG_ENTER("ha_innobase::close"); | 5398 | DBUG_ENTER("ha_innobase::close"); |
1061 | 5399 | 5399 | ||
1062 | 5400 | thd = ha_thd(); | 5400 | thd = ha_thd(); |
1066 | 5401 | if (thd != NULL) { | 5401 | |
1067 | 5402 | innobase_release_temporary_latches(ht, thd); | 5402 | /* No-op in XtraDB */ |
1068 | 5403 | } | 5403 | innobase_release_temporary_latches(ht, thd); |
1069 | 5404 | 5404 | ||
1070 | 5405 | row_prebuilt_free(prebuilt, FALSE); | 5405 | row_prebuilt_free(prebuilt, FALSE); |
1071 | 5406 | 5406 | ||
1072 | @@ -16398,6 +16398,8 @@ | |||
1073 | 16398 | "Disable with --skip-innodb-adaptive-hash-index.", | 16398 | "Disable with --skip-innodb-adaptive-hash-index.", |
1074 | 16399 | NULL, innodb_adaptive_hash_index_update, TRUE); | 16399 | NULL, innodb_adaptive_hash_index_update, TRUE); |
1075 | 16400 | 16400 | ||
1076 | 16401 | /* btr_search_index_num is constrained to machine word size for historical | ||
1077 | 16402 | reasons. This limitation can be easily removed later. */ | ||
1078 | 16401 | static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num, | 16403 | static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num, |
1079 | 16402 | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, | 16404 | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, |
1080 | 16403 | "Number of InnoDB adaptive hash index partitions (default 1: disable " | 16405 | "Number of InnoDB adaptive hash index partitions (default 1: disable " |
1081 | 16404 | 16406 | ||
1082 | === modified file 'Percona-Server/storage/innobase/handler/xtradb_i_s.cc' | |||
1083 | --- Percona-Server/storage/innobase/handler/xtradb_i_s.cc 2013-08-29 17:05:40 +0000 | |||
1084 | +++ Percona-Server/storage/innobase/handler/xtradb_i_s.cc 2013-09-02 14:08:46 +0000 | |||
1085 | @@ -309,9 +309,11 @@ | |||
1086 | 309 | 309 | ||
1087 | 310 | static int xtradb_internal_hash_tables_fill_table(THD* thd, TABLE_LIST* tables, Item*) | 310 | static int xtradb_internal_hash_tables_fill_table(THD* thd, TABLE_LIST* tables, Item*) |
1088 | 311 | { | 311 | { |
1092 | 312 | const char* table_name; | 312 | const char* table_name; |
1093 | 313 | Field** fields; | 313 | Field** fields; |
1094 | 314 | TABLE* table; | 314 | TABLE* table; |
1095 | 315 | ulong btr_search_sys_constant; | ||
1096 | 316 | ulong btr_search_sys_variable; | ||
1097 | 315 | 317 | ||
1098 | 316 | DBUG_ENTER("xtradb_internal_hash_tables_fill_table"); | 318 | DBUG_ENTER("xtradb_internal_hash_tables_fill_table"); |
1099 | 317 | 319 | ||
1100 | @@ -327,38 +329,38 @@ | |||
1101 | 327 | 329 | ||
1102 | 328 | RETURN_IF_INNODB_NOT_STARTED(table_name); | 330 | RETURN_IF_INNODB_NOT_STARTED(table_name); |
1103 | 329 | 331 | ||
1134 | 330 | if (btr_search_sys) | 332 | /* Calculate AHI constant and variable memory allocations */ |
1135 | 331 | { | 333 | |
1136 | 332 | ulint btr_search_sys_subtotal; | 334 | btr_search_sys_constant = 0; |
1137 | 333 | const hash_table_t* hash_index_0 | 335 | btr_search_sys_variable = 0; |
1138 | 334 | = btr_search_sys->hash_index[0]; | 336 | |
1139 | 335 | 337 | ut_ad(btr_search_sys->hash_tables); | |
1140 | 336 | if (hash_index_0->heap) { | 338 | |
1141 | 337 | btr_search_sys_subtotal | 339 | for (ulint i = 0; i < btr_search_index_num; i++) { |
1142 | 338 | = mem_heap_get_size(hash_index_0->heap); | 340 | hash_table_t* ht = btr_search_sys->hash_tables[i]; |
1143 | 339 | } else { | 341 | |
1144 | 340 | for (ulint i = 0; i < hash_index_0->n_sync_obj; i++) { | 342 | ut_ad(ht); |
1145 | 341 | btr_search_sys_subtotal | 343 | ut_ad(ht->heap); |
1146 | 342 | += mem_heap_get_size(hash_index_0 | 344 | |
1147 | 343 | ->heaps[i]); | 345 | /* Multiple mutexes/heaps are currently never used for adaptive |
1148 | 344 | } | 346 | hash index tables. */ |
1149 | 345 | } | 347 | ut_ad(!ht->n_sync_obj); |
1150 | 346 | btr_search_sys_subtotal *= btr_search_index_num; | 348 | ut_ad(!ht->heaps); |
1151 | 347 | 349 | ||
1152 | 348 | OK(field_store_string(fields[INT_HASH_TABLES_NAME], | 350 | btr_search_sys_variable += mem_heap_get_size(ht->heap); |
1153 | 349 | "Adaptive hash index")); | 351 | btr_search_sys_constant += ht->n_cells * sizeof(hash_cell_t); |
1124 | 350 | OK(field_store_ulint(fields[INT_HASH_TABLES_TOTAL], | ||
1125 | 351 | btr_search_sys_subtotal | ||
1126 | 352 | + (hash_index_0->n_cells | ||
1127 | 353 | * sizeof(hash_cell_t)))); | ||
1128 | 354 | OK(field_store_ulint(fields[INT_HASH_TABLES_CONSTANT], | ||
1129 | 355 | (hash_index_0->n_cells | ||
1130 | 356 | * sizeof(hash_cell_t)))); | ||
1131 | 357 | OK(field_store_ulint(fields[INT_HASH_TABLES_VARIABLE], | ||
1132 | 358 | btr_search_sys_subtotal)); | ||
1133 | 359 | OK(schema_table_store_record(thd, table)); | ||
1154 | 360 | } | 352 | } |
1155 | 361 | 353 | ||
1156 | 354 | OK(field_store_string(fields[INT_HASH_TABLES_NAME], | ||
1157 | 355 | "Adaptive hash index")); | ||
1158 | 356 | OK(field_store_ulint(fields[INT_HASH_TABLES_TOTAL], | ||
1159 | 357 | btr_search_sys_variable + btr_search_sys_constant)); | ||
1160 | 358 | OK(field_store_ulint(fields[INT_HASH_TABLES_CONSTANT], | ||
1161 | 359 | btr_search_sys_constant)); | ||
1162 | 360 | OK(field_store_ulint(fields[INT_HASH_TABLES_VARIABLE], | ||
1163 | 361 | btr_search_sys_variable)); | ||
1164 | 362 | OK(schema_table_store_record(thd, table)); | ||
1165 | 363 | |||
1166 | 362 | { | 364 | { |
1167 | 363 | OK(field_store_string(fields[INT_HASH_TABLES_NAME], | 365 | OK(field_store_string(fields[INT_HASH_TABLES_NAME], |
1168 | 364 | "Page hash (buffer pool 0 only)")); | 366 | "Page hash (buffer pool 0 only)")); |
1169 | 365 | 367 | ||
1170 | === modified file 'Percona-Server/storage/innobase/ibuf/ibuf0ibuf.cc' | |||
1171 | --- Percona-Server/storage/innobase/ibuf/ibuf0ibuf.cc 2013-08-14 03:57:21 +0000 | |||
1172 | +++ Percona-Server/storage/innobase/ibuf/ibuf0ibuf.cc 2013-09-02 14:08:46 +0000 | |||
1173 | @@ -52,6 +52,7 @@ | |||
1174 | 52 | #include "btr0cur.h" | 52 | #include "btr0cur.h" |
1175 | 53 | #include "btr0pcur.h" | 53 | #include "btr0pcur.h" |
1176 | 54 | #include "btr0btr.h" | 54 | #include "btr0btr.h" |
1177 | 55 | #include "btr0sea.h" | ||
1178 | 55 | #include "row0upd.h" | 56 | #include "row0upd.h" |
1179 | 56 | #include "sync0sync.h" | 57 | #include "sync0sync.h" |
1180 | 57 | #include "dict0boot.h" | 58 | #include "dict0boot.h" |
1181 | @@ -626,6 +627,7 @@ | |||
1182 | 626 | dict_mem_index_add_field(index, "DUMMY_COLUMN", 0); | 627 | dict_mem_index_add_field(index, "DUMMY_COLUMN", 0); |
1183 | 627 | 628 | ||
1184 | 628 | index->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID; | 629 | index->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID; |
1185 | 630 | btr_search_index_init(index); | ||
1186 | 629 | 631 | ||
1187 | 630 | error = dict_index_add_to_cache(table, index, | 632 | error = dict_index_add_to_cache(table, index, |
1188 | 631 | FSP_IBUF_TREE_ROOT_PAGE_NO, FALSE); | 633 | FSP_IBUF_TREE_ROOT_PAGE_NO, FALSE); |
1189 | 632 | 634 | ||
1190 | === modified file 'Percona-Server/storage/innobase/include/btr0sea.h' | |||
1191 | --- Percona-Server/storage/innobase/include/btr0sea.h 2013-08-29 17:05:40 +0000 | |||
1192 | +++ Percona-Server/storage/innobase/include/btr0sea.h 2013-09-02 14:08:46 +0000 | |||
1193 | @@ -87,7 +87,7 @@ | |||
1194 | 87 | btr_search_info_get_ref_count( | 87 | btr_search_info_get_ref_count( |
1195 | 88 | /*==========================*/ | 88 | /*==========================*/ |
1196 | 89 | btr_search_t* info, /*!< in: search info. */ | 89 | btr_search_t* info, /*!< in: search info. */ |
1198 | 90 | index_id_t key); /*!< in: id of the index owning search info */ | 90 | dict_index_t* index); /*!< in: index */ |
1199 | 91 | /*********************************************************************//** | 91 | /*********************************************************************//** |
1200 | 92 | Updates the search info. */ | 92 | Updates the search info. */ |
1201 | 93 | UNIV_INLINE | 93 | UNIV_INLINE |
1202 | @@ -199,9 +199,9 @@ | |||
1203 | 199 | @return the adaptive hash index table for a given index key */ | 199 | @return the adaptive hash index table for a given index key */ |
1204 | 200 | UNIV_INLINE | 200 | UNIV_INLINE |
1205 | 201 | hash_table_t* | 201 | hash_table_t* |
1207 | 202 | btr_search_get_hash_index( | 202 | btr_search_get_hash_table( |
1208 | 203 | /*======================*/ | 203 | /*======================*/ |
1210 | 204 | index_id_t key) /*!< in: index key */ | 204 | const dict_index_t* index) /*!< in: index */ |
1211 | 205 | __attribute__((pure,warn_unused_result)); | 205 | __attribute__((pure,warn_unused_result)); |
1212 | 206 | 206 | ||
1213 | 207 | /********************************************************************//** | 207 | /********************************************************************//** |
1214 | @@ -211,8 +211,26 @@ | |||
1215 | 211 | rw_lock_t* | 211 | rw_lock_t* |
1216 | 212 | btr_search_get_latch( | 212 | btr_search_get_latch( |
1217 | 213 | /*=================*/ | 213 | /*=================*/ |
1220 | 214 | index_id_t key) /*!< in: index key */ | 214 | const dict_index_t* index) /*!< in: index */ |
1221 | 215 | __attribute__((pure,warn_unused_result)); | 215 | __attribute__((pure,warn_unused_result)); |
1222 | 216 | |||
1223 | 217 | /*********************************************************************//** | ||
1224 | 218 | Returns the AHI partition number corresponding to a give index ID. */ | ||
1225 | 219 | UNIV_INLINE | ||
1226 | 220 | ulint | ||
1227 | 221 | btr_search_get_key( | ||
1228 | 222 | /*===============*/ | ||
1229 | 223 | index_id_t index_id) /*!< in: index ID */ | ||
1230 | 224 | __attribute__((pure,warn_unused_result)); | ||
1231 | 225 | |||
1232 | 226 | /*********************************************************************//** | ||
1233 | 227 | Initializes AHI-related fields in a newly created index. */ | ||
1234 | 228 | UNIV_INLINE | ||
1235 | 229 | void | ||
1236 | 230 | btr_search_index_init( | ||
1237 | 231 | /*===============*/ | ||
1238 | 232 | dict_index_t* index) /*!< in: index */ | ||
1239 | 233 | __attribute__((nonnull)); | ||
1240 | 216 | 234 | ||
1241 | 217 | /********************************************************************//** | 235 | /********************************************************************//** |
1242 | 218 | Latches all adaptive hash index latches in exclusive mode. */ | 236 | Latches all adaptive hash index latches in exclusive mode. */ |
1243 | @@ -241,7 +259,15 @@ | |||
1244 | 241 | /*===============*/ | 259 | /*===============*/ |
1245 | 242 | ulint lock_type) | 260 | ulint lock_type) |
1246 | 243 | __attribute__((warn_unused_result)); | 261 | __attribute__((warn_unused_result)); |
1248 | 244 | #endif /* UNIV_SYNC_DEBUG */ | 262 | /********************************************************************//** |
1249 | 263 | Checks if the thread owns any adaptive hash latches in either S or X mode. | ||
1250 | 264 | @return true if the thread owns at least one latch in any mode. */ | ||
1251 | 265 | UNIV_INLINE | ||
1252 | 266 | bool | ||
1253 | 267 | btr_search_own_any(void) | ||
1254 | 268 | /*=====================*/ | ||
1255 | 269 | __attribute__((warn_unused_result)); | ||
1256 | 270 | #endif | ||
1257 | 245 | 271 | ||
1258 | 246 | /** The search info struct in an index */ | 272 | /** The search info struct in an index */ |
1259 | 247 | struct btr_search_t{ | 273 | struct btr_search_t{ |
1260 | @@ -300,9 +326,9 @@ | |||
1261 | 300 | 326 | ||
1262 | 301 | /** The hash index system */ | 327 | /** The hash index system */ |
1263 | 302 | struct btr_search_sys_t{ | 328 | struct btr_search_sys_t{ |
1267 | 303 | hash_table_t** hash_index; /*!< the adaptive hash index, | 329 | hash_table_t** hash_tables; /*!< the array of adaptive hash index |
1268 | 304 | mapping dtuple_fold values | 330 | tables, mapping dtuple_fold values to |
1269 | 305 | to rec_t pointers on index pages */ | 331 | rec_t pointers on index pages */ |
1270 | 306 | }; | 332 | }; |
1271 | 307 | 333 | ||
1272 | 308 | /** The adaptive hash index */ | 334 | /** The adaptive hash index */ |
1273 | 309 | 335 | ||
1274 | === modified file 'Percona-Server/storage/innobase/include/btr0sea.ic' | |||
1275 | --- Percona-Server/storage/innobase/include/btr0sea.ic 2013-08-29 17:05:40 +0000 | |||
1276 | +++ Percona-Server/storage/innobase/include/btr0sea.ic 2013-09-02 14:08:46 +0000 | |||
1277 | @@ -60,8 +60,8 @@ | |||
1278 | 60 | btr_search_t* info; | 60 | btr_search_t* info; |
1279 | 61 | 61 | ||
1280 | 62 | #ifdef UNIV_SYNC_DEBUG | 62 | #ifdef UNIV_SYNC_DEBUG |
1283 | 63 | ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_SHARED)); | 63 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_SHARED)); |
1284 | 64 | ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_EX)); | 64 | ut_ad(!rw_lock_own(btr_search_get_latch(index), RW_LOCK_EX)); |
1285 | 65 | #endif /* UNIV_SYNC_DEBUG */ | 65 | #endif /* UNIV_SYNC_DEBUG */ |
1286 | 66 | 66 | ||
1287 | 67 | info = btr_search_get_info(index); | 67 | info = btr_search_get_info(index); |
1288 | @@ -86,11 +86,14 @@ | |||
1289 | 86 | @return the adaptive hash index table for a given index key */ | 86 | @return the adaptive hash index table for a given index key */ |
1290 | 87 | UNIV_INLINE | 87 | UNIV_INLINE |
1291 | 88 | hash_table_t* | 88 | hash_table_t* |
1293 | 89 | btr_search_get_hash_index( | 89 | btr_search_get_hash_table( |
1294 | 90 | /*======================*/ | 90 | /*======================*/ |
1296 | 91 | index_id_t key) /*!< in: index key */ | 91 | const dict_index_t* index) /*!< in: index */ |
1297 | 92 | { | 92 | { |
1299 | 93 | return(btr_search_sys->hash_index[key % btr_search_index_num]); | 93 | ut_ad(index); |
1300 | 94 | ut_ad(index->search_table); | ||
1301 | 95 | |||
1302 | 96 | return(index->search_table); | ||
1303 | 94 | } | 97 | } |
1304 | 95 | 98 | ||
1305 | 96 | /********************************************************************//** | 99 | /********************************************************************//** |
1306 | @@ -100,9 +103,41 @@ | |||
1307 | 100 | rw_lock_t* | 103 | rw_lock_t* |
1308 | 101 | btr_search_get_latch( | 104 | btr_search_get_latch( |
1309 | 102 | /*=================*/ | 105 | /*=================*/ |
1313 | 103 | index_id_t key) /*!< in: index key */ | 106 | const dict_index_t* index) /*!< in: index */ |
1314 | 104 | { | 107 | { |
1315 | 105 | return(btr_search_latch_arr[key % btr_search_index_num]); | 108 | ut_ad(index); |
1316 | 109 | ut_ad(index->search_latch >= btr_search_latch_arr && | ||
1317 | 110 | index->search_latch < btr_search_latch_arr + | ||
1318 | 111 | btr_search_index_num); | ||
1319 | 112 | |||
1320 | 113 | return(index->search_latch); | ||
1321 | 114 | } | ||
1322 | 115 | |||
1323 | 116 | /*********************************************************************//** | ||
1324 | 117 | Returns the AHI partition number corresponding to a give index ID. */ | ||
1325 | 118 | UNIV_INLINE | ||
1326 | 119 | ulint | ||
1327 | 120 | btr_search_get_key( | ||
1328 | 121 | /*===============*/ | ||
1329 | 122 | index_id_t index_id) /*!< in: index ID */ | ||
1330 | 123 | { | ||
1331 | 124 | return(index_id % btr_search_index_num); | ||
1332 | 125 | } | ||
1333 | 126 | |||
1334 | 127 | /*********************************************************************//** | ||
1335 | 128 | Initializes AHI-related fields in a newly created index. */ | ||
1336 | 129 | UNIV_INLINE | ||
1337 | 130 | void | ||
1338 | 131 | btr_search_index_init( | ||
1339 | 132 | /*===============*/ | ||
1340 | 133 | dict_index_t* index) /*!< in: index */ | ||
1341 | 134 | { | ||
1342 | 135 | ut_ad(index); | ||
1343 | 136 | |||
1344 | 137 | index->search_latch = | ||
1345 | 138 | &btr_search_latch_arr[btr_search_get_key(index->id)]; | ||
1346 | 139 | index->search_table = | ||
1347 | 140 | btr_search_sys->hash_tables[btr_search_get_key(index->id)]; | ||
1348 | 106 | } | 141 | } |
1349 | 107 | 142 | ||
1350 | 108 | /********************************************************************//** | 143 | /********************************************************************//** |
1351 | @@ -115,7 +150,7 @@ | |||
1352 | 115 | ulint i; | 150 | ulint i; |
1353 | 116 | 151 | ||
1354 | 117 | for (i = 0; i < btr_search_index_num; i++) { | 152 | for (i = 0; i < btr_search_index_num; i++) { |
1356 | 118 | rw_lock_x_lock(btr_search_latch_arr[i]); | 153 | rw_lock_x_lock(&btr_search_latch_arr[i]); |
1357 | 119 | } | 154 | } |
1358 | 120 | } | 155 | } |
1359 | 121 | 156 | ||
1360 | @@ -129,7 +164,7 @@ | |||
1361 | 129 | ulint i; | 164 | ulint i; |
1362 | 130 | 165 | ||
1363 | 131 | for (i = 0; i < btr_search_index_num; i++) { | 166 | for (i = 0; i < btr_search_index_num; i++) { |
1365 | 132 | rw_lock_x_unlock(btr_search_latch_arr[i]); | 167 | rw_lock_x_unlock(&btr_search_latch_arr[i]); |
1366 | 133 | } | 168 | } |
1367 | 134 | } | 169 | } |
1368 | 135 | 170 | ||
1369 | @@ -149,11 +184,31 @@ | |||
1370 | 149 | ulint i; | 184 | ulint i; |
1371 | 150 | 185 | ||
1372 | 151 | for (i = 0; i < btr_search_index_num; i++) { | 186 | for (i = 0; i < btr_search_index_num; i++) { |
1374 | 152 | if (!rw_lock_own(btr_search_latch_arr[i], lock_type)) { | 187 | if (!rw_lock_own(&btr_search_latch_arr[i], lock_type)) { |
1375 | 153 | return(false); | 188 | return(false); |
1376 | 154 | } | 189 | } |
1377 | 155 | } | 190 | } |
1378 | 156 | 191 | ||
1379 | 157 | return(true); | 192 | return(true); |
1380 | 158 | } | 193 | } |
1381 | 194 | |||
1382 | 195 | /********************************************************************//** | ||
1383 | 196 | Checks if the thread owns any adaptive hash latches in either S or X mode. | ||
1384 | 197 | @return true if the thread owns at least one latch in any mode. */ | ||
1385 | 198 | UNIV_INLINE | ||
1386 | 199 | bool | ||
1387 | 200 | btr_search_own_any(void) | ||
1388 | 201 | /*====================*/ | ||
1389 | 202 | { | ||
1390 | 203 | ulint i; | ||
1391 | 204 | |||
1392 | 205 | for (i = 0; i < btr_search_index_num; i++) { | ||
1393 | 206 | if (rw_lock_own(&btr_search_latch_arr[i], RW_LOCK_SHARED) || | ||
1394 | 207 | rw_lock_own(&btr_search_latch_arr[i], RW_LOCK_EX)) { | ||
1395 | 208 | return(true); | ||
1396 | 209 | } | ||
1397 | 210 | } | ||
1398 | 211 | |||
1399 | 212 | return(false); | ||
1400 | 213 | } | ||
1401 | 159 | #endif /* UNIV_SYNC_DEBUG */ | 214 | #endif /* UNIV_SYNC_DEBUG */ |
1402 | 160 | 215 | ||
1403 | === modified file 'Percona-Server/storage/innobase/include/btr0types.h' | |||
1404 | --- Percona-Server/storage/innobase/include/btr0types.h 2013-08-29 17:05:40 +0000 | |||
1405 | +++ Percona-Server/storage/innobase/include/btr0types.h 2013-09-02 14:08:46 +0000 | |||
1406 | @@ -41,20 +41,21 @@ | |||
1407 | 41 | 41 | ||
1408 | 42 | #ifndef UNIV_HOTBACKUP | 42 | #ifndef UNIV_HOTBACKUP |
1409 | 43 | 43 | ||
1411 | 44 | /** @brief The latch protecting the adaptive search system | 44 | /** @brief The array of latches protecting the adaptive search partitions |
1412 | 45 | 45 | ||
1415 | 46 | This latch protects the | 46 | These latch protect the |
1416 | 47 | (1) hash index; | 47 | (1) hash index from the corresponding AHI partition; |
1417 | 48 | (2) columns of a record to which we have a pointer in the hash index; | 48 | (2) columns of a record to which we have a pointer in the hash index; |
1418 | 49 | 49 | ||
1420 | 50 | but does NOT protect: | 50 | but do NOT protect: |
1421 | 51 | 51 | ||
1422 | 52 | (3) next record offset field in a record; | 52 | (3) next record offset field in a record; |
1423 | 53 | (4) next or previous records on the same page. | 53 | (4) next or previous records on the same page. |
1424 | 54 | 54 | ||
1426 | 55 | Bear in mind (3) and (4) when using the hash index. | 55 | Bear in mind (3) and (4) when using the hash indexes. |
1427 | 56 | */ | 56 | */ |
1429 | 57 | extern rw_lock_t** btr_search_latch_arr; | 57 | |
1430 | 58 | extern rw_lock_t* btr_search_latch_arr; | ||
1431 | 58 | 59 | ||
1432 | 59 | #endif /* UNIV_HOTBACKUP */ | 60 | #endif /* UNIV_HOTBACKUP */ |
1433 | 60 | 61 | ||
1434 | 61 | 62 | ||
1435 | === modified file 'Percona-Server/storage/innobase/include/buf0buf.h' | |||
1436 | --- Percona-Server/storage/innobase/include/buf0buf.h 2013-08-29 17:46:30 +0000 | |||
1437 | +++ Percona-Server/storage/innobase/include/buf0buf.h 2013-09-02 14:08:46 +0000 | |||
1438 | @@ -1700,8 +1700,6 @@ | |||
1439 | 1700 | complete, though: there may | 1700 | complete, though: there may |
1440 | 1701 | have been hash collisions, | 1701 | have been hash collisions, |
1441 | 1702 | record deletions, etc. */ | 1702 | record deletions, etc. */ |
1442 | 1703 | rw_lock_t* btr_search_latch;/*!< Adaptive hash index latch for the | ||
1443 | 1704 | index this block belongs to or NULL */ | ||
1444 | 1705 | /* @} */ | 1703 | /* @} */ |
1445 | 1706 | # ifdef UNIV_SYNC_DEBUG | 1704 | # ifdef UNIV_SYNC_DEBUG |
1446 | 1707 | /** @name Debug fields */ | 1705 | /** @name Debug fields */ |
1447 | 1708 | 1706 | ||
1448 | === modified file 'Percona-Server/storage/innobase/include/dict0mem.h' | |||
1449 | --- Percona-Server/storage/innobase/include/dict0mem.h 2013-08-14 03:57:21 +0000 | |||
1450 | +++ Percona-Server/storage/innobase/include/dict0mem.h 2013-09-02 14:08:46 +0000 | |||
1451 | @@ -544,6 +544,10 @@ | |||
1452 | 544 | initialized to 0, NULL or FALSE in dict_mem_index_create(). */ | 544 | initialized to 0, NULL or FALSE in dict_mem_index_create(). */ |
1453 | 545 | struct dict_index_t{ | 545 | struct dict_index_t{ |
1454 | 546 | index_id_t id; /*!< id of the index */ | 546 | index_id_t id; /*!< id of the index */ |
1455 | 547 | rw_lock_t* search_latch; /*!< latch protecting the AHI partition | ||
1456 | 548 | corresponding to this index */ | ||
1457 | 549 | hash_table_t* search_table; /*!< hash table protected by | ||
1458 | 550 | search_latch */ | ||
1459 | 547 | mem_heap_t* heap; /*!< memory heap */ | 551 | mem_heap_t* heap; /*!< memory heap */ |
1460 | 548 | const char* name; /*!< index name */ | 552 | const char* name; /*!< index name */ |
1461 | 549 | const char* table_name;/*!< table name */ | 553 | const char* table_name;/*!< table name */ |
1462 | 550 | 554 | ||
1463 | === modified file 'Percona-Server/storage/innobase/include/trx0trx.h' | |||
1464 | --- Percona-Server/storage/innobase/include/trx0trx.h 2013-08-29 17:05:40 +0000 | |||
1465 | +++ Percona-Server/storage/innobase/include/trx0trx.h 2013-09-02 14:08:46 +0000 | |||
1466 | @@ -44,12 +44,14 @@ | |||
1467 | 44 | extern sess_t* trx_dummy_sess; | 44 | extern sess_t* trx_dummy_sess; |
1468 | 45 | 45 | ||
1469 | 46 | /********************************************************************//** | 46 | /********************************************************************//** |
1471 | 47 | Releases the search latch if trx has reserved it. */ | 47 | In XtraDB it is impossible for a transaction to own a search latch outside of |
1472 | 48 | InnoDB code, so there is nothing to release on demand. We keep this function to | ||
1473 | 49 | simplify maintenance.*/ | ||
1474 | 48 | UNIV_INLINE | 50 | UNIV_INLINE |
1475 | 49 | void | 51 | void |
1476 | 50 | trx_search_latch_release_if_reserved( | 52 | trx_search_latch_release_if_reserved( |
1477 | 51 | /*=================================*/ | 53 | /*=================================*/ |
1479 | 52 | trx_t* trx); /*!< in: transaction */ | 54 | trx_t* trx __attribute__((unused))); /*!< in: transaction */ |
1480 | 53 | /******************************************************************//** | 55 | /******************************************************************//** |
1481 | 54 | Set detailed error message for the transaction. */ | 56 | Set detailed error message for the transaction. */ |
1482 | 55 | UNIV_INTERN | 57 | UNIV_INTERN |
1483 | @@ -815,8 +817,8 @@ | |||
1484 | 815 | flush the log in | 817 | flush the log in |
1485 | 816 | trx_commit_complete_for_mysql() */ | 818 | trx_commit_complete_for_mysql() */ |
1486 | 817 | ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ | 819 | ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ |
1489 | 818 | ulint has_search_latch; | 820 | bool has_search_latch; |
1490 | 819 | /*!< TRUE if this trx has latched the | 821 | /*!< true if this trx has latched any |
1491 | 820 | search system latch in S-mode */ | 822 | search system latch in S-mode */ |
1492 | 821 | ulint search_latch_timeout; | 823 | ulint search_latch_timeout; |
1493 | 822 | /*!< If we notice that someone is | 824 | /*!< If we notice that someone is |
1494 | @@ -1136,7 +1138,7 @@ | |||
1495 | 1136 | 1138 | ||
1496 | 1137 | Bear in mind (3) and (4) when using the hash index. | 1139 | Bear in mind (3) and (4) when using the hash index. |
1497 | 1138 | */ | 1140 | */ |
1499 | 1139 | extern rw_lock_t** btr_search_latch_arr; | 1141 | extern rw_lock_t* btr_search_latch_arr; |
1500 | 1140 | 1142 | ||
1501 | 1141 | #ifndef UNIV_NONINL | 1143 | #ifndef UNIV_NONINL |
1502 | 1142 | #include "trx0trx.ic" | 1144 | #include "trx0trx.ic" |
1503 | 1143 | 1145 | ||
1504 | === modified file 'Percona-Server/storage/innobase/include/trx0trx.ic' | |||
1505 | --- Percona-Server/storage/innobase/include/trx0trx.ic 2013-08-29 17:05:40 +0000 | |||
1506 | +++ Percona-Server/storage/innobase/include/trx0trx.ic 2013-09-02 14:08:46 +0000 | |||
1507 | @@ -164,21 +164,14 @@ | |||
1508 | 164 | } | 164 | } |
1509 | 165 | 165 | ||
1510 | 166 | /********************************************************************//** | 166 | /********************************************************************//** |
1512 | 167 | Releases the search latches if trx has reserved them. */ | 167 | In XtraDB it is impossible for a transaction to own a search latch outside of |
1513 | 168 | InnoDB code, so there is nothing to release on demand. We keep this function to | ||
1514 | 169 | simplify maintenance.*/ | ||
1515 | 168 | UNIV_INLINE | 170 | UNIV_INLINE |
1516 | 169 | void | 171 | void |
1517 | 170 | trx_search_latch_release_if_reserved( | 172 | trx_search_latch_release_if_reserved( |
1518 | 171 | /*=================================*/ | 173 | /*=================================*/ |
1520 | 172 | trx_t* trx) /*!< in: transaction */ | 174 | trx_t* trx __attribute__((unused))) /*!< in: transaction */ |
1521 | 173 | { | 175 | { |
1531 | 174 | ulint i; | 176 | ut_ad(!trx->has_search_latch); |
1523 | 175 | |||
1524 | 176 | for (i = 0; i < btr_search_index_num; i++) { | ||
1525 | 177 | if (trx->has_search_latch & (1UL << i)) { | ||
1526 | 178 | rw_lock_s_unlock(btr_search_latch_arr[i]); | ||
1527 | 179 | } | ||
1528 | 180 | } | ||
1529 | 181 | |||
1530 | 182 | trx->has_search_latch = 0; | ||
1532 | 183 | } | 177 | } |
1533 | 184 | |||
1534 | 185 | 178 | ||
1535 | === modified file 'Percona-Server/storage/innobase/row/row0ftsort.cc' | |||
1536 | --- Percona-Server/storage/innobase/row/row0ftsort.cc 2013-02-12 07:47:19 +0000 | |||
1537 | +++ Percona-Server/storage/innobase/row/row0ftsort.cc 2013-09-02 14:08:46 +0000 | |||
1538 | @@ -30,6 +30,7 @@ | |||
1539 | 30 | #include "row0merge.h" | 30 | #include "row0merge.h" |
1540 | 31 | #include "row0row.h" | 31 | #include "row0row.h" |
1541 | 32 | #include "btr0cur.h" | 32 | #include "btr0cur.h" |
1542 | 33 | #include "btr0sea.h" | ||
1543 | 33 | 34 | ||
1544 | 34 | /** Read the next record to buffer N. | 35 | /** Read the next record to buffer N. |
1545 | 35 | @param N index into array of merge info structure */ | 36 | @param N index into array of merge info structure */ |
1546 | @@ -87,6 +88,8 @@ | |||
1547 | 87 | new_index->n_def = FTS_NUM_FIELDS_SORT; | 88 | new_index->n_def = FTS_NUM_FIELDS_SORT; |
1548 | 88 | new_index->cached = TRUE; | 89 | new_index->cached = TRUE; |
1549 | 89 | 90 | ||
1550 | 91 | btr_search_index_init(new_index); | ||
1551 | 92 | |||
1552 | 90 | idx_field = dict_index_get_nth_field(index, 0); | 93 | idx_field = dict_index_get_nth_field(index, 0); |
1553 | 91 | charset = fts_index_get_charset(index); | 94 | charset = fts_index_get_charset(index); |
1554 | 92 | 95 | ||
1555 | 93 | 96 | ||
1556 | === modified file 'Percona-Server/storage/innobase/row/row0sel.cc' | |||
1557 | --- Percona-Server/storage/innobase/row/row0sel.cc 2013-08-29 17:05:40 +0000 | |||
1558 | +++ Percona-Server/storage/innobase/row/row0sel.cc 2013-09-02 14:08:46 +0000 | |||
1559 | @@ -1233,7 +1233,7 @@ | |||
1560 | 1233 | ut_ad(!plan->must_get_clust); | 1233 | ut_ad(!plan->must_get_clust); |
1561 | 1234 | #ifdef UNIV_SYNC_DEBUG | 1234 | #ifdef UNIV_SYNC_DEBUG |
1562 | 1235 | if (search_latch_locked) { | 1235 | if (search_latch_locked) { |
1564 | 1236 | ut_ad(rw_lock_own(btr_search_get_latch(index->id), | 1236 | ut_ad(rw_lock_own(btr_search_get_latch(index), |
1565 | 1237 | RW_LOCK_SHARED)); | 1237 | RW_LOCK_SHARED)); |
1566 | 1238 | } | 1238 | } |
1567 | 1239 | #endif /* UNIV_SYNC_DEBUG */ | 1239 | #endif /* UNIV_SYNC_DEBUG */ |
1568 | @@ -1406,10 +1406,10 @@ | |||
1569 | 1406 | && !plan->must_get_clust | 1406 | && !plan->must_get_clust |
1570 | 1407 | && !plan->table->big_rows) { | 1407 | && !plan->table->big_rows) { |
1571 | 1408 | if (!search_latch_locked) { | 1408 | if (!search_latch_locked) { |
1573 | 1409 | rw_lock_s_lock(btr_search_get_latch(index->id)); | 1409 | rw_lock_s_lock(btr_search_get_latch(index)); |
1574 | 1410 | 1410 | ||
1575 | 1411 | search_latch_locked = TRUE; | 1411 | search_latch_locked = TRUE; |
1577 | 1412 | } else if (rw_lock_get_writer(btr_search_get_latch(index->id)) | 1412 | } else if (rw_lock_get_writer(btr_search_get_latch(index)) |
1578 | 1413 | == RW_LOCK_WAIT_EX) { | 1413 | == RW_LOCK_WAIT_EX) { |
1579 | 1414 | 1414 | ||
1580 | 1415 | /* There is an x-latch request waiting: release the | 1415 | /* There is an x-latch request waiting: release the |
1581 | @@ -1419,8 +1419,8 @@ | |||
1582 | 1419 | from acquiring an s-latch for a long time, lowering | 1419 | from acquiring an s-latch for a long time, lowering |
1583 | 1420 | performance significantly in multiprocessors. */ | 1420 | performance significantly in multiprocessors. */ |
1584 | 1421 | 1421 | ||
1587 | 1422 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1422 | rw_lock_s_unlock(btr_search_get_latch(index)); |
1588 | 1423 | rw_lock_s_lock(btr_search_get_latch(index->id)); | 1423 | rw_lock_s_lock(btr_search_get_latch(index)); |
1589 | 1424 | } | 1424 | } |
1590 | 1425 | 1425 | ||
1591 | 1426 | found_flag = row_sel_try_search_shortcut(node, plan, | 1426 | found_flag = row_sel_try_search_shortcut(node, plan, |
1592 | @@ -1445,7 +1445,7 @@ | |||
1593 | 1445 | } | 1445 | } |
1594 | 1446 | 1446 | ||
1595 | 1447 | if (search_latch_locked) { | 1447 | if (search_latch_locked) { |
1597 | 1448 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 1448 | rw_lock_s_unlock(btr_search_get_latch(index)); |
1598 | 1449 | 1449 | ||
1599 | 1450 | search_latch_locked = FALSE; | 1450 | search_latch_locked = FALSE; |
1600 | 1451 | } | 1451 | } |
1601 | @@ -2021,7 +2021,7 @@ | |||
1602 | 2021 | 2021 | ||
1603 | 2022 | func_exit: | 2022 | func_exit: |
1604 | 2023 | if (search_latch_locked) { | 2023 | if (search_latch_locked) { |
1606 | 2024 | rw_lock_s_unlock(btr_search_get_latch(index->id)); | 2024 | rw_lock_s_unlock(btr_search_get_latch(index)); |
1607 | 2025 | } | 2025 | } |
1608 | 2026 | if (UNIV_LIKELY_NULL(heap)) { | 2026 | if (UNIV_LIKELY_NULL(heap)) { |
1609 | 2027 | mem_heap_free(heap); | 2027 | mem_heap_free(heap); |
1610 | @@ -2796,6 +2796,9 @@ | |||
1611 | 2796 | /* Copy an externally stored field to a temporary heap */ | 2796 | /* Copy an externally stored field to a temporary heap */ |
1612 | 2797 | 2797 | ||
1613 | 2798 | ut_a(!prebuilt->trx->has_search_latch); | 2798 | ut_a(!prebuilt->trx->has_search_latch); |
1614 | 2799 | #ifdef UNIV_SYNC_DEBUG | ||
1615 | 2800 | ut_ad(!btr_search_own_any()); | ||
1616 | 2801 | #endif | ||
1617 | 2799 | ut_ad(field_no == templ->clust_rec_field_no); | 2802 | ut_ad(field_no == templ->clust_rec_field_no); |
1618 | 2800 | 2803 | ||
1619 | 2801 | if (UNIV_UNLIKELY(templ->type == DATA_BLOB)) { | 2804 | if (UNIV_UNLIKELY(templ->type == DATA_BLOB)) { |
1620 | @@ -3468,11 +3471,11 @@ | |||
1621 | 3468 | ut_ad(!prebuilt->templ_contains_blob); | 3471 | ut_ad(!prebuilt->templ_contains_blob); |
1622 | 3469 | 3472 | ||
1623 | 3470 | #ifndef UNIV_SEARCH_DEBUG | 3473 | #ifndef UNIV_SEARCH_DEBUG |
1624 | 3474 | ut_ad(trx->has_search_latch); | ||
1625 | 3475 | |||
1626 | 3471 | btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE, | 3476 | btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE, |
1627 | 3472 | BTR_SEARCH_LEAF, pcur, | 3477 | BTR_SEARCH_LEAF, pcur, |
1631 | 3473 | (trx->has_search_latch) | 3478 | RW_S_LATCH, |
1629 | 3474 | ? RW_S_LATCH | ||
1630 | 3475 | : 0, | ||
1632 | 3476 | mtr); | 3479 | mtr); |
1633 | 3477 | #else /* UNIV_SEARCH_DEBUG */ | 3480 | #else /* UNIV_SEARCH_DEBUG */ |
1634 | 3478 | btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE, | 3481 | btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE, |
1635 | @@ -3599,47 +3602,6 @@ | |||
1636 | 3599 | } | 3602 | } |
1637 | 3600 | 3603 | ||
1638 | 3601 | /********************************************************************//** | 3604 | /********************************************************************//** |
1639 | 3602 | Acquires an S latch for the adaptive hash index for a given index tree if is | ||
1640 | 3603 | not acquired already. If the current transaction already owns a latch with | ||
1641 | 3604 | a higher index in the latch array, release all the already-held S latches | ||
1642 | 3605 | and reacquire them together with the desired latch to honor the latching | ||
1643 | 3606 | order. */ | ||
1644 | 3607 | static | ||
1645 | 3608 | void | ||
1646 | 3609 | trx_search_latch_lock( | ||
1647 | 3610 | /*==================*/ | ||
1648 | 3611 | trx_t* trx, /*!< in: latching transcation */ | ||
1649 | 3612 | ulint index_id) /*!< in: index to latch AHI for */ | ||
1650 | 3613 | { | ||
1651 | 3614 | ulint latch_mask = 1UL << (index_id % btr_search_index_num); | ||
1652 | 3615 | |||
1653 | 3616 | if (!(trx->has_search_latch & latch_mask)) { | ||
1654 | 3617 | |||
1655 | 3618 | if (trx->has_search_latch < latch_mask) { | ||
1656 | 3619 | |||
1657 | 3620 | rw_lock_s_lock(btr_search_get_latch(index_id)); | ||
1658 | 3621 | trx->has_search_latch |= latch_mask; | ||
1659 | 3622 | } else { | ||
1660 | 3623 | |||
1661 | 3624 | ulint taken_latches = trx->has_search_latch; | ||
1662 | 3625 | |||
1663 | 3626 | trx_search_latch_release_if_reserved(trx); | ||
1664 | 3627 | |||
1665 | 3628 | trx->has_search_latch = taken_latches | latch_mask; | ||
1666 | 3629 | |||
1667 | 3630 | for (ulint i = 0; i < btr_search_index_num; i++) { | ||
1668 | 3631 | if (trx->has_search_latch & (1UL << i)) { | ||
1669 | 3632 | |||
1670 | 3633 | rw_lock_s_lock( | ||
1671 | 3634 | btr_search_latch_arr[i]); | ||
1672 | 3635 | } | ||
1673 | 3636 | } | ||
1674 | 3637 | } | ||
1675 | 3638 | } | ||
1676 | 3639 | } | ||
1677 | 3640 | |||
1678 | 3641 | |||
1679 | 3642 | /********************************************************************//** | ||
1680 | 3643 | Searches for rows in the database. This is used in the interface to | 3605 | Searches for rows in the database. This is used in the interface to |
1681 | 3644 | MySQL. This function opens a cursor, and also implements fetch next | 3606 | MySQL. This function opens a cursor, and also implements fetch next |
1682 | 3645 | and fetch prev. NOTE that if we do a search with a full key value | 3607 | and fetch prev. NOTE that if we do a search with a full key value |
1683 | @@ -3701,7 +3663,6 @@ | |||
1684 | 3701 | ulint* offsets = offsets_; | 3663 | ulint* offsets = offsets_; |
1685 | 3702 | ibool table_lock_waited = FALSE; | 3664 | ibool table_lock_waited = FALSE; |
1686 | 3703 | byte* next_buf = 0; | 3665 | byte* next_buf = 0; |
1687 | 3704 | bool should_release; | ||
1688 | 3705 | 3666 | ||
1689 | 3706 | rec_offs_init(offsets_); | 3667 | rec_offs_init(offsets_); |
1690 | 3707 | 3668 | ||
1691 | @@ -3715,7 +3676,9 @@ | |||
1692 | 3715 | return(DB_END_OF_INDEX); | 3676 | return(DB_END_OF_INDEX); |
1693 | 3716 | } | 3677 | } |
1694 | 3717 | 3678 | ||
1695 | 3679 | ut_ad(!trx->has_search_latch); | ||
1696 | 3718 | #ifdef UNIV_SYNC_DEBUG | 3680 | #ifdef UNIV_SYNC_DEBUG |
1697 | 3681 | ut_ad(!btr_search_own_any()); | ||
1698 | 3719 | ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); | 3682 | ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); |
1699 | 3720 | #endif /* UNIV_SYNC_DEBUG */ | 3683 | #endif /* UNIV_SYNC_DEBUG */ |
1700 | 3721 | 3684 | ||
1701 | @@ -3776,33 +3739,6 @@ | |||
1702 | 3776 | fprintf(stderr, "N tables locked %lu\n", | 3739 | fprintf(stderr, "N tables locked %lu\n", |
1703 | 3777 | (ulong) trx->mysql_n_tables_locked); | 3740 | (ulong) trx->mysql_n_tables_locked); |
1704 | 3778 | #endif | 3741 | #endif |
1705 | 3779 | /*-------------------------------------------------------------*/ | ||
1706 | 3780 | /* PHASE 0: Release possible latches we are holding on the | ||
1707 | 3781 | adaptive hash index latches if there is someone waiting behind */ | ||
1708 | 3782 | |||
1709 | 3783 | should_release = false; | ||
1710 | 3784 | for (ulint i = 0; i < btr_search_index_num; i++) { | ||
1711 | 3785 | /* we should check all latches (fix Bug#791030) */ | ||
1712 | 3786 | if (UNIV_UNLIKELY(rw_lock_get_writer(btr_search_latch_arr[i]) | ||
1713 | 3787 | != RW_LOCK_NOT_LOCKED)) { | ||
1714 | 3788 | should_release = true; | ||
1715 | 3789 | break; | ||
1716 | 3790 | } | ||
1717 | 3791 | } | ||
1718 | 3792 | |||
1719 | 3793 | if (UNIV_UNLIKELY(should_release)) { | ||
1720 | 3794 | |||
1721 | 3795 | /* There is an x-latch request on the adaptive hash index: | ||
1722 | 3796 | release the s-latch to reduce starvation and wait for | ||
1723 | 3797 | BTR_SEA_TIMEOUT rounds before trying to keep it again over | ||
1724 | 3798 | calls from MySQL */ | ||
1725 | 3799 | |||
1726 | 3800 | /* We should release all s-latches (fix Bug#791030) */ | ||
1727 | 3801 | trx_search_latch_release_if_reserved(trx); | ||
1728 | 3802 | |||
1729 | 3803 | trx->search_latch_timeout = BTR_SEA_TIMEOUT; | ||
1730 | 3804 | } | ||
1731 | 3805 | |||
1732 | 3806 | /* Reset the new record lock info if srv_locks_unsafe_for_binlog | 3742 | /* Reset the new record lock info if srv_locks_unsafe_for_binlog |
1733 | 3807 | is set or session is using a READ COMMITED isolation level. Then | 3743 | is set or session is using a READ COMMITED isolation level. Then |
1734 | 3808 | we are able to remove the record locks set here on an individual | 3744 | we are able to remove the record locks set here on an individual |
1735 | @@ -3949,7 +3885,9 @@ | |||
1736 | 3949 | hash index semaphore! */ | 3885 | hash index semaphore! */ |
1737 | 3950 | 3886 | ||
1738 | 3951 | #ifndef UNIV_SEARCH_DEBUG | 3887 | #ifndef UNIV_SEARCH_DEBUG |
1740 | 3952 | trx_search_latch_lock(trx, index->id); | 3888 | ut_ad(!trx->has_search_latch); |
1741 | 3889 | rw_lock_s_lock(btr_search_get_latch(index)); | ||
1742 | 3890 | trx->has_search_latch = TRUE; | ||
1743 | 3953 | #endif | 3891 | #endif |
1744 | 3954 | switch (row_sel_try_search_shortcut_for_mysql( | 3892 | switch (row_sel_try_search_shortcut_for_mysql( |
1745 | 3955 | &rec, prebuilt, &offsets, &heap, | 3893 | &rec, prebuilt, &offsets, &heap, |
1746 | @@ -4003,7 +3941,7 @@ | |||
1747 | 4003 | fputs(" shortcut\n", stderr); */ | 3941 | fputs(" shortcut\n", stderr); */ |
1748 | 4004 | 3942 | ||
1749 | 4005 | err = DB_SUCCESS; | 3943 | err = DB_SUCCESS; |
1751 | 4006 | goto release_search_latch_if_needed; | 3944 | goto release_search_latch; |
1752 | 4007 | 3945 | ||
1753 | 4008 | case SEL_EXHAUSTED: | 3946 | case SEL_EXHAUSTED: |
1754 | 4009 | shortcut_mismatch: | 3947 | shortcut_mismatch: |
1755 | @@ -4013,15 +3951,10 @@ | |||
1756 | 4013 | fputs(" record not found 2\n", stderr); */ | 3951 | fputs(" record not found 2\n", stderr); */ |
1757 | 4014 | 3952 | ||
1758 | 4015 | err = DB_RECORD_NOT_FOUND; | 3953 | err = DB_RECORD_NOT_FOUND; |
1768 | 4016 | release_search_latch_if_needed: | 3954 | release_search_latch: |
1769 | 4017 | if (trx->search_latch_timeout > 0 | 3955 | rw_lock_s_unlock( |
1770 | 4018 | && trx->has_search_latch) { | 3956 | btr_search_get_latch(index)); |
1771 | 4019 | 3957 | trx->has_search_latch = FALSE; | |
1763 | 4020 | trx->search_latch_timeout--; | ||
1764 | 4021 | |||
1765 | 4022 | trx_search_latch_release_if_reserved( | ||
1766 | 4023 | trx); | ||
1767 | 4024 | } | ||
1772 | 4025 | 3958 | ||
1773 | 4026 | /* NOTE that we do NOT store the cursor | 3959 | /* NOTE that we do NOT store the cursor |
1774 | 4027 | position */ | 3960 | position */ |
1775 | @@ -4036,13 +3969,19 @@ | |||
1776 | 4036 | 3969 | ||
1777 | 4037 | mtr_commit(&mtr); | 3970 | mtr_commit(&mtr); |
1778 | 4038 | mtr_start(&mtr); | 3971 | mtr_start(&mtr); |
1779 | 3972 | |||
1780 | 3973 | rw_lock_s_unlock(btr_search_get_latch(index)); | ||
1781 | 3974 | trx->has_search_latch = FALSE; | ||
1782 | 4039 | } | 3975 | } |
1783 | 4040 | } | 3976 | } |
1784 | 4041 | 3977 | ||
1785 | 4042 | /*-------------------------------------------------------------*/ | 3978 | /*-------------------------------------------------------------*/ |
1786 | 4043 | /* PHASE 3: Open or restore index cursor position */ | 3979 | /* PHASE 3: Open or restore index cursor position */ |
1787 | 4044 | 3980 | ||
1789 | 4045 | trx_search_latch_release_if_reserved(trx); | 3981 | ut_ad(!trx->has_search_latch); |
1790 | 3982 | #ifdef UNIV_SYNC_DEBUG | ||
1791 | 3983 | ut_ad(!btr_search_own_any()); | ||
1792 | 3984 | #endif | ||
1793 | 4046 | 3985 | ||
1794 | 4047 | /* The state of a running trx can only be changed by the | 3986 | /* The state of a running trx can only be changed by the |
1795 | 4048 | thread that is currently serving the transaction. Because we | 3987 | thread that is currently serving the transaction. Because we |
1796 | @@ -5184,7 +5123,9 @@ | |||
1797 | 5184 | } | 5123 | } |
1798 | 5185 | } | 5124 | } |
1799 | 5186 | 5125 | ||
1800 | 5126 | ut_ad(!trx->has_search_latch); | ||
1801 | 5187 | #ifdef UNIV_SYNC_DEBUG | 5127 | #ifdef UNIV_SYNC_DEBUG |
1802 | 5128 | ut_ad(!btr_search_own_any()); | ||
1803 | 5188 | ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); | 5129 | ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); |
1804 | 5189 | #endif /* UNIV_SYNC_DEBUG */ | 5130 | #endif /* UNIV_SYNC_DEBUG */ |
1805 | 5190 | 5131 | ||
1806 | 5191 | 5132 | ||
1807 | === modified file 'Percona-Server/storage/innobase/srv/srv0srv.cc' | |||
1808 | --- Percona-Server/storage/innobase/srv/srv0srv.cc 2013-08-29 17:05:40 +0000 | |||
1809 | +++ Percona-Server/storage/innobase/srv/srv0srv.cc 2013-09-02 14:08:46 +0000 | |||
1810 | @@ -1182,7 +1182,8 @@ | |||
1811 | 1182 | ulint n_reserved; | 1182 | ulint n_reserved; |
1812 | 1183 | ibool ret; | 1183 | ibool ret; |
1813 | 1184 | 1184 | ||
1815 | 1185 | ulint btr_search_sys_subtotal; | 1185 | ulong btr_search_sys_constant; |
1816 | 1186 | ulong btr_search_sys_variable; | ||
1817 | 1186 | ulint lock_sys_subtotal; | 1187 | ulint lock_sys_subtotal; |
1818 | 1187 | ulint recv_sys_subtotal; | 1188 | ulint recv_sys_subtotal; |
1819 | 1188 | 1189 | ||
1820 | @@ -1307,21 +1308,27 @@ | |||
1821 | 1307 | "Total memory allocated by read views " ULINTPF "\n", | 1308 | "Total memory allocated by read views " ULINTPF "\n", |
1822 | 1308 | os_atomic_increment_lint(&srv_read_views_memory, 0)); | 1309 | os_atomic_increment_lint(&srv_read_views_memory, 0)); |
1823 | 1309 | 1310 | ||
1837 | 1310 | /* Calculate reserved memories */ | 1311 | /* Calculate AHI constant and variable memory allocations */ |
1838 | 1311 | if (btr_search_sys && btr_search_sys->hash_index[0]->heap) { | 1312 | |
1839 | 1312 | btr_search_sys_subtotal | 1313 | btr_search_sys_constant = 0; |
1840 | 1313 | = mem_heap_get_size(btr_search_sys->hash_index[0] | 1314 | btr_search_sys_variable = 0; |
1841 | 1314 | ->heap); | 1315 | |
1842 | 1315 | } else { | 1316 | ut_ad(btr_search_sys->hash_tables); |
1843 | 1316 | btr_search_sys_subtotal = 0; | 1317 | |
1844 | 1317 | for (i=0; i < btr_search_sys->hash_index[0]->n_sync_obj; i++) { | 1318 | for (i = 0; i < btr_search_index_num; i++) { |
1845 | 1318 | btr_search_sys_subtotal | 1319 | hash_table_t* ht = btr_search_sys->hash_tables[i]; |
1846 | 1319 | += mem_heap_get_size( | 1320 | |
1847 | 1320 | btr_search_sys->hash_index[0] | 1321 | ut_ad(ht); |
1848 | 1321 | ->heaps[i]); | 1322 | ut_ad(ht->heap); |
1849 | 1322 | } | 1323 | |
1850 | 1324 | /* Multiple mutexes/heaps are currently never used for adaptive | ||
1851 | 1325 | hash index tables. */ | ||
1852 | 1326 | ut_ad(!ht->n_sync_obj); | ||
1853 | 1327 | ut_ad(!ht->heaps); | ||
1854 | 1328 | |||
1855 | 1329 | btr_search_sys_variable += mem_heap_get_size(ht->heap); | ||
1856 | 1330 | btr_search_sys_constant += ht->n_cells * sizeof(hash_cell_t); | ||
1857 | 1323 | } | 1331 | } |
1858 | 1324 | btr_search_sys_subtotal *= btr_search_index_num; | ||
1859 | 1325 | 1332 | ||
1860 | 1326 | lock_sys_subtotal = 0; | 1333 | lock_sys_subtotal = 0; |
1861 | 1327 | if (trx_sys) { | 1334 | if (trx_sys) { |
1862 | @@ -1349,18 +1356,9 @@ | |||
1863 | 1349 | " Lock system %lu \t(%lu + " ULINTPF ")\n" | 1356 | " Lock system %lu \t(%lu + " ULINTPF ")\n" |
1864 | 1350 | " Recovery system %lu \t(%lu + " ULINTPF ")\n", | 1357 | " Recovery system %lu \t(%lu + " ULINTPF ")\n", |
1865 | 1351 | 1358 | ||
1878 | 1352 | (ulong) (btr_search_sys | 1359 | btr_search_sys_constant + btr_search_sys_variable, |
1879 | 1353 | ? (btr_search_sys->hash_index[0]->n_cells | 1360 | btr_search_sys_constant, |
1880 | 1354 | * sizeof(hash_cell_t) | 1361 | btr_search_sys_variable, |
1869 | 1355 | * btr_search_index_num) | ||
1870 | 1356 | : 0) | ||
1871 | 1357 | + btr_search_sys_subtotal, | ||
1872 | 1358 | (ulong) (btr_search_sys | ||
1873 | 1359 | ? (btr_search_sys->hash_index[0]->n_cells | ||
1874 | 1360 | * sizeof(hash_cell_t) | ||
1875 | 1361 | * btr_search_index_num) | ||
1876 | 1362 | : 0), | ||
1877 | 1363 | btr_search_sys_subtotal, | ||
1881 | 1364 | 1362 | ||
1882 | 1365 | (ulong) (buf_pool_from_array(0)->page_hash->n_cells * sizeof(hash_cell_t)), | 1363 | (ulong) (buf_pool_from_array(0)->page_hash->n_cells * sizeof(hash_cell_t)), |
1883 | 1366 | 1364 | ||
1884 | @@ -1509,23 +1507,23 @@ | |||
1885 | 1509 | buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); | 1507 | buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); |
1886 | 1510 | buf_get_total_list_size_in_bytes(&buf_pools_list_size); | 1508 | buf_get_total_list_size_in_bytes(&buf_pools_list_size); |
1887 | 1511 | 1509 | ||
1905 | 1512 | if (btr_search_sys && btr_search_sys->hash_index[0]->heap) { | 1510 | mem_adaptive_hash = 0; |
1906 | 1513 | mem_adaptive_hash | 1511 | |
1907 | 1514 | = mem_heap_get_size(btr_search_sys | 1512 | ut_ad(btr_search_sys->hash_tables); |
1908 | 1515 | ->hash_index[0]->heap); | 1513 | |
1909 | 1516 | } else { | 1514 | for (i = 0; i < btr_search_index_num; i++) { |
1910 | 1517 | mem_adaptive_hash = 0; | 1515 | hash_table_t* ht = btr_search_sys->hash_tables[i]; |
1911 | 1518 | for (i=0; i < btr_search_sys->hash_index[0]->n_sync_obj; i++) { | 1516 | |
1912 | 1519 | mem_adaptive_hash | 1517 | ut_ad(ht); |
1913 | 1520 | += mem_heap_get_size | 1518 | ut_ad(ht->heap); |
1914 | 1521 | (btr_search_sys->hash_index[0]->heaps[i]); | 1519 | /* Multiple mutexes/heaps are currently never used for adaptive |
1915 | 1522 | } | 1520 | hash index tables. */ |
1916 | 1523 | } | 1521 | ut_ad(!ht->n_sync_obj); |
1917 | 1524 | if (btr_search_sys) { | 1522 | ut_ad(!ht->heaps); |
1918 | 1525 | mem_adaptive_hash += (btr_search_sys->hash_index[0]->n_cells | 1523 | |
1919 | 1526 | * sizeof(hash_cell_t)); | 1524 | mem_adaptive_hash += mem_heap_get_size(ht->heap); |
1920 | 1527 | } | 1525 | mem_adaptive_hash += ht->n_cells * sizeof(hash_cell_t); |
1921 | 1528 | mem_adaptive_hash *= btr_search_index_num; | 1526 | } |
1922 | 1529 | 1527 | ||
1923 | 1530 | mem_dictionary = (dict_sys ? ((dict_sys->table_hash->n_cells | 1528 | mem_dictionary = (dict_sys ? ((dict_sys->table_hash->n_cells |
1924 | 1531 | + dict_sys->table_id_hash->n_cells | 1529 | + dict_sys->table_id_hash->n_cells |
1925 | 1532 | 1530 | ||
1926 | === modified file 'Percona-Server/storage/innobase/sync/sync0sync.cc' | |||
1927 | --- Percona-Server/storage/innobase/sync/sync0sync.cc 2013-08-29 17:05:40 +0000 | |||
1928 | +++ Percona-Server/storage/innobase/sync/sync0sync.cc 2013-09-02 14:08:46 +0000 | |||
1929 | @@ -1187,12 +1187,12 @@ | |||
1930 | 1187 | array */ | 1187 | array */ |
1931 | 1188 | bool found_current = false; | 1188 | bool found_current = false; |
1932 | 1189 | for (ulint i = 0; i < btr_search_index_num; i++) { | 1189 | for (ulint i = 0; i < btr_search_index_num; i++) { |
1934 | 1190 | if (btr_search_latch_arr[i] == latch) { | 1190 | if (&btr_search_latch_arr[i] == latch) { |
1935 | 1191 | found_current = true; | 1191 | found_current = true; |
1936 | 1192 | } else if (found_current) { | 1192 | } else if (found_current) { |
1938 | 1193 | ut_ad(!rw_lock_own(btr_search_latch_arr[i], | 1193 | ut_ad(!rw_lock_own(&btr_search_latch_arr[i], |
1939 | 1194 | RW_LOCK_SHARED)); | 1194 | RW_LOCK_SHARED)); |
1941 | 1195 | ut_ad(!rw_lock_own(btr_search_latch_arr[i], | 1195 | ut_ad(!rw_lock_own(&btr_search_latch_arr[i], |
1942 | 1196 | RW_LOCK_EX)); | 1196 | RW_LOCK_EX)); |
1943 | 1197 | } | 1197 | } |
1944 | 1198 | } | 1198 | } |
1945 | 1199 | 1199 | ||
1946 | === modified file 'Percona-Server/storage/innobase/trx/trx0trx.cc' | |||
1947 | --- Percona-Server/storage/innobase/trx/trx0trx.cc 2013-08-29 17:05:40 +0000 | |||
1948 | +++ Percona-Server/storage/innobase/trx/trx0trx.cc 2013-09-02 14:08:46 +0000 | |||
1949 | @@ -360,6 +360,9 @@ | |||
1950 | 360 | ut_a(trx->lock.wait_thr == NULL); | 360 | ut_a(trx->lock.wait_thr == NULL); |
1951 | 361 | 361 | ||
1952 | 362 | ut_a(!trx->has_search_latch); | 362 | ut_a(!trx->has_search_latch); |
1953 | 363 | #ifdef UNIV_SYNC_DEBUG | ||
1954 | 364 | ut_ad(!btr_search_own_any()); | ||
1955 | 365 | #endif | ||
1956 | 363 | 366 | ||
1957 | 364 | ut_a(trx->dict_operation_lock_mode == 0); | 367 | ut_a(trx->dict_operation_lock_mode == 0); |
1958 | 365 | 368 |
- Same comments as for the 5.5 MP.
- Diff line 182--185: missing arg comment, and, uhm, why add more
"=====" ?
- Diff line 385--391 drops MONITOR_INC call.