However, users could create such "NULL" value in the "primary key" column by following steps
-- create table with `source` is nullable
create table test.t_case (
`case_no` varchar(32) not null,
`source` varchar(20) default null,
`p` varchar(12) DEFAULT NULL,
primary key (`case_no`)
);
-- insert some data and left `source` to be empty
insert into test.t_case(case_no)
values ("1"), ("2"), ("3"), ("4");
-- drop the primary key, fill the `source` to be non-empty
alter table t_case drop primary key;
update test.t_case set `source` = '' where `source` is NULL;
-- add new primary key with case_no and source
alter table t_case add primary key (case_no, source);
-- send the snapshot data to tiflash
alter table t_case set tiflash replica 1;
2. What did you expect to see? (Required)
No exception thrown
3. What did you see instead (Required)
Exception throw with "Parameter out of bound in IColumnString::insertRangeFrom method" in v4.0.x/v5.0.x/v5.1.x/v5.2.x/v5.3.x/v5.4.0~v5.4.1/v6.1.0
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
TiFlash assumes all values in the column with "primary key" flag are non-null value. https://github.com/pingcap/tiflash/blob/6d0cbc8cc78b4048fb88e0845d6c9c2881e01515/dbms/src/Storages/Transaction/RowCodec.cpp#L323-L330
However, users could create such "NULL" value in the "primary key" column by following steps
2. What did you expect to see? (Required)
No exception thrown
3. What did you see instead (Required)
Exception throw with "Parameter out of bound in IColumnString::insertRangeFrom method" in v4.0.x/v5.0.x/v5.1.x/v5.2.x/v5.3.x/v5.4.0~v5.4.1/v6.1.0
Exception message after v5.4.2/v6.1.1/v6.2.0
4. What is your TiFlash version? (Required)
v5.4.1