Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bugfix] Issue: #56 invisible index is not respected by slave under …
…row format Description ============ bug#88847, this issue is related to invisible indexes feature which we ported from 8.0 upstream. Invisible index is not considered by slave SQL row applier when searching index to use, and choosed anyway as long as the index is fit for update. Solution: ============ Make slave SQL applier thread respecting invisible indexes and don't choose them when searching index to use.
- Loading branch information
AliSQL
authored and
AliSQL
committed
Jan 23, 2018
1 parent
e337866
commit 229996d
Showing
5 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
mysql-test/suite/rds/r/bugfix_invisible_index_not_respected_under_row_format_issue56.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
create table t1(id int auto_increment, name varchar(30), key idx_id(id)) engine=innodb; | ||
insert into t1(name) values('MySQL'); | ||
insert into t1(name) values('InnoDB'); | ||
insert into t1(name) select a.name from t1 a, t1 b; | ||
insert into t1(name) select a.name from t1 a, t1 b; | ||
insert into t1(name) select a.name from t1 a, t1 b; | ||
delete from t1 where id > 1000 limit 100; | ||
select variable_value = 100 from information_schema.global_status where variable_name='Innodb_rows_read'; | ||
variable_value = 100 | ||
1 | ||
alter table t1 alter index idx_id invisible; | ||
delete from t1 where id > 1000 limit 100; | ||
select table_name, index_name, is_visible from information_schema.statistics where index_name = 'idx_id'; | ||
table_name index_name is_visible | ||
t1 idx_id NO | ||
select variable_value/100 > 100 from information_schema.global_status where variable_name='Innodb_rows_read'; | ||
variable_value/100 > 100 | ||
1 | ||
drop table t1; | ||
include/rpl_end.inc |
1 change: 1 addition & 0 deletions
1
...test/suite/rds/t/bugfix_invisible_index_not_respected_under_row_format_issue56-master.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--log-bin --binlog-format=row |
1 change: 1 addition & 0 deletions
1
...-test/suite/rds/t/bugfix_invisible_index_not_respected_under_row_format_issue56-slave.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--log-bin --binlog-format=row |
33 changes: 33 additions & 0 deletions
33
mysql-test/suite/rds/t/bugfix_invisible_index_not_respected_under_row_format_issue56.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--source include/master-slave.inc | ||
--source include/have_binlog_format_row.inc | ||
|
||
create table t1(id int auto_increment, name varchar(30), key idx_id(id)) engine=innodb; | ||
insert into t1(name) values('MySQL'); | ||
insert into t1(name) values('InnoDB'); | ||
insert into t1(name) select a.name from t1 a, t1 b; | ||
insert into t1(name) select a.name from t1 a, t1 b; | ||
insert into t1(name) select a.name from t1 a, t1 b; | ||
|
||
delete from t1 where id > 1000 limit 100; | ||
sync_slave_with_master; | ||
|
||
## on slave, Innodb_rows_read is equal with Innodb_rows_deleted(100) because idx_id is used | ||
select variable_value = 100 from information_schema.global_status where variable_name='Innodb_rows_read'; | ||
|
||
## change idx_id index on slave invisible | ||
alter table t1 alter index idx_id invisible; | ||
|
||
connection master; | ||
delete from t1 where id > 1000 limit 100; | ||
sync_slave_with_master; | ||
|
||
## make sure invisible attribute is respected | ||
## Innodb_rows_read is much bigger than Innodb_rows_deleted(100) because idx_id can not be used | ||
select table_name, index_name, is_visible from information_schema.statistics where index_name = 'idx_id'; | ||
select variable_value/100 > 100 from information_schema.global_status where variable_name='Innodb_rows_read'; | ||
|
||
## clean up | ||
connection master; | ||
drop table t1; | ||
sync_slave_with_master; | ||
--source include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters