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
1
diff -ruN a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
2
--- a/innobase/btr/btr0sea.c 2009-08-27 18:42:17.000000000 +0900
3
+++ b/innobase/btr/btr0sea.c 2009-08-27 18:43:11.000000000 +0900
4
@@ -1077,6 +1077,124 @@
7
/************************************************************************
8
+Drops a page hash index based on index */
11
+btr_search_drop_page_hash_index_on_index(
12
+/*=====================================*/
13
+ dict_index_t* index) /* in: record descriptor */
16
+ hash_table_t* table;
28
+ mem_heap_t* heap = NULL;
31
+ rw_lock_x_lock(&btr_search_latch);
32
+ mutex_enter(&buf_pool->mutex);
34
+ table = btr_search_sys->hash_index;
36
+ block = UT_LIST_GET_LAST(buf_pool->LRU);
38
+ while (block != NULL) {
39
+ if (block->index == index && block->is_hashed) {
40
+ page = block->frame;
42
+ /* from btr_search_drop_page_hash_index() */
43
+ n_fields = block->curr_n_fields;
44
+ n_bytes = block->curr_n_bytes;
46
+ ut_a(n_fields + n_bytes > 0);
48
+ n_recs = page_get_n_recs(page);
50
+ /* Calculate and cache fold values into an array for fast deletion
51
+ from the hash index */
53
+ folds = mem_alloc(n_recs * sizeof(ulint));
57
+ rec = page_get_infimum_rec(page);
58
+ rec = page_rec_get_next(rec);
60
+ tree_id = btr_page_get_index_id(page);
62
+ ut_a(0 == ut_dulint_cmp(tree_id, index->id));
68
+ while (!page_rec_is_supremum(rec)) {
69
+ /* FIXME: in a mixed tree, not all records may have enough
71
+ offsets = rec_get_offsets(rec, index, offsets,
72
+ n_fields + (n_bytes > 0), &heap);
73
+ ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
74
+ fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
76
+ if (fold == prev_fold && prev_fold != 0) {
81
+ /* Remove all hash nodes pointing to this page from the
84
+ folds[n_cached] = fold;
87
+ rec = page_rec_get_next(rec);
91
+ for (i = 0; i < n_cached; i++) {
93
+ ha_remove_all_nodes_to_page(table, folds[i], page);
96
+ ut_a(index->search_info->ref_count > 0);
97
+ index->search_info->ref_count--;
99
+ block->is_hashed = FALSE;
100
+ block->index = NULL;
102
+ if (UNIV_UNLIKELY(block->n_pointers)) {
104
+ ut_print_timestamp(stderr);
106
+" InnoDB: Corruption of adaptive hash index. After dropping\n"
107
+"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
108
+ index->name, (ulong) block->n_pointers);
114
+ block = UT_LIST_GET_PREV(LRU, block);
117
+ mutex_exit(&buf_pool->mutex);
118
+ rw_lock_x_unlock(&btr_search_latch);
120
+ if (UNIV_LIKELY_NULL(heap)) {
121
+ mem_heap_free(heap);
125
+/************************************************************************
126
Drops a page hash index when a page is freed from a fseg to the file system.
127
Drops possible hash index if the page happens to be in the buffer pool. */
129
diff -ruN a/innobase/dict/dict0boot.c b/innobase/dict/dict0boot.c
130
--- a/innobase/dict/dict0boot.c 2009-07-07 21:53:58.000000000 +0900
131
+++ b/innobase/dict/dict0boot.c 2009-08-27 18:42:59.000000000 +0900
4
132
@@ -247,6 +247,7 @@
6
134
/*-------------------------*/
34
162
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
35
163
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
164
diff -ruN a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
165
--- a/innobase/dict/dict0crea.c 2009-07-07 21:53:58.000000000 +0900
166
+++ b/innobase/dict/dict0crea.c 2009-08-27 18:42:59.000000000 +0900
39
167
@@ -1178,6 +1178,9 @@
40
168
/* Foreign constraint system tables have already been
41
169
created, and they are ok */
166
294
/**************************************************************************
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
295
@@ -1565,6 +1616,10 @@
296
#ifdef UNIV_SYNC_DEBUG
297
ut_ad(mutex_own(&(dict_sys->mutex)));
298
#endif /* UNIV_SYNC_DEBUG */
299
+ /* remove all entry of the index from adaptive hash index,
300
+ because removing from adaptive hash index needs dict_index */
301
+ if (srv_use_adaptive_hash_indexes && srv_dict_size_limit)
302
+ btr_search_drop_page_hash_index_on_index(index);
304
/* We always create search info whether or not adaptive
305
hash index is enabled or not. */
306
diff -ruN a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
307
--- a/innobase/ibuf/ibuf0ibuf.c 2009-08-27 18:42:17.000000000 +0900
308
+++ b/innobase/ibuf/ibuf0ibuf.c 2009-08-27 18:42:59.000000000 +0900
170
309
@@ -535,6 +535,7 @@
171
310
sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space);
172
311
/* use old-style record format for the insert buffer */
176
315
dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0);
177
316
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
317
diff -ruN a/innobase/include/btr0sea.h b/innobase/include/btr0sea.h
318
--- a/innobase/include/btr0sea.h 2009-07-07 21:54:00.000000000 +0900
319
+++ b/innobase/include/btr0sea.h 2009-08-27 18:43:11.000000000 +0900
321
/*============================*/
322
page_t* page); /* in: index page, s- or x-latched */
323
/************************************************************************
324
+Drops a page hash index based on index */
327
+btr_search_drop_page_hash_index_on_index(
328
+/*=====================================*/
329
+ dict_index_t* index); /* in: record descriptor */
330
+/************************************************************************
331
Drops a page hash index when a page is freed from a fseg to the file system.
332
Drops possible hash index if the page happens to be in the buffer pool. */
334
diff -ruN a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
335
--- a/innobase/include/dict0dict.h 2009-07-07 21:54:01.000000000 +0900
336
+++ b/innobase/include/dict0dict.h 2009-08-27 18:42:59.000000000 +0900
181
337
@@ -938,6 +938,11 @@
182
338
const char* ptr, /* in: scan from */
183
339
const char* string);/* in: look for this */
218
374
/* lock_push(trx, table, LOCK_DICT_MEM_FIX) */
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
377
diff -ruN a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
378
--- a/innobase/include/srv0srv.h 2009-08-27 18:42:17.000000000 +0900
379
+++ b/innobase/include/srv0srv.h 2009-08-27 18:42:59.000000000 +0900
225
381
extern uint srv_read_ahead;
226
extern ulint srv_adaptive_checkpoint;
382
extern uint srv_adaptive_checkpoint;
228
384
+extern ulint srv_dict_size_limit;
230
386
extern volatile ibool srv_io_pattern;
231
387
extern ulong srv_io_pattern_trace;
232
388
extern ulong srv_io_pattern_trace_running;
234
390
ulint innodb_data_writes;
235
391
ulint innodb_data_written;
236
392
ulint innodb_data_reads;
238
394
ulint innodb_buffer_pool_pages_total;
239
395
ulint innodb_buffer_pool_pages_data;
240
396
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
397
diff -ruN a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
398
--- a/innobase/srv/srv0srv.c 2009-08-27 18:42:17.000000000 +0900
399
+++ b/innobase/srv/srv0srv.c 2009-08-27 18:42:59.000000000 +0900
245
401
uint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
246
ulint srv_adaptive_checkpoint = 0; /* 0:disable 1:enable */
402
uint srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimate */
248
404
+ulint srv_dict_size_limit = 0;
250
406
volatile ibool srv_io_pattern = FALSE;
251
407
ulint srv_io_pattern_trace = 0;
252
408
ulint srv_io_pattern_trace_running = 0;
253
@@ -1936,6 +1938,7 @@
409
@@ -1953,6 +1955,7 @@
254
410
export_vars.innodb_data_reads= os_n_file_reads;
255
411
export_vars.innodb_data_writes= os_n_file_writes;
256
412
export_vars.innodb_data_written= srv_data_written;
258
414
export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets;
259
415
export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests;
260
416
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
417
diff -ruN a/mysql-test/r/innodb_dict_size_limit.result b/mysql-test/r/innodb_dict_size_limit.result
418
--- /dev/null 1970-01-01 09:00:00.000000000 +0900
419
+++ b/mysql-test/r/innodb_dict_size_limit.result 2009-08-27 18:42:59.000000000 +0900
421
+DROP TABLE IF EXISTS `test_5`;
422
+DROP TABLE IF EXISTS `test_4`;
423
+DROP TABLE IF EXISTS `test_3`;
424
+DROP TABLE IF EXISTS `test_2`;
425
+DROP TABLE IF EXISTS `test_1`;
426
+SET storage_engine=InnoDB;
427
+SET GLOBAL innodb_dict_size_limit=1;
429
+CREATE TABLE `test_1` (`a` int, `b` int, PRIMARY KEY (`a`));
430
+CREATE TABLE `test_2` (`a` int, `b` int, PRIMARY KEY (`a`));
431
+CREATE TABLE `test_3` (`a` int, `b` int, PRIMARY KEY (`a`));
432
+CREATE TABLE `test_4` (`a` int, `b` int, PRIMARY KEY (`a`));
433
+CREATE TABLE `test_5` (`a` int, `b` int, PRIMARY KEY (`a`));
434
+ALTER TABLE `test_5` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_4`(`a`);
435
+ALTER TABLE `test_4` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_3`(`a`);
436
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
438
+Innodb_dict_tables 9
440
+SELECT * FROM `test_1`;
442
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
444
+Innodb_dict_tables 8
445
+SELECT * FROM `test_3`;
447
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
449
+Innodb_dict_tables 11
451
+SELECT * FROM `test_2`;
453
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
455
+Innodb_dict_tables 8
456
+SELECT * FROM `test_1`;
459
+SELECT * FROM `test_4`;
461
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
463
+Innodb_dict_tables 9
464
+SELECT * FROM `test_3`;
466
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
468
+Innodb_dict_tables 10
469
+SET GLOBAL innodb_dict_size_limit=0;
471
+SELECT * FROM `test_2`;
473
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
475
+Innodb_dict_tables 11
476
+DROP TABLE `test_5`;
477
+DROP TABLE `test_4`;
478
+DROP TABLE `test_3`;
479
+DROP TABLE `test_2`;
480
+DROP TABLE `test_1`;
481
diff -ruN a/mysql-test/t/innodb_dict_size_limit.test b/mysql-test/t/innodb_dict_size_limit.test
482
--- /dev/null 1970-01-01 09:00:00.000000000 +0900
483
+++ b/mysql-test/t/innodb_dict_size_limit.test 2009-08-27 18:42:59.000000000 +0900
486
+# Test for new variable innodb_dict_size_limit;
488
+-- source include/have_innodb.inc
491
+DROP TABLE IF EXISTS `test_5`;
492
+DROP TABLE IF EXISTS `test_4`;
493
+DROP TABLE IF EXISTS `test_3`;
494
+DROP TABLE IF EXISTS `test_2`;
495
+DROP TABLE IF EXISTS `test_1`;
498
+SET storage_engine=InnoDB;
499
+SET GLOBAL innodb_dict_size_limit=1;
503
+CREATE TABLE `test_1` (`a` int, `b` int, PRIMARY KEY (`a`));
504
+CREATE TABLE `test_2` (`a` int, `b` int, PRIMARY KEY (`a`));
505
+CREATE TABLE `test_3` (`a` int, `b` int, PRIMARY KEY (`a`));
506
+CREATE TABLE `test_4` (`a` int, `b` int, PRIMARY KEY (`a`));
507
+CREATE TABLE `test_5` (`a` int, `b` int, PRIMARY KEY (`a`));
509
+ALTER TABLE `test_5` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_4`(`a`);
510
+ALTER TABLE `test_4` ADD CONSTRAINT FOREIGN KEY(`b`) REFERENCES `test_3`(`a`);
512
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
515
+SELECT * FROM `test_1`;
517
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
519
+SELECT * FROM `test_3`;
521
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
524
+SELECT * FROM `test_2`;
526
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
528
+SELECT * FROM `test_1`;
530
+SELECT * FROM `test_4`;
531
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
533
+SELECT * FROM `test_3`;
534
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
536
+SET GLOBAL innodb_dict_size_limit=0;
538
+SELECT * FROM `test_2`;
540
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
542
+DROP TABLE `test_5`;
543
+DROP TABLE `test_4`;
544
+DROP TABLE `test_3`;
545
+DROP TABLE `test_2`;
546
+DROP TABLE `test_1`;
548
diff -ruN a/patch_info/innodb_dict_size_limit.info b/patch_info/innodb_dict_size_limit.info
549
--- /dev/null 1970-01-01 09:00:00.000000000 +0900
550
+++ b/patch_info/innodb_dict_size_limit.info 2009-08-27 18:42:59.000000000 +0900
552
+File=innodb_dict_size_limit.patch
553
+Name=Limit dictionary cache size
557
+Comment=Variable innodb_dict_size_limit in bytes
561
diff -ruN a/sql/ha_innodb.cc b/sql/ha_innodb.cc
562
--- a/sql/ha_innodb.cc 2009-08-27 18:42:17.000000000 +0900
563
+++ b/sql/ha_innodb.cc 2009-08-27 18:42:59.000000000 +0900
264
564
@@ -288,6 +288,8 @@
265
565
(char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
271
571
(char*) &export_vars.innodb_log_waits, SHOW_LONG},
272
572
{"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
277
extern ulong srv_flush_neighbor_pages;
573
diff -ruN a/sql/ha_innodb.h b/sql/ha_innodb.h
574
--- a/sql/ha_innodb.h 2009-08-27 18:42:17.000000000 +0900
575
+++ b/sql/ha_innodb.h 2009-08-27 18:42:59.000000000 +0900
577
extern ulong srv_enable_unsafe_group_commit;
278
578
extern uint srv_read_ahead;
279
extern ulong srv_adaptive_checkpoint;
579
extern uint srv_adaptive_checkpoint;
280
580
+extern ulong srv_dict_size_limit;
281
581
extern ulong srv_show_locks_held;
282
582
extern ulong srv_show_verbose_locks;
283
583
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 @@
584
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
585
--- a/sql/mysqld.cc 2009-08-27 18:42:17.000000000 +0900
586
+++ b/sql/mysqld.cc 2009-08-27 18:42:59.000000000 +0900
587
@@ -5101,6 +5101,7 @@
288
588
OPT_INNODB_ADAPTIVE_CHECKPOINT,
289
589
OPT_INNODB_READ_IO_THREADS,
290
590
OPT_INNODB_WRITE_IO_THREADS,
291
591
+ OPT_INNODB_DICT_SIZE_LIMIT,
292
592
OPT_INNODB_ADAPTIVE_HASH_INDEX,
293
OPT_RPL_MIRROR_BINLOG,
294
OPT_SYNC_MIRROR_BINLOG,
295
@@ -5406,6 +5407,10 @@
594
OPT_INNODB_USE_LEGACY_CARDINALITY_ALGORITHM
595
@@ -5464,6 +5465,10 @@
296
596
"Number of background write I/O threads in InnoDB.",
297
597
(gptr*) &innobase_write_io_threads, (gptr*) &innobase_write_io_threads,
298
0, GET_LONG, REQUIRED_ARG, 1, 1, 64, 0, 0, 0},
598
0, GET_LONG, REQUIRED_ARG, 8, 1, 64, 0, 0, 0},
299
599
+ {"innodb_dict_size_limit", OPT_INNODB_DICT_SIZE_LIMIT,
300
600
+ "Limit the allocated memory for dictionary cache. (0: unlimited)",
301
601
+ (gptr*) &srv_dict_size_limit, (gptr*) &srv_dict_size_limit, 0,
303
603
{"innodb_io_pattern_trace", OPT_INNODB_IO_PATTERN_TRACE,
304
604
"Create/Drop the internal hash table for IO pattern tracing.",
305
605
(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
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);
606
diff -ruN a/sql/set_var.cc b/sql/set_var.cc
607
--- a/sql/set_var.cc 2009-08-27 18:42:17.000000000 +0900
608
+++ b/sql/set_var.cc 2009-08-27 18:42:59.000000000 +0900
610
sys_var_enum sys_innodb_adaptive_checkpoint("innodb_adaptive_checkpoint",
611
&srv_adaptive_checkpoint,
612
&innodb_adaptive_checkpoint_typelib, fix_innodb_adaptive_checkpoint);
313
613
+sys_var_long_ptr sys_innodb_dict_size_limit("innodb_dict_size_limit",
314
614
+ &srv_dict_size_limit);
315
615
sys_var_long_ptr sys_innodb_show_locks_held(
316
616
"innodb_show_locks_held",
317
617
&srv_show_locks_held);
319
&sys_innodb_flush_neighbor_pages,
320
619
&sys_innodb_read_ahead,
620
&sys_innodb_enable_unsafe_group_commit,
321
621
&sys_innodb_adaptive_checkpoint,
322
622
+ &sys_innodb_dict_size_limit,
323
623
&sys_innodb_show_locks_held,
324
624
&sys_innodb_show_verbose_locks,
325
625
&sys_innodb_io_pattern_trace,
326
@@ -1056,6 +1059,7 @@
626
@@ -1084,6 +1087,7 @@
327
627
{sys_innodb_adaptive_checkpoint.name, (char*) &sys_innodb_adaptive_checkpoint, SHOW_SYS},
328
628
{"innodb_read_io_threads", (char*) &innobase_read_io_threads, SHOW_LONG},
329
629
{"innodb_write_io_threads", (char*) &innobase_write_io_threads, SHOW_LONG},
331
631
{sys_innodb_io_pattern_trace.name, (char*) &sys_innodb_io_pattern_trace, SHOW_SYS},
332
632
{sys_innodb_io_pattern_trace_running.name, (char*) &sys_innodb_io_pattern_trace_running, SHOW_SYS},
333
633
{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
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;
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';
355
+Innodb_dict_tables 9
357
+SELECT * FROM `test_1`;
359
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
361
+Innodb_dict_tables 8
362
+SELECT * FROM `test_3`;
364
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
366
+Innodb_dict_tables 11
368
+SELECT * FROM `test_2`;
370
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
372
+Innodb_dict_tables 8
373
+SELECT * FROM `test_1`;
376
+SELECT * FROM `test_4`;
378
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
380
+Innodb_dict_tables 9
381
+SELECT * FROM `test_3`;
383
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
385
+Innodb_dict_tables 10
386
+SET GLOBAL innodb_dict_size_limit=0;
388
+SELECT * FROM `test_2`;
390
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
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
403
+# Test for new variable innodb_dict_size_limit;
405
+-- source include/have_innodb.inc
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`;
415
+SET storage_engine=InnoDB;
416
+SET GLOBAL innodb_dict_size_limit=1;
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`));
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`);
429
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
432
+SELECT * FROM `test_1`;
434
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
436
+SELECT * FROM `test_3`;
438
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
441
+SELECT * FROM `test_2`;
443
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
445
+SELECT * FROM `test_1`;
447
+SELECT * FROM `test_4`;
448
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
450
+SELECT * FROM `test_3`;
451
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
453
+SET GLOBAL innodb_dict_size_limit=0;
455
+SELECT * FROM `test_2`;
457
+SHOW GLOBAL STATUS LIKE 'Innodb_dict_tables';
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`;
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
469
+File=innodb_dict_size_limit.patch
470
+Name=Limit dictionary cache size
474
+Comment=Variable innodb_dict_size_limit in bytes