# Copyright 2023 PingCAP, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. mysql> drop table if exists test.t1; mysql> drop table if exists test.t2; mysql> drop table if exists test.t3; mysql> create table test.t1 (pk char(10) charset utf8mb4 collate utf8mb4_general_ci primary key clustered, col_1 int); mysql> alter table test.t1 set tiflash replica 1; mysql> create table test.t2 (col_1 int, col_2 char(10) charset utf8mb4 collate utf8mb4_general_ci, col_3 int, primary key (col_1, col_2(5)) clustered); mysql> alter table test.t2 set tiflash replica 1; mysql> create table test.t3 (col_1 char(10) charset utf8mb4 collate utf8mb4_general_ci, col_2 int, col_3 int, primary key (col_1(5), col_2) clustered); mysql> alter table test.t3 set tiflash replica 1; func> wait_table test t1 func> wait_table test t2 func> wait_table test t3 mysql> insert into test.t1 values('ab', 1),('Ab', 2),('AB', 3); ERROR 1062 (23000) at line 1: Duplicate entry 'Ab' for key 't1.PRIMARY' mysql> insert into test.t1 values('ab', 1),('AC', 2),('Ad', 3); mysql> insert into test.t2 values(1, 'ababababab', 1),(2, 'ACACACACAC', 2),(2, 'AdAdAdAdAd', 3); mysql> insert into test.t3 values('ababababab', 1, 1),('ACACACACAC', 2, 2),('AdAdAdAdAd', 3, 3); mysql> set tidb_isolation_read_engines=tiflash;select * from test.t1; +----+-------+ | pk | col_1 | +----+-------+ | ab | 1 | | AC | 2 | | Ad | 3 | +----+-------+ mysql> update test.t1 set col_1 = 5 where pk = 'AB'; mysql> set tidb_isolation_read_engines=tiflash;select * from test.t1; +----+-------+ | pk | col_1 | +----+-------+ | ab | 5 | | AC | 2 | | Ad | 3 | +----+-------+ mysql> set tidb_isolation_read_engines=tiflash;select * from test.t2; +-------+------------+-------+ | col_1 | col_2 | col_3 | +-------+------------+-------+ | 1 | ababababab | 1 | | 2 | ACACACACAC | 2 | | 2 | AdAdAdAdAd | 3 | +-------+------------+-------+ mysql> update test.t2 set col_3 = 5 where col_2 like 'AB%'; mysql> set tidb_isolation_read_engines=tiflash;select * from test.t2; +-------+------------+-------+ | col_1 | col_2 | col_3 | +-------+------------+-------+ | 1 | ababababab | 5 | | 2 | ACACACACAC | 2 | | 2 | AdAdAdAdAd | 3 | +-------+------------+-------+ mysql> set tidb_isolation_read_engines=tiflash;select * from test.t3; +------------+-------+-------+ | col_1 | col_2 | col_3 | +------------+-------+-------+ | ababababab | 1 | 1 | | ACACACACAC | 2 | 2 | | AdAdAdAdAd | 3 | 3 | +------------+-------+-------+ mysql> update test.t3 set col_3 = 5 where col_1 like 'AB%'; mysql> set tidb_isolation_read_engines=tiflash;select * from test.t3; +------------+-------+-------+ | col_1 | col_2 | col_3 | +------------+-------+-------+ | ababababab | 1 | 5 | | ACACACACAC | 2 | 2 | | AdAdAdAdAd | 3 | 3 | +------------+-------+-------+ mysql> drop table if exists test.t1 mysql> drop table if exists test.t2 mysql> drop table if exists test.t3