|
| 1 | +--source include/have_tokudb.inc |
| 2 | + |
| 3 | +# |
| 4 | +# Create a table and get the underlying main ft file name |
| 5 | +# |
| 6 | +create table t1(id int auto_increment, name varchar(30), primary key(id)) engine=TokuDB; |
| 7 | +--let $ori_file= `select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 8 | + |
| 9 | +# |
| 10 | +# Case 1: alter create options that are ignored by TokuDB |
| 11 | +# |
| 12 | + |
| 13 | +# Alter table with min_rows |
| 14 | +alter table t1 min_rows = 8; |
| 15 | +show create table t1; |
| 16 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 17 | +--let $assert_text= underlying ft file name not changed after alter min_rows |
| 18 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 19 | +--source include/assert.inc |
| 20 | + |
| 21 | +# Alter table with max_rows |
| 22 | +alter table t1 max_rows = 100; |
| 23 | +show create table t1; |
| 24 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 25 | +--let $assert_text= underlying ft file name not changed after alter max_rows |
| 26 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 27 | +--source include/assert.inc |
| 28 | + |
| 29 | +# Alter table with avg_row_length |
| 30 | +alter table t1 avg_row_length = 100; |
| 31 | +show create table t1; |
| 32 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 33 | +--let $assert_text= underlying ft file name not changed after alter avg_row_length |
| 34 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 35 | +--source include/assert.inc |
| 36 | + |
| 37 | +# Alter table with pack_keys |
| 38 | +alter table t1 pack_keys = 1; |
| 39 | +show create table t1; |
| 40 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 41 | +--let $assert_text= underlying ft file name not changed after alter pack_keys |
| 42 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 43 | +--source include/assert.inc |
| 44 | + |
| 45 | +# Alter table with default character set |
| 46 | +alter table t1 character set = utf8; |
| 47 | +show create table t1; |
| 48 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 49 | +--let $assert_text= underlying ft file name not changed after alter character set |
| 50 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 51 | +--source include/assert.inc |
| 52 | + |
| 53 | +# Alter table with data directory |
| 54 | +alter table t1 data directory = '/tmp'; |
| 55 | +show create table t1; |
| 56 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 57 | +--let $assert_text= underlying ft file name not changed after alter data directory |
| 58 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 59 | +--source include/assert.inc |
| 60 | + |
| 61 | +# Alter table with index directory |
| 62 | +alter table t1 index directory = '/tmp'; |
| 63 | +show create table t1; |
| 64 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 65 | +--let $assert_text= underlying ft file name not changed after alter index directory |
| 66 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 67 | +--source include/assert.inc |
| 68 | + |
| 69 | +# Alter table with checksum |
| 70 | +alter table t1 checksum = 1; |
| 71 | +show create table t1; |
| 72 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 73 | +--let $assert_text= underlying ft file name not changed after alter checksum |
| 74 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 75 | +--source include/assert.inc |
| 76 | + |
| 77 | +# Alter table with delay_key_write |
| 78 | +alter table t1 delay_key_write=1; |
| 79 | +show create table t1; |
| 80 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 81 | +--let $assert_text= underlying ft file name not changed after alter delay_key_write |
| 82 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 83 | +--source include/assert.inc |
| 84 | + |
| 85 | +# Alter table with comment |
| 86 | +alter table t1 comment = 'test table'; |
| 87 | +show create table t1; |
| 88 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 89 | +--let $assert_text= underlying ft file name not changed after alter comment |
| 90 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 91 | +--source include/assert.inc |
| 92 | + |
| 93 | +# Alter table with password |
| 94 | +alter table t1 password = '123456'; |
| 95 | +show create table t1; |
| 96 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 97 | +--let $assert_text= underlying ft file name not changed after alter password |
| 98 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 99 | +--source include/assert.inc |
| 100 | + |
| 101 | +# Alter table with connection |
| 102 | +alter table t1 connection = '127.0.0.1:3306'; |
| 103 | +show create table t1; |
| 104 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 105 | +--let $assert_text= underlying ft file name not changed after alter connection |
| 106 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 107 | +--source include/assert.inc |
| 108 | + |
| 109 | +# Alter table with key_block_size |
| 110 | +alter table t1 key_block_size=32; |
| 111 | +show create table t1; |
| 112 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 113 | +--let $assert_text= underlying ft file name not changed after alter key_block_size |
| 114 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 115 | +--source include/assert.inc |
| 116 | + |
| 117 | +# Alter table with stats_persistent |
| 118 | +alter table t1 stats_persistent = 1; |
| 119 | +show create table t1; |
| 120 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 121 | +--let $assert_text= underlying ft file name not changed after alter stats_persistent |
| 122 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 123 | +--source include/assert.inc |
| 124 | + |
| 125 | +# Alter table with stats_auto_recalc |
| 126 | +alter table t1 stats_auto_recalc = 1; |
| 127 | +show create table t1; |
| 128 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 129 | +--let $assert_text= underlying ft file name not changed after alter stats_auto_recalc |
| 130 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 131 | +--source include/assert.inc |
| 132 | + |
| 133 | +# Alter table with stats_sample_pages |
| 134 | +alter table t1 stats_sample_pages = 1; |
| 135 | +show create table t1; |
| 136 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 137 | +--let $assert_text= underlying ft file name not changed after alter stats_sample_pages |
| 138 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 139 | +--source include/assert.inc |
| 140 | + |
| 141 | +# |
| 142 | +# Case 2: alter create options that only update meta info, i.e inplace |
| 143 | +# |
| 144 | + |
| 145 | +# Alter table with auto_increment |
| 146 | +alter table t1 auto_increment = 1000; |
| 147 | +show create table t1; |
| 148 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 149 | +--let $assert_text= underlying ft file name not changed after alter auto_increment |
| 150 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 151 | +--source include/assert.inc |
| 152 | + |
| 153 | +# Alter table with compression method |
| 154 | +alter table t1 row_format=tokudb_lzma; |
| 155 | +show create table t1; |
| 156 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 157 | +--let $assert_text= underlying ft file name not changed after alter compression method |
| 158 | +--let $assert_cond= "$ori_file" = "$new_file" |
| 159 | +--source include/assert.inc |
| 160 | + |
| 161 | +# |
| 162 | +# Case 3: alter create options that rebuild table using copy algorithm |
| 163 | +# |
| 164 | + |
| 165 | +# Alter table with engine type |
| 166 | +alter table t1 engine=TokuDB; |
| 167 | +show create table t1; |
| 168 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 169 | +--let $assert_text= underlying ft file name changed after alter engine type |
| 170 | +--let $assert_cond= "$ori_file" != "$new_file" |
| 171 | +--source include/assert.inc |
| 172 | + |
| 173 | +# Alter table with convert character |
| 174 | +alter table t1 convert to character set utf8; |
| 175 | +show create table t1; |
| 176 | +--let $new_file=`select internal_file_name from information_schema.tokudb_file_map where table_schema='test' and table_name='t1' and table_dictionary_name='main'` |
| 177 | +--let $assert_text= underlying ft file name changed after alter convert character |
| 178 | +--let $assert_cond= "$ori_file" != "$new_file" |
| 179 | +--source include/assert.inc |
| 180 | + |
| 181 | +# |
| 182 | +# clean up |
| 183 | +# |
| 184 | +drop table t1; |
0 commit comments