| 1 |
# |
| 2 |
# CACHE INDEX and LOAD INDEX INTO CACHE |
| 3 |
# |
| 4 |
|
| 5 |
--source have_engine.inc |
| 6 |
--source have_default_index.inc |
| 7 |
|
| 8 |
|
| 9 |
# Due to ancient MySQL bug#16111 we need to generate a unique cache name |
| 10 |
--let $cache_name = `SELECT CONNECTION_ID()` |
| 11 |
--let $cache_name = my_cache_$cache_name |
| 12 |
|
| 13 |
--disable_warnings |
| 14 |
DROP TABLE IF EXISTS t1, t2; |
| 15 |
--enable_warnings |
| 16 |
|
| 17 |
let $create_definition = |
| 18 |
a $int_indexed_col, |
| 19 |
b $char_col, |
| 20 |
$default_index (a) |
| 21 |
; |
| 22 |
--source create_table.inc |
| 23 |
if ($mysql_errname) |
| 24 |
{ |
| 25 |
--let $functionality = Indexes on INT columns |
| 26 |
--source unexpected_result.inc |
| 27 |
} |
| 28 |
if (!$mysql_errname) |
| 29 |
{ |
| 30 |
let $create_definition = |
| 31 |
a $int_col, |
| 32 |
b $char_indexed_col, |
| 33 |
$default_index (b) |
| 34 |
; |
| 35 |
let $table_name = t2; |
| 36 |
--source create_table.inc |
| 37 |
if ($mysql_errname) |
| 38 |
{ |
| 39 |
--let $functionality = Indexes on CHAR columns |
| 40 |
--source unexpected_result.inc |
| 41 |
} |
| 42 |
if (!$mysql_errname) |
| 43 |
{ |
| 44 |
--replace_result $cache_name <CACHE_NAME> |
| 45 |
--let $error_codes = ER_UNKNOWN_KEY_CACHE |
| 46 |
eval CACHE INDEX t1 INDEX (a), t2 IN $cache_name; |
| 47 |
--source check_errors.inc |
| 48 |
if ($mysql_errname != ER_UNKNOWN_KEY_CACHE) |
| 49 |
{ |
| 50 |
--let $functionality = Key cache or indexes |
| 51 |
--source unexpected_result.inc |
| 52 |
} |
| 53 |
|
| 54 |
--replace_result $cache_name <CACHE_NAME> |
| 55 |
eval SET GLOBAL $cache_name.key_buffer_size=128*1024; |
| 56 |
--replace_result $cache_name <CACHE_NAME> |
| 57 |
eval CACHE INDEX t1 INDEX (a), t2 IN $cache_name; |
| 58 |
if ($mysql_errname) |
| 59 |
{ |
| 60 |
--let $functionality = Indexes |
| 61 |
--source unexpected_result.inc |
| 62 |
} |
| 63 |
|
| 64 |
LOAD INDEX INTO CACHE t1, t2; |
| 65 |
if ($mysql_errname) |
| 66 |
{ |
| 67 |
--let $functionality = Indexes |
| 68 |
--source unexpected_result.inc |
| 69 |
} |
| 70 |
|
| 71 |
INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); |
| 72 |
--replace_result $cache_name <CACHE_NAME> |
| 73 |
eval SET GLOBAL $cache_name.key_buffer_size=8*1024; |
| 74 |
LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES; |
| 75 |
|
| 76 |
--replace_result $cache_name <CACHE_NAME> |
| 77 |
eval SET GLOBAL $cache_name.key_cache_age_threshold = 100, $cache_name.key_cache_block_size = 512, $cache_name.key_cache_division_limit = 1, $cache_name.key_cache_segments=2; |
| 78 |
INSERT INTO t1 (a,b) VALUES (5,'e'),(6,'f'); |
| 79 |
LOAD INDEX INTO CACHE t1; |
| 80 |
|
| 81 |
--replace_result $cache_name <CACHE_NAME> |
| 82 |
eval SET GLOBAL new_$cache_name.key_buffer_size=128*1024; |
| 83 |
--replace_result $cache_name <CACHE_NAME> |
| 84 |
eval CACHE INDEX t1 IN new_$cache_name; |
| 85 |
INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); |
| 86 |
LOAD INDEX INTO CACHE t1 IGNORE LEAVES; |
| 87 |
INSERT INTO t1 (a,b) VALUES (9,'i'); |
| 88 |
DROP TABLE t2; |
| 89 |
} |
| 90 |
DROP TABLE t1; |
| 91 |
} |
| 92 |
|
| 93 |
let $create_definition = |
| 94 |
a $int_indexed_col, |
| 95 |
b $char_indexed_col, |
| 96 |
$default_index (a), |
| 97 |
$default_index (b) |
| 98 |
; |
| 99 |
--source create_table.inc |
| 100 |
if ($mysql_errname) |
| 101 |
{ |
| 102 |
--let $functionality = Multiple keys or indexes on INT or CHAR columns |
| 103 |
--source unexpected_result.inc |
| 104 |
} |
| 105 |
if (!$mysql_errname) |
| 106 |
{ |
| 107 |
--replace_result $cache_name <CACHE_NAME> |
| 108 |
eval CACHE INDEX t1 IN $cache_name; |
| 109 |
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); |
| 110 |
LOAD INDEX INTO CACHE t1; |
| 111 |
|
| 112 |
DROP TABLE t1; |
| 113 |
let $create_definition = |
| 114 |
a $int_indexed_col, |
| 115 |
b $char_indexed_col, |
| 116 |
$default_index a_b (a,b) |
| 117 |
; |
| 118 |
--source create_table.inc |
| 119 |
if ($mysql_errname) |
| 120 |
{ |
| 121 |
--let $functionality = Multi-part keys |
| 122 |
--source unexpected_result.inc |
| 123 |
} |
| 124 |
|
| 125 |
--replace_result $cache_name <CACHE_NAME> |
| 126 |
eval CACHE INDEX t1 IN $cache_name; |
| 127 |
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); |
| 128 |
LOAD INDEX INTO CACHE t1; |
| 129 |
|
| 130 |
DROP TABLE t1; |
| 131 |
} |
| 132 |
|
| 133 |
# Cleanup |
| 134 |
|
| 135 |
--replace_result $cache_name <CACHE_NAME> |
| 136 |
eval SET GLOBAL $cache_name.key_buffer_size=0; |
| 137 |
--replace_result $cache_name <CACHE_NAME> |
| 138 |
eval SET GLOBAL new_$cache_name.key_buffer_size=0; |
| 139 |
|
| 140 |
|
| 141 |
--source cleanup_engine.inc |
| 142 |
|