Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong default value behavior in disaggregated mode #9084

Closed
breezewish opened this issue May 24, 2024 · 1 comment · Fixed by #9086
Closed

Wrong default value behavior in disaggregated mode #9084

breezewish opened this issue May 24, 2024 · 1 comment · Fixed by #9086
Assignees
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. severity/critical type/bug The issue is confirmed as a bug.

Comments

@breezewish
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

tiup playground:nightly nightly --mode=tidb-cse
mysql> create table c(a int);
Query OK, 0 rows affected (0.06 sec)

mysql> insert into c values (1);
Query OK, 1 row affected (0.00 sec)

mysql> alter table c set tiflash replica 1;
Query OK, 0 rows affected (0.04 sec)

mysql> select * from information_schema.tiflash_replica;
+--------------+------------+----------+---------------+-----------------+-----------+----------+
| TABLE_SCHEMA | TABLE_NAME | TABLE_ID | REPLICA_COUNT | LOCATION_LABELS | AVAILABLE | PROGRESS |
+--------------+------------+----------+---------------+-----------------+-----------+----------+
| test         | c          |      104 |             1 |                 |         1 |        1 |
+--------------+------------+----------+---------------+-----------------+-----------+----------+
1 row in set (0.00 sec)

mysql> alter table c add column test_c1 int default 0;
Query OK, 0 rows affected (0.10 sec)

mysql> set @@tidb_isolation_read_engines="tidb,tiflash";
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from c where test_c1 = 0;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.04 sec)

mysql> select count(*) from c where test_c1 is null;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.01 sec)

mysql> set @@tidb_isolation_read_engines="tidb,tikv";
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from c where test_c1 = 0;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.01 sec)

mysql> select count(*) from c where test_c1 is null;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.01 sec)

2. What did you expect to see? (Required)

TiFlash and TiKV should produce same result.

3. What did you see instead (Required)

4. What is your TiFlash version? (Required)

nightly

@Lloyd-Pottiger
Copy link
Contributor

Lloyd-Pottiger commented May 27, 2024

Another case.

use test;
CREATE TABLE `relationships` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id2` int(11) NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci AUTO_INCREMENT=90001;
insert into relationships (id2) values (1), (2), (3);
insert into relationships (id2) select id2 from relationships;
insert into relationships (id2) select id2 from relationships;
insert into relationships (id2) select id2 from relationships;
insert into relationships (id2) select id2 from relationships;
insert into relationships (id2) select id2 from relationships;
insert into relationships (id2) select id2 from relationships;
alter table relationships set tiflash replica 1;
alter table relationships add column weight int default '0';
select * from information_schema.tiflash_replica where TABLE_NAME = 'relationships';
set @@tidb_isolation_read_engines='tiflash'; select count(*) from relationships where weight = 0;

ti-chi-bot bot pushed a commit that referenced this issue May 27, 2024
close #9084

fix the issue that query result may be wrong when query missing columns with default value in Disaggrate TiFlash.

Signed-off-by: Lloyd-Pottiger <[email protected]>

Co-authored-by: JaySon <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue May 27, 2024
close #9084, close #9085

fix the issue that query result may be wrong when query missing columns with default value in Disaggrate TiFlash.

Signed-off-by: Lloyd-Pottiger <[email protected]>

Co-authored-by: Lloyd-Pottiger <[email protected]>
Co-authored-by: Lloyd-Pottiger <[email protected]>
Co-authored-by: JaySon <[email protected]>
ti-chi-bot bot pushed a commit that referenced this issue May 27, 2024
close #9084, close #9085

fix the issue that query result may be wrong when query missing columns with default value in Disaggrate TiFlash.

Signed-off-by: Lloyd-Pottiger <[email protected]>

Co-authored-by: Lloyd-Pottiger <[email protected]>
Co-authored-by: Lloyd-Pottiger <[email protected]>
Co-authored-by: JaySon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants