]>
Commit | Line | Data |
---|---|---|
d0da6fe5 ER |
1 | diff -ru mysql-5.0.75_base/innobase/dict/dict0boot.c mysql-5.0.75/innobase/dict/dict0boot.c |
2 | --- mysql-5.0.75_base/innobase/dict/dict0boot.c 2008-12-19 02:19:35.000000000 +0900 | |
3 | +++ mysql-5.0.75/innobase/dict/dict0boot.c 2009-01-23 19:28:25.000000000 +0900 | |
4 | @@ -247,6 +247,7 @@ | |
5 | system tables */ | |
6 | /*-------------------------*/ | |
7 | table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, FALSE); | |
8 | + table->n_mysql_handles_opened = 1; /* for pin */ | |
9 | ||
10 | dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); | |
11 | dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); | |
12 | @@ -283,6 +284,7 @@ | |
13 | ut_a(success); | |
14 | /*-------------------------*/ | |
15 | table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, FALSE); | |
16 | + table->n_mysql_handles_opened = 1; /* for pin */ | |
17 | ||
18 | dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0); | |
19 | dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); | |
20 | @@ -309,6 +311,7 @@ | |
21 | ut_a(success); | |
22 | /*-------------------------*/ | |
23 | table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, FALSE); | |
24 | + table->n_mysql_handles_opened = 1; /* for pin */ | |
25 | ||
26 | dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0); | |
27 | dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); | |
28 | @@ -345,6 +348,7 @@ | |
29 | ut_a(success); | |
30 | /*-------------------------*/ | |
31 | table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, FALSE); | |
32 | + table->n_mysql_handles_opened = 1; /* for pin */ | |
33 | ||
34 | dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0); | |
35 | dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); | |
36 | diff -ru mysql-5.0.75_base/innobase/dict/dict0crea.c mysql-5.0.75/innobase/dict/dict0crea.c | |
37 | --- mysql-5.0.75_base/innobase/dict/dict0crea.c 2008-12-19 02:19:35.000000000 +0900 | |
38 | +++ mysql-5.0.75/innobase/dict/dict0crea.c 2009-01-23 19:41:38.000000000 +0900 | |
39 | @@ -1178,6 +1178,9 @@ | |
40 | /* Foreign constraint system tables have already been | |
41 | created, and they are ok */ | |
42 | ||
43 | + table1->n_mysql_handles_opened = 1; /* for pin */ | |
44 | + table2->n_mysql_handles_opened = 1; /* for pin */ | |
45 | + | |
46 | mutex_exit(&(dict_sys->mutex)); | |
47 | ||
48 | return(DB_SUCCESS); | |
49 | @@ -1266,6 +1269,11 @@ | |
50 | ||
51 | trx->op_info = ""; | |
52 | ||
53 | + table1 = dict_table_get_low("SYS_FOREIGN"); | |
54 | + table2 = dict_table_get_low("SYS_FOREIGN_COLS"); | |
55 | + table1->n_mysql_handles_opened = 1; /* for pin */ | |
56 | + table2->n_mysql_handles_opened = 1; /* for pin */ | |
57 | + | |
58 | row_mysql_unlock_data_dictionary(trx); | |
59 | ||
60 | trx_free_for_mysql(trx); | |
61 | diff -ru mysql-5.0.75_base/innobase/dict/dict0dict.c mysql-5.0.75/innobase/dict/dict0dict.c | |
62 | --- mysql-5.0.75_base/innobase/dict/dict0dict.c 2008-12-19 02:19:35.000000000 +0900 | |
63 | +++ mysql-5.0.75/innobase/dict/dict0dict.c 2009-01-26 16:03:29.000000000 +0900 | |
64 | @@ -638,6 +638,8 @@ | |
65 | mutex_enter(&(dict_sys->mutex)); | |
66 | ||
67 | table = dict_table_get_on_id_low(table_id, trx); | |
68 | + | |
69 | + dict_table_LRU_trim(table); | |
70 | ||
71 | mutex_exit(&(dict_sys->mutex)); | |
72 | ||
73 | @@ -752,6 +754,8 @@ | |
74 | ||
75 | table = dict_table_get_low(table_name); | |
76 | ||
77 | + dict_table_LRU_trim(table); | |
78 | + | |
79 | mutex_exit(&(dict_sys->mutex)); | |
80 | ||
81 | if (table != NULL) { | |
82 | @@ -787,6 +791,8 @@ | |
83 | table->n_mysql_handles_opened++; | |
84 | } | |
85 | ||
86 | + dict_table_LRU_trim(table); | |
87 | + | |
88 | mutex_exit(&(dict_sys->mutex)); | |
89 | ||
90 | if (table != NULL) { | |
91 | @@ -1267,20 +1273,64 @@ | |
92 | too much space. Currently not used! */ | |
93 | ||
94 | void | |
95 | -dict_table_LRU_trim(void) | |
96 | -/*=====================*/ | |
97 | +dict_table_LRU_trim( | |
98 | +/*================*/ | |
99 | + dict_table_t* self) | |
100 | { | |
101 | dict_table_t* table; | |
102 | dict_table_t* prev_table; | |
103 | + dict_foreign_t* foreign; | |
104 | + ulint n_removed; | |
105 | + ulint n_have_parent; | |
106 | + ulint cached_foreign_tables; | |
107 | ||
108 | - ut_error; | |
109 | + //ut_error; | |
110 | ||
111 | #ifdef UNIV_SYNC_DEBUG | |
112 | ut_ad(mutex_own(&(dict_sys->mutex))); | |
113 | #endif /* UNIV_SYNC_DEBUG */ | |
114 | ||
115 | +retry: | |
116 | + n_removed = n_have_parent = 0; | |
117 | table = UT_LIST_GET_LAST(dict_sys->table_LRU); | |
118 | ||
119 | + while ( srv_dict_size_limit && table | |
120 | + && ((dict_sys->table_hash->n_cells | |
121 | + + dict_sys->table_id_hash->n_cells | |
122 | + + dict_sys->col_hash->n_cells) * sizeof(hash_cell_t) | |
123 | + + dict_sys->size) > srv_dict_size_limit ) { | |
124 | + prev_table = UT_LIST_GET_PREV(table_LRU, table); | |
125 | + | |
126 | + if (table == self || table->n_mysql_handles_opened) | |
127 | + goto next_loop; | |
128 | + | |
129 | + cached_foreign_tables = 0; | |
130 | + foreign = UT_LIST_GET_FIRST(table->foreign_list); | |
131 | + while (foreign != NULL) { | |
132 | + if (foreign->referenced_table) | |
133 | + cached_foreign_tables++; | |
134 | + foreign = UT_LIST_GET_NEXT(foreign_list, foreign); | |
135 | + } | |
136 | + | |
137 | + /* TODO: use table->mem_fix also, if it becomes exact. */ | |
138 | + | |
139 | + if (cached_foreign_tables == 0) { | |
140 | + dict_table_remove_from_cache(table); | |
141 | + n_removed++; | |
142 | + } else { | |
143 | + n_have_parent++; | |
144 | + } | |
145 | +next_loop: | |
146 | + table = prev_table; | |
147 | + } | |
148 | + | |
149 | + if ( srv_dict_size_limit && n_have_parent && n_removed | |
150 | + && ((dict_sys->table_hash->n_cells | |
151 | + + dict_sys->table_id_hash->n_cells | |
152 | + + dict_sys->col_hash->n_cells) * sizeof(hash_cell_t) | |
153 | + + dict_sys->size) > srv_dict_size_limit ) | |
154 | + goto retry; | |
155 | +/* | |
156 | while (table && (dict_sys->size > | |
157 | buf_pool_get_max_size() / DICT_POOL_PER_VARYING)) { | |
158 | ||
159 | @@ -1292,6 +1341,7 @@ | |
160 | ||
161 | table = prev_table; | |
162 | } | |
163 | +*/ | |
164 | } | |
165 | ||
166 | /************************************************************************** | |
167 | diff -ru mysql-5.0.75_base/innobase/ibuf/ibuf0ibuf.c mysql-5.0.75/innobase/ibuf/ibuf0ibuf.c | |
168 | --- mysql-5.0.75_base/innobase/ibuf/ibuf0ibuf.c 2009-01-23 11:44:18.000000000 +0900 | |
169 | +++ mysql-5.0.75/innobase/ibuf/ibuf0ibuf.c 2009-01-23 19:22:54.000000000 +0900 | |
170 | @@ -535,6 +535,7 @@ | |
171 | sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space); | |
172 | /* use old-style record format for the insert buffer */ | |
173 | table = dict_mem_table_create(buf, space, 2, FALSE); | |
174 | + table->n_mysql_handles_opened = 1; /* for pin */ | |
175 | ||
176 | dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0); | |
177 | dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0); | |
178 | diff -ru mysql-5.0.75_base/innobase/include/dict0dict.h mysql-5.0.75/innobase/include/dict0dict.h | |
179 | --- mysql-5.0.75_base/innobase/include/dict0dict.h 2008-12-19 02:19:35.000000000 +0900 | |
180 | +++ mysql-5.0.75/innobase/include/dict0dict.h 2009-01-23 21:46:22.000000000 +0900 | |
181 | @@ -938,6 +938,11 @@ | |
182 | const char* ptr, /* in: scan from */ | |
183 | const char* string);/* in: look for this */ | |
184 | ||
185 | +void | |
186 | +dict_table_LRU_trim( | |
187 | +/*================*/ | |
188 | + dict_table_t* self); | |
189 | + | |
190 | /* Buffers for storing detailed information about the latest foreign key | |
191 | and unique key errors */ | |
192 | extern FILE* dict_foreign_err_file; | |
193 | diff -ru mysql-5.0.75_base/innobase/include/dict0dict.ic mysql-5.0.75/innobase/include/dict0dict.ic | |
194 | --- mysql-5.0.75_base/innobase/include/dict0dict.ic 2008-12-19 02:19:35.000000000 +0900 | |
195 | +++ mysql-5.0.75/innobase/include/dict0dict.ic 2009-01-23 18:35:55.000000000 +0900 | |
196 | @@ -533,6 +533,13 @@ | |
197 | ||
198 | HASH_SEARCH(name_hash, dict_sys->table_hash, table_fold, table, | |
199 | ut_strcmp(table->name, table_name) == 0); | |
200 | + | |
201 | + /* make young in table_LRU */ | |
202 | + if (table) { | |
203 | + UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table); | |
204 | + UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table); | |
205 | + } | |
206 | + | |
207 | return(table); | |
208 | } | |
209 | ||
210 | @@ -592,6 +599,10 @@ | |
211 | if (table != NULL) { | |
212 | table->mem_fix++; | |
213 | ||
214 | + /* make young in table_LRU */ | |
215 | + UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table); | |
216 | + UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table); | |
217 | + | |
218 | /* lock_push(trx, table, LOCK_DICT_MEM_FIX) */ | |
219 | } | |
220 | ||
221 | diff -ru mysql-5.0.75_base/innobase/include/srv0srv.h mysql-5.0.75/innobase/include/srv0srv.h | |
222 | --- mysql-5.0.75_base/innobase/include/srv0srv.h 2009-01-23 11:44:19.000000000 +0900 | |
223 | +++ mysql-5.0.75/innobase/include/srv0srv.h 2009-01-27 10:47:26.000000000 +0900 | |
224 | @@ -146,6 +146,8 @@ | |
225 | extern uint srv_read_ahead; | |
226 | extern ulint srv_adaptive_checkpoint; | |
227 | ||
228 | +extern ulint srv_dict_size_limit; | |
229 | + | |
230 | extern volatile ibool srv_io_pattern; | |
231 | extern ulong srv_io_pattern_trace; | |
232 | extern ulong srv_io_pattern_trace_running; | |
233 | @@ -545,6 +547,7 @@ | |
234 | ulint innodb_data_writes; | |
235 | ulint innodb_data_written; | |
236 | ulint innodb_data_reads; | |
237 | + ulint innodb_dict_tables; | |
238 | ulint innodb_buffer_pool_pages_total; | |
239 | ulint innodb_buffer_pool_pages_data; | |
240 | ulint innodb_buffer_pool_pages_dirty; | |
241 | diff -ru mysql-5.0.75_base/innobase/srv/srv0srv.c mysql-5.0.75/innobase/srv/srv0srv.c | |
242 | --- mysql-5.0.75_base/innobase/srv/srv0srv.c 2009-01-23 11:44:19.000000000 +0900 | |
243 | +++ mysql-5.0.75/innobase/srv/srv0srv.c 2009-01-27 10:52:19.000000000 +0900 | |
244 | @@ -345,6 +345,8 @@ | |
245 | uint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */ | |
246 | ulint srv_adaptive_checkpoint = 0; /* 0:disable 1:enable */ | |
247 | ||
248 | +ulint srv_dict_size_limit = 0; | |
249 | + | |
250 | volatile ibool srv_io_pattern = FALSE; | |
251 | ulint srv_io_pattern_trace = 0; | |
252 | ulint srv_io_pattern_trace_running = 0; | |
253 | @@ -1936,6 +1938,7 @@ | |
254 | export_vars.innodb_data_reads= os_n_file_reads; | |
255 | export_vars.innodb_data_writes= os_n_file_writes; | |
256 | export_vars.innodb_data_written= srv_data_written; | |
257 | + export_vars.innodb_dict_tables= (dict_sys ? UT_LIST_GET_LEN(dict_sys->table_LRU) : 0); | |
258 | export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets; | |
259 | export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests; | |
260 | export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free; | |
261 | diff -ru mysql-5.0.75_base/sql/ha_innodb.cc mysql-5.0.75/sql/ha_innodb.cc | |
262 | --- mysql-5.0.75_base/sql/ha_innodb.cc 2009-01-23 11:44:19.000000000 +0900 | |
263 | +++ mysql-5.0.75/sql/ha_innodb.cc 2009-01-27 10:54:08.000000000 +0900 | |
264 | @@ -288,6 +288,8 @@ | |
265 | (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG}, | |
266 | {"dblwr_writes", | |
267 | (char*) &export_vars.innodb_dblwr_writes, SHOW_LONG}, | |
268 | + {"dict_tables", | |
269 | + (char*) &export_vars.innodb_dict_tables, SHOW_LONG}, | |
270 | {"log_waits", | |
271 | (char*) &export_vars.innodb_log_waits, SHOW_LONG}, | |
272 | {"log_write_requests", | |
273 | diff -ru mysql-5.0.75_base/sql/ha_innodb.h mysql-5.0.75/sql/ha_innodb.h | |
274 | --- mysql-5.0.75_base/sql/ha_innodb.h 2009-01-23 11:44:19.000000000 +0900 | |
275 | +++ mysql-5.0.75/sql/ha_innodb.h 2009-01-26 15:49:37.000000000 +0900 | |
276 | @@ -242,6 +242,7 @@ | |
277 | extern ulong srv_flush_neighbor_pages; | |
278 | extern uint srv_read_ahead; | |
279 | extern ulong srv_adaptive_checkpoint; | |
280 | +extern ulong srv_dict_size_limit; | |
281 | extern ulong srv_show_locks_held; | |
282 | extern ulong srv_show_verbose_locks; | |
283 | extern ulong srv_io_pattern_trace; | |
284 | diff -ru mysql-5.0.75_base/sql/mysqld.cc mysql-5.0.75/sql/mysqld.cc | |
285 | --- mysql-5.0.75_base/sql/mysqld.cc 2009-01-23 11:44:19.000000000 +0900 | |
286 | +++ mysql-5.0.75/sql/mysqld.cc 2009-01-26 15:29:45.000000000 +0900 | |
287 | @@ -5053,6 +5053,7 @@ | |
288 | OPT_INNODB_ADAPTIVE_CHECKPOINT, | |
289 | OPT_INNODB_READ_IO_THREADS, | |
290 | OPT_INNODB_WRITE_IO_THREADS, | |
291 | + OPT_INNODB_DICT_SIZE_LIMIT, | |
292 | OPT_INNODB_ADAPTIVE_HASH_INDEX, | |
293 | OPT_RPL_MIRROR_BINLOG, | |
294 | OPT_SYNC_MIRROR_BINLOG, | |
295 | @@ -5406,6 +5407,10 @@ | |
296 | "Number of background write I/O threads in InnoDB.", | |
297 | (gptr*) &innobase_write_io_threads, (gptr*) &innobase_write_io_threads, | |
298 | 0, GET_LONG, REQUIRED_ARG, 1, 1, 64, 0, 0, 0}, | |
299 | + {"innodb_dict_size_limit", OPT_INNODB_DICT_SIZE_LIMIT, | |
300 | + "Limit the allocated memory for dictionary cache. (0: unlimited)", | |
301 | + (gptr*) &srv_dict_size_limit, (gptr*) &srv_dict_size_limit, 0, | |
302 | + GET_ULONG, REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 0 ,0}, | |
303 | {"innodb_io_pattern_trace", OPT_INNODB_IO_PATTERN_TRACE, | |
304 | "Create/Drop the internal hash table for IO pattern tracing.", | |
305 | (gptr*) &srv_io_pattern_trace, (gptr*) &srv_io_pattern_trace, | |
306 | diff -ru mysql-5.0.75_base/sql/set_var.cc mysql-5.0.75/sql/set_var.cc | |
307 | --- mysql-5.0.75_base/sql/set_var.cc 2009-01-23 11:44:19.000000000 +0900 | |
308 | +++ mysql-5.0.75/sql/set_var.cc 2009-01-26 15:46:45.000000000 +0900 | |
309 | @@ -522,6 +522,8 @@ | |
310 | &innodb_read_ahead_typelib, fix_innodb_read_ahead); | |
311 | sys_var_long_ptr sys_innodb_adaptive_checkpoint("innodb_adaptive_checkpoint", | |
312 | &srv_adaptive_checkpoint); | |
313 | +sys_var_long_ptr sys_innodb_dict_size_limit("innodb_dict_size_limit", | |
314 | + &srv_dict_size_limit); | |
315 | sys_var_long_ptr sys_innodb_show_locks_held( | |
316 | "innodb_show_locks_held", | |
317 | &srv_show_locks_held); | |
318 | @@ -905,6 +907,7 @@ | |
319 | &sys_innodb_flush_neighbor_pages, | |
320 | &sys_innodb_read_ahead, | |
321 | &sys_innodb_adaptive_checkpoint, | |
322 | + &sys_innodb_dict_size_limit, | |
323 | &sys_innodb_show_locks_held, | |
324 | &sys_innodb_show_verbose_locks, | |
325 | &sys_innodb_io_pattern_trace, | |
326 | @@ -1056,6 +1059,7 @@ | |
327 | {sys_innodb_adaptive_checkpoint.name, (char*) &sys_innodb_adaptive_checkpoint, SHOW_SYS}, | |
328 | {"innodb_read_io_threads", (char*) &innobase_read_io_threads, SHOW_LONG}, | |
329 | {"innodb_write_io_threads", (char*) &innobase_write_io_threads, SHOW_LONG}, | |
330 | + {sys_innodb_dict_size_limit.name, (char*) &sys_innodb_dict_size_limit, SHOW_SYS}, | |
331 | {sys_innodb_io_pattern_trace.name, (char*) &sys_innodb_io_pattern_trace, SHOW_SYS}, | |
332 | {sys_innodb_io_pattern_trace_running.name, (char*) &sys_innodb_io_pattern_trace_running, SHOW_SYS}, | |
333 | {sys_innodb_io_pattern_size_limit.name, (char*) &sys_innodb_io_pattern_size_limit, SHOW_SYS}, | |
334 | diff -ruN mysql-5.0.75_base/mysql-test/r/innodb_dict_size_limit.result mysql-5.0.75/mysql-test/r/innodb_dict_size_limit.result | |
335 | --- /dev/null 1970-01-01 09:00:00.000000000 +0900 | |
336 | +++ mysql-5.0.75/mysql-test/r/innodb_dict_size_limit.result 2009-01-27 11:43:46.000000000 +0900 | |
337 | @@ -0,0 +1,60 @@ | |
338 | +DROP TABLE IF EXISTS `test_5`; | |
339 | +DROP TABLE IF EXISTS `test_4`; | |
340 | +DROP TABLE IF EXISTS `test_3`; | |
341 | +DROP TABLE IF EXISTS `test_2`; | |
342 | +DROP TABLE IF EXISTS `test_1`; | |
343 | +SET storage_engine=InnoDB; | |
344 | +SET GLOBAL innodb_dict_size_limit=1; | |
345 | +FLUSH TABLES; | |
346 | +CREATE TABLE `test_1` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
347 | +CREATE TABLE `test_2` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
348 | +CREATE TABLE `test_3` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
349 | +CREATE TABLE `test_4` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
350 | +CREATE TABLE `test_5` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
351 | +ALTER TABLE `test_5` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_4`(`a`); | |
352 | +ALTER TABLE `test_4` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_3`(`a`); | |
353 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
354 | +Variable_name Value | |
355 | +Innodb_dict_tables 9 | |
356 | +FLUSH TABLES; | |
357 | +SELECT * FROM `test_1`; | |
358 | +a b | |
359 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
360 | +Variable_name Value | |
361 | +Innodb_dict_tables 8 | |
362 | +SELECT * FROM `test_3`; | |
363 | +a b | |
364 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
365 | +Variable_name Value | |
366 | +Innodb_dict_tables 11 | |
367 | +FLUSH TABLES; | |
368 | +SELECT * FROM `test_2`; | |
369 | +a b | |
370 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
371 | +Variable_name Value | |
372 | +Innodb_dict_tables 8 | |
373 | +SELECT * FROM `test_1`; | |
374 | +a b | |
375 | +FLUSH TABLES; | |
376 | +SELECT * FROM `test_4`; | |
377 | +a b | |
378 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
379 | +Variable_name Value | |
380 | +Innodb_dict_tables 9 | |
381 | +SELECT * FROM `test_3`; | |
382 | +a b | |
383 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
384 | +Variable_name Value | |
385 | +Innodb_dict_tables 10 | |
386 | +SET GLOBAL innodb_dict_size_limit=0; | |
387 | +FLUSH TABLES; | |
388 | +SELECT * FROM `test_2`; | |
389 | +a b | |
390 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
391 | +Variable_name Value | |
392 | +Innodb_dict_tables 11 | |
393 | +DROP TABLE `test_5`; | |
394 | +DROP TABLE `test_4`; | |
395 | +DROP TABLE `test_3`; | |
396 | +DROP TABLE `test_2`; | |
397 | +DROP TABLE `test_1`; | |
398 | diff -ruN mysql-5.0.75_base/mysql-test/t/innodb_dict_size_limit.test mysql-5.0.75/mysql-test/t/innodb_dict_size_limit.test | |
399 | --- /dev/null 1970-01-01 09:00:00.000000000 +0900 | |
400 | +++ mysql-5.0.75/mysql-test/t/innodb_dict_size_limit.test 2009-01-27 11:43:36.000000000 +0900 | |
401 | @@ -0,0 +1,63 @@ | |
402 | +# | |
403 | +# Test for new variable innodb_dict_size_limit; | |
404 | +# | |
405 | +-- source include/have_innodb.inc | |
406 | + | |
407 | +--disable_warnings | |
408 | +DROP TABLE IF EXISTS `test_5`; | |
409 | +DROP TABLE IF EXISTS `test_4`; | |
410 | +DROP TABLE IF EXISTS `test_3`; | |
411 | +DROP TABLE IF EXISTS `test_2`; | |
412 | +DROP TABLE IF EXISTS `test_1`; | |
413 | +--enable_warnings | |
414 | + | |
415 | +SET storage_engine=InnoDB; | |
416 | +SET GLOBAL innodb_dict_size_limit=1; | |
417 | + | |
418 | +FLUSH TABLES; | |
419 | + | |
420 | +CREATE TABLE `test_1` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
421 | +CREATE TABLE `test_2` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
422 | +CREATE TABLE `test_3` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
423 | +CREATE TABLE `test_4` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
424 | +CREATE TABLE `test_5` (`a` int, `b` int, PRIMARY KEY (`a`)); | |
425 | + | |
426 | +ALTER TABLE `test_5` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_4`(`a`); | |
427 | +ALTER TABLE `test_4` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_3`(`a`); | |
428 | + | |
429 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
430 | + | |
431 | +FLUSH TABLES; | |
432 | +SELECT * FROM `test_1`; | |
433 | + | |
434 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
435 | + | |
436 | +SELECT * FROM `test_3`; | |
437 | + | |
438 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
439 | + | |
440 | +FLUSH TABLES; | |
441 | +SELECT * FROM `test_2`; | |
442 | + | |
443 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
444 | + | |
445 | +SELECT * FROM `test_1`; | |
446 | +FLUSH TABLES; | |
447 | +SELECT * FROM `test_4`; | |
448 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
449 | + | |
450 | +SELECT * FROM `test_3`; | |
451 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
452 | + | |
453 | +SET GLOBAL innodb_dict_size_limit=0; | |
454 | +FLUSH TABLES; | |
455 | +SELECT * FROM `test_2`; | |
456 | + | |
457 | +SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables'; | |
458 | + | |
459 | +DROP TABLE `test_5`; | |
460 | +DROP TABLE `test_4`; | |
461 | +DROP TABLE `test_3`; | |
462 | +DROP TABLE `test_2`; | |
463 | +DROP TABLE `test_1`; | |
464 | + | |
465 | diff -ruN mysql-5.0.75_base/patch_info/innodb_dict_size_limit.info mysql-5.0.75/patch_info/innodb_dict_size_limit.info | |
466 | --- /dev/null 1970-01-01 09:00:00.000000000 +0900 | |
467 | +++ mysql-5.0.75/patch_info/innodb_dict_size_limit.info 2009-01-26 15:46:45.000000000 +0900 | |
468 | @@ -0,0 +1,9 @@ | |
469 | +File=innodb_dict_size_limit.patch | |
470 | +Name=Limit dictionary cache size | |
471 | +Version=1.0 | |
472 | +Author=Percona | |
473 | +License=GPL | |
474 | +Comment=Variable innodb_dict_size_limit in bytes | |
475 | +ChangeLog= | |
476 | +2009-01-26 | |
477 | +YK: Initial release |