Skip to content

Commit 349aa36

Browse files
AliSQLAliSQL
authored andcommitted
[bugfix] Issue: #62 alter TokuDB table comment rebuild whole engine data
Alter TokuDB table comment should not using copying algorithm and rebuild whole engine data, only FRM definition should be changed. Make `ha_tokudb::check_if_supported_inplace_alter()` return `HA_ALTER_INPLACE_EXCLUSIVE_LOCK` while altering comment, and mysql server will invoke `ha_tokudb::inplace_alter_table` which will do nothing for altering comment. Besides table comment, there are many other create options that should be ignored by TokuDB, and they are all handled in this patch. Btw, this patch has been pushed to TokuDB upstream. This patch also contains a postfix for bug#88847, which handles cases when UK or Key with auto-inc fileld is invisible.
1 parent 66c68db commit 349aa36

File tree

4 files changed

+411
-3
lines changed

4 files changed

+411
-3
lines changed
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
create table t1(id int auto_increment, name varchar(30), primary key(id)) engine=TokuDB;
2+
alter table t1 min_rows = 8;
3+
show create table t1;
4+
Table Create Table
5+
t1 CREATE TABLE `t1` (
6+
`id` int(11) NOT NULL AUTO_INCREMENT,
7+
`name` varchar(30) DEFAULT NULL,
8+
PRIMARY KEY (`id`)
9+
) ENGINE=TokuDB DEFAULT CHARSET=latin1 MIN_ROWS=8
10+
include/assert.inc [underlying ft file name not changed after alter min_rows]
11+
alter table t1 max_rows = 100;
12+
show create table t1;
13+
Table Create Table
14+
t1 CREATE TABLE `t1` (
15+
`id` int(11) NOT NULL AUTO_INCREMENT,
16+
`name` varchar(30) DEFAULT NULL,
17+
PRIMARY KEY (`id`)
18+
) ENGINE=TokuDB DEFAULT CHARSET=latin1 MIN_ROWS=8 MAX_ROWS=100
19+
include/assert.inc [underlying ft file name not changed after alter max_rows]
20+
alter table t1 avg_row_length = 100;
21+
show create table t1;
22+
Table Create Table
23+
t1 CREATE TABLE `t1` (
24+
`id` int(11) NOT NULL AUTO_INCREMENT,
25+
`name` varchar(30) DEFAULT NULL,
26+
PRIMARY KEY (`id`)
27+
) ENGINE=TokuDB DEFAULT CHARSET=latin1 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100
28+
include/assert.inc [underlying ft file name not changed after alter avg_row_length]
29+
alter table t1 pack_keys = 1;
30+
show create table t1;
31+
Table Create Table
32+
t1 CREATE TABLE `t1` (
33+
`id` int(11) NOT NULL AUTO_INCREMENT,
34+
`name` varchar(30) DEFAULT NULL,
35+
PRIMARY KEY (`id`)
36+
) ENGINE=TokuDB DEFAULT CHARSET=latin1 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1
37+
include/assert.inc [underlying ft file name not changed after alter pack_keys]
38+
alter table t1 character set = utf8;
39+
show create table t1;
40+
Table Create Table
41+
t1 CREATE TABLE `t1` (
42+
`id` int(11) NOT NULL AUTO_INCREMENT,
43+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
44+
PRIMARY KEY (`id`)
45+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1
46+
include/assert.inc [underlying ft file name not changed after alter character set]
47+
alter table t1 data directory = '/tmp';
48+
Warnings:
49+
Warning 1618 <DATA DIRECTORY> option ignored
50+
show create table t1;
51+
Table Create Table
52+
t1 CREATE TABLE `t1` (
53+
`id` int(11) NOT NULL AUTO_INCREMENT,
54+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
55+
PRIMARY KEY (`id`)
56+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1
57+
include/assert.inc [underlying ft file name not changed after alter data directory]
58+
alter table t1 index directory = '/tmp';
59+
Warnings:
60+
Warning 1618 <INDEX DIRECTORY> option ignored
61+
show create table t1;
62+
Table Create Table
63+
t1 CREATE TABLE `t1` (
64+
`id` int(11) NOT NULL AUTO_INCREMENT,
65+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
66+
PRIMARY KEY (`id`)
67+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1
68+
include/assert.inc [underlying ft file name not changed after alter index directory]
69+
alter table t1 checksum = 1;
70+
show create table t1;
71+
Table Create Table
72+
t1 CREATE TABLE `t1` (
73+
`id` int(11) NOT NULL AUTO_INCREMENT,
74+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
75+
PRIMARY KEY (`id`)
76+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 CHECKSUM=1
77+
include/assert.inc [underlying ft file name not changed after alter checksum]
78+
alter table t1 delay_key_write=1;
79+
show create table t1;
80+
Table Create Table
81+
t1 CREATE TABLE `t1` (
82+
`id` int(11) NOT NULL AUTO_INCREMENT,
83+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
84+
PRIMARY KEY (`id`)
85+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1
86+
include/assert.inc [underlying ft file name not changed after alter delay_key_write]
87+
alter table t1 comment = 'test table';
88+
show create table t1;
89+
Table Create Table
90+
t1 CREATE TABLE `t1` (
91+
`id` int(11) NOT NULL AUTO_INCREMENT,
92+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
93+
PRIMARY KEY (`id`)
94+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 COMMENT='test table'
95+
include/assert.inc [underlying ft file name not changed after alter comment]
96+
alter table t1 password = '123456';
97+
show create table t1;
98+
Table Create Table
99+
t1 CREATE TABLE `t1` (
100+
`id` int(11) NOT NULL AUTO_INCREMENT,
101+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
102+
PRIMARY KEY (`id`)
103+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 COMMENT='test table'
104+
include/assert.inc [underlying ft file name not changed after alter password]
105+
alter table t1 connection = '127.0.0.1:3306';
106+
show create table t1;
107+
Table Create Table
108+
t1 CREATE TABLE `t1` (
109+
`id` int(11) NOT NULL AUTO_INCREMENT,
110+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
111+
PRIMARY KEY (`id`)
112+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 COMMENT='test table' CONNECTION='127.0.0.1:3306'
113+
include/assert.inc [underlying ft file name not changed after alter connection]
114+
alter table t1 key_block_size=32;
115+
show create table t1;
116+
Table Create Table
117+
t1 CREATE TABLE `t1` (
118+
`id` int(11) NOT NULL AUTO_INCREMENT,
119+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
120+
PRIMARY KEY (`id`)
121+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
122+
include/assert.inc [underlying ft file name not changed after alter key_block_size]
123+
alter table t1 stats_persistent = 1;
124+
show create table t1;
125+
Table Create Table
126+
t1 CREATE TABLE `t1` (
127+
`id` int(11) NOT NULL AUTO_INCREMENT,
128+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
129+
PRIMARY KEY (`id`)
130+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
131+
include/assert.inc [underlying ft file name not changed after alter stats_persistent]
132+
alter table t1 stats_auto_recalc = 1;
133+
show create table t1;
134+
Table Create Table
135+
t1 CREATE TABLE `t1` (
136+
`id` int(11) NOT NULL AUTO_INCREMENT,
137+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
138+
PRIMARY KEY (`id`)
139+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 STATS_AUTO_RECALC=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
140+
include/assert.inc [underlying ft file name not changed after alter stats_auto_recalc]
141+
alter table t1 stats_sample_pages = 1;
142+
show create table t1;
143+
Table Create Table
144+
t1 CREATE TABLE `t1` (
145+
`id` int(11) NOT NULL AUTO_INCREMENT,
146+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
147+
PRIMARY KEY (`id`)
148+
) ENGINE=TokuDB DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 STATS_AUTO_RECALC=1 STATS_SAMPLE_PAGES=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
149+
include/assert.inc [underlying ft file name not changed after alter stats_sample_pages]
150+
alter table t1 auto_increment = 1000;
151+
show create table t1;
152+
Table Create Table
153+
t1 CREATE TABLE `t1` (
154+
`id` int(11) NOT NULL AUTO_INCREMENT,
155+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
156+
PRIMARY KEY (`id`)
157+
) ENGINE=TokuDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 STATS_AUTO_RECALC=1 STATS_SAMPLE_PAGES=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
158+
include/assert.inc [underlying ft file name not changed after alter auto_increment]
159+
alter table t1 row_format=tokudb_lzma;
160+
show create table t1;
161+
Table Create Table
162+
t1 CREATE TABLE `t1` (
163+
`id` int(11) NOT NULL AUTO_INCREMENT,
164+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
165+
PRIMARY KEY (`id`)
166+
) ENGINE=TokuDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 STATS_AUTO_RECALC=1 STATS_SAMPLE_PAGES=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=TOKUDB_LZMA KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
167+
include/assert.inc [underlying ft file name not changed after alter compression method]
168+
alter table t1 engine=TokuDB;
169+
show create table t1;
170+
Table Create Table
171+
t1 CREATE TABLE `t1` (
172+
`id` int(11) NOT NULL AUTO_INCREMENT,
173+
`name` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
174+
PRIMARY KEY (`id`)
175+
) ENGINE=TokuDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 STATS_AUTO_RECALC=1 STATS_SAMPLE_PAGES=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
176+
include/assert.inc [underlying ft file name changed after alter engine type]
177+
alter table t1 convert to character set utf8;
178+
show create table t1;
179+
Table Create Table
180+
t1 CREATE TABLE `t1` (
181+
`id` int(11) NOT NULL AUTO_INCREMENT,
182+
`name` varchar(30) DEFAULT NULL,
183+
PRIMARY KEY (`id`)
184+
) ENGINE=TokuDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 MIN_ROWS=8 MAX_ROWS=100 AVG_ROW_LENGTH=100 PACK_KEYS=1 STATS_PERSISTENT=1 STATS_AUTO_RECALC=1 STATS_SAMPLE_PAGES=1 CHECKSUM=1 DELAY_KEY_WRITE=1 KEY_BLOCK_SIZE=32 COMMENT='test table' CONNECTION='127.0.0.1:3306'
185+
include/assert.inc [underlying ft file name changed after alter convert character]
186+
drop table t1;
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
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;

sql/log_event.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9908,7 +9908,7 @@ search_key_in_table(TABLE *table, MY_BITMAP *bi_cols, uint key_type)
99089908
- Skip primary keys
99099909
*/
99109910
if (!((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME) ||
9911-
(key == table->s->primary_key))
9911+
(key == table->s->primary_key) || !(table->s->usable_indexes().is_set(key)))
99129912
continue;
99139913
res= are_all_columns_signaled_for_key(keyinfo, bi_cols) ?
99149914
key : MAX_KEY;
@@ -9924,7 +9924,8 @@ search_key_in_table(TABLE *table, MY_BITMAP *bi_cols, uint key_type)
99249924
DBUG_PRINT("debug", ("Searching for K."));
99259925

99269926
/* auot_increment index has higher priority over other secondary indexes */
9927-
if (table->found_next_number_field)
9927+
if (table->found_next_number_field &&
9928+
table->s->usable_indexes().is_set(table->s->next_number_index))
99289929
{
99299930
keyinfo= table->key_info + table->s->next_number_index;
99309931

0 commit comments

Comments
 (0)