| 1 |
####################################################################### |
| 2 |
# # |
| 3 |
# The aim of this test is to set up replication between a master and # |
| 4 |
# slave and test the basic functionality of invisible indexes which # |
| 5 |
# were introduced in WL#8697: Support for INVISIBLE indexes. # |
| 6 |
# # |
| 7 |
# Creation Date: 2016-05-12 # |
| 8 |
# Author: Deepa Dixit # |
| 9 |
# # |
| 10 |
####################################################################### |
| 11 |
|
| 12 |
--source include/have_myisam.inc |
| 13 |
|
| 14 |
--source include/master-slave.inc |
| 15 |
--connection master |
| 16 |
|
| 17 |
--echo # Create a table with an index |
| 18 |
|
| 19 |
CREATE TABLE t1 ( i INT , KEY (i)); |
| 20 |
INSERT INTO t1 VALUES (2),(3),(5),(7),(11),(13); |
| 21 |
ANALYZE TABLE t1; |
| 22 |
|
| 23 |
--source include/sync_slave_sql_with_master.inc |
| 24 |
--echo [Connection Slave] |
| 25 |
|
| 26 |
--echo # Check that the index is on the slave |
| 27 |
|
| 28 |
SHOW INDEXES FROM t1; |
| 29 |
|
| 30 |
--echo [Connection Master] |
| 31 |
--connection master |
| 32 |
|
| 33 |
--echo # Make the index invisible |
| 34 |
|
| 35 |
ALTER TABLE t1 ALTER INDEX i INVISIBLE; |
| 36 |
ANALYZE TABLE t1; |
| 37 |
|
| 38 |
--source include/sync_slave_sql_with_master.inc |
| 39 |
--echo [Connection Slave] |
| 40 |
|
| 41 |
--echo # Verify that the index is invisible on the slave |
| 42 |
|
| 43 |
SHOW INDEXES FROM t1; |
| 44 |
EXPLAIN SELECT * FROM t1 WHERE i=3; |
| 45 |
|
| 46 |
--echo [Connection Master] |
| 47 |
--connection master |
| 48 |
|
| 49 |
ALTER TABLE t1 ALTER INDEX i VISIBLE; |
| 50 |
ANALYZE TABLE t1; |
| 51 |
|
| 52 |
--source include/sync_slave_sql_with_master.inc |
| 53 |
--echo [Connection Slave] |
| 54 |
|
| 55 |
--echo # Verify that the index is visible on the slave |
| 56 |
|
| 57 |
SHOW INDEXES FROM t1; |
| 58 |
EXPLAIN SELECT * FROM t1 WHERE i=3; |
| 59 |
|
| 60 |
--echo [Connection Master] |
| 61 |
--connection master |
| 62 |
|
| 63 |
--echo # Create an invisible index on the table |
| 64 |
|
| 65 |
CREATE UNIQUE INDEX idx ON t1(i) INVISIBLE; |
| 66 |
|
| 67 |
--source include/sync_slave_sql_with_master.inc |
| 68 |
--echo [Connection Slave] |
| 69 |
|
| 70 |
--echo # Verify that the invisible is created on the slave |
| 71 |
|
| 72 |
SHOW INDEXES FROM t1; |
| 73 |
|
| 74 |
--echo [Connection Master] |
| 75 |
--connection master |
| 76 |
|
| 77 |
ALTER TABLE t1 DROP INDEX i, ALTER INDEX idx VISIBLE, ALTER INDEX idx INVISIBLE, ALTER INDEX idx VISIBLE; |
| 78 |
ANALYZE TABLE t1; |
| 79 |
|
| 80 |
--source include/sync_slave_sql_with_master.inc |
| 81 |
--echo [Connection Slave] |
| 82 |
|
| 83 |
SHOW INDEXES FROM t1; |
| 84 |
|
| 85 |
--echo [Connection Master] |
| 86 |
--connection master |
| 87 |
|
| 88 |
--echo # Alter the engine |
| 89 |
ALTER TABLE t1 ALTER INDEX idx INVISIBLE, ALTER INDEX idx VISIBLE; |
| 90 |
ANALYZE TABLE t1; |
| 91 |
|
| 92 |
--source include/sync_slave_sql_with_master.inc |
| 93 |
--echo [Connection Slave] |
| 94 |
|
| 95 |
SHOW INDEXES FROM t1; |
| 96 |
|
| 97 |
--echo [Connection Master] |
| 98 |
--connection master |
| 99 |
|
| 100 |
--echo # Clean up |
| 101 |
|
| 102 |
DROP TABLE t1; |
| 103 |
|
| 104 |
--source include/sync_slave_sql_with_master.inc |
| 105 |
--echo [Connection Slave] |
| 106 |
|
| 107 |
--error ER_NO_SUCH_TABLE |
| 108 |
SELECT * FROM t1; |
| 109 |
|
| 110 |
--source include/rpl_end.inc |