1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
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 connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
[connection master]
# Create a table with functional index
CREATE TABLE t1 (col1 INT, INDEX ((ABS(col1))));
INSERT INTO t1 VALUES (-12);
# Show the hidden columns so we can see the computed value.
SET SESSION debug="+d,show_hidden_columns";
SELECT * FROM t1;
col1 !hidden!functional_index!0!0
-12 12
SET SESSION debug="-d,show_hidden_columns";
# Sync slave with master, and verify that the table exists on the slave.
include/sync_slave_sql_with_master.inc
# Show the hidden columns so we can see that the computed value is
# reflected on the slave.
SET SESSION debug="+d,show_hidden_columns";
SELECT * FROM t1;
col1 !hidden!functional_index!0!0
-12 12
SET SESSION debug="-d,show_hidden_columns";
EXPLAIN SELECT col1 FROM t1 WHERE ABS(col1) = 12;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ref functional_index functional_index 5 const 1 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (abs(`col1`) = 12)
SET SESSION debug="+d,show_hidden_columns";
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`col1` int DEFAULT NULL,
`!hidden!functional_index!0!0` int GENERATED ALWAYS AS (abs(`col1`)) VIRTUAL,
KEY `functional_index` ((abs(`col1`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SET SESSION debug="-d,show_hidden_columns";
[connection master]
DROP TABLE t1;
SET @start_row_image_value= @@session.binlog_row_image;
# Try with various row_image values
SET @@session.binlog_row_image= MINIMAL;
CREATE TABLE t1 (col1 INT, INDEX ((ABS(col1))));
INSERT INTO t1 VALUES (-12);
include/sync_slave_sql_with_master.inc
# Show the hidden columns so we can see that the computed value is
# reflected on the slave.
SET SESSION debug="+d,show_hidden_columns";
SELECT * FROM t1;
col1 !hidden!functional_index!0!0
-12 12
EXPLAIN SELECT col1 FROM t1 WHERE ABS(col1) = 12;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ref functional_index functional_index 5 const 1 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (abs(`col1`) = 12)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`col1` int DEFAULT NULL,
`!hidden!functional_index!0!0` int GENERATED ALWAYS AS (abs(`col1`)) VIRTUAL,
KEY `functional_index` ((abs(`col1`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SET SESSION debug="-d,show_hidden_columns";
[connection master]
DROP TABLE t1;
SET @@session.binlog_row_image= noblob;
CREATE TABLE t1 (col1 INT, INDEX ((ABS(col1))));
INSERT INTO t1 VALUES (-12);
include/sync_slave_sql_with_master.inc
# Show the hidden columns so we can see that the computed value is
# reflected on the slave.
SET SESSION debug="+d,show_hidden_columns";
SELECT * FROM t1;
col1 !hidden!functional_index!0!0
-12 12
EXPLAIN SELECT col1 FROM t1 WHERE ABS(col1) = 12;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ref functional_index functional_index 5 const 1 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (abs(`col1`) = 12)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`col1` int DEFAULT NULL,
`!hidden!functional_index!0!0` int GENERATED ALWAYS AS (abs(`col1`)) VIRTUAL,
KEY `functional_index` ((abs(`col1`)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SET SESSION debug="-d,show_hidden_columns";
[connection master]
DROP TABLE t1;
SET @@session.binlog_row_image= @start_row_image_value;
#
# Bug#28207118 UNIQUE FUNCTIONAL INDEX IS NOT CORRECTLY BEING CONSIDERED
# ON SLAVE.
#
CREATE TABLE t1 (col1 INT, UNIQUE INDEX idx ((col1 + col1)));
include/sync_slave_sql_with_master.inc
INSERT INTO t1 (col1) VALUES (1);
[connection master]
call mtr.add_suppression("Replica SQL for channel '': .*Could not execute Write_rows event on table test.t1");
call mtr.add_suppression("Replica SQL for channel '': .*Error 'Duplicate entry '2'");
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
INSERT INTO t1 (col1) VALUES (1), (2);
[connection slave]
include/wait_for_slave_sql_error.inc [errno=1062]
DELETE FROM t1;
START SLAVE;
Warnings:
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
[connection master]
INSERT INTO t1 (col1) VALUES (3), (4);
SELECT col1 FROM t1;
col1
1
2
3
4
include/sync_slave_sql_with_master.inc
SELECT col1 FROM t1;
col1
1
2
3
4
[connection master]
DROP TABLE t1;
#
# Bug#28218073 SLAVE CRASHES WHEN AN UPDATE ON SLAVE REFERS TO COLUMN
# USED IN FUNCTIONAL INDEX.
#
CREATE TABLE t(a INT, b INT, UNIQUE INDEX c ((a + b)));
INSERT INTO t VALUES (1, 2);
INSERT INTO t VALUES (2, 3);
INSERT INTO t VALUES (3, 4);
include/sync_slave_sql_with_master.inc
SELECT a, b FROM t;
a b
1 2
2 3
3 4
UPDATE t SET b = 5 WHERE b - a = 1;
ERROR 23000: Duplicate entry '7' for key 't.c'
SELECT a, b FROM t;
a b
1 2
2 3
3 4
[connection master]
DROP TABLE t;
#
# Bug#28218481 UPDATE TABLE ON SLAVE DOESN'T UPDATE WHEN FUNCTIONAL INDEX
# MATCH EXPR IN WHERE.
#
CREATE TABLE t (a INT, b INT, INDEX c ((a + b)));
INSERT INTO t VALUES (3, 5);
INSERT INTO t VALUES (1, 2);
INSERT INTO t VALUES (2, 7);
SELECT a, b FROM t;
a b
3 5
1 2
2 7
UPDATE t SET a = 4 WHERE a + b = 3;
SELECT a, b FROM t;
a b
3 5
4 2
2 7
include/sync_slave_sql_with_master.inc
SELECT a, b FROM t;
a b
3 5
4 2
2 7
UPDATE t SET a = 9 WHERE a + b = 8;
SELECT a, b FROM t;
a b
9 5
4 2
2 7
[connection master]
DROP TABLE t;
#
# Bug#28243453 ASSERTION`MAP->BITMAP&&MAP2->BITMAP&&MAP->N_BITS==MAP2->
# N_BITS' FAILED ON SLAVE
#
CREATE TABLE t(a INT, b INT);
include/sync_slave_sql_with_master.inc
ALTER TABLE t ADD UNIQUE INDEX i ((a + b));
[connection master]
INSERT INTO t VALUES (1, 2);
include/sync_slave_sql_with_master.inc
SELECT a, b FROM t;
a b
1 2
[connection master]
DROP TABLE t;
#
# Bug#29317684 REPLICATION IS SENSITIVE TO ORDER OF HIDDEN COLUMNS FOR
# FUNCTIONAL INDEXES
#
# What we want to see here, is that the order of the columns (both
# hidden and visible) are the same on master and slave, even though
# the columns are created in different order.
#
# Note that this bug is only visible with row-based replication.
SET @@session.sql_log_bin = 0;
CREATE TABLE t (a INT, INDEX ((a+1)));
ALTER TABLE t ADD COLUMN b INT;
SET @@session.sql_log_bin = 1;
[connection slave]
SET @@session.sql_log_bin = 0;
CREATE TABLE t (a INT, b INT, INDEX ((a+1)));
SET @@session.sql_log_bin = 1;
[connection master]
INSERT INTO t VALUES (1, 2);
include/sync_slave_sql_with_master.inc
include/diff_tables.inc [master:test.t,slave:test.t]
[connection master]
DROP TABLE t;
#
# Bug#107366 REPLICATION ERROR WITH HASH_SCAN ROW SEARCH ALGORITHM FOR
# FUNCTIONAL INDEXES
[connection master]
CREATE TABLE t1 (
id INT,
c1 JSON NOT NULL,
c2 INT,
KEY comp ((CAST(c1 AS UNSIGNED ARRAY)))
) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,'[1046, 2995]',1);
UPDATE t1 SET c2=2;
include/sync_slave_sql_with_master.inc
include/assert.inc [Table t1 was updated]
[connection master]
DROP TABLE t1;
include/rpl_end.inc
|