pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.28k stars 5.84k forks source link

clustered index: Data is corrupted, missing data for NOT NULL column #19143

Closed ChenPeng2013 closed 4 years ago

ChenPeng2013 commented 4 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
set tidb_enable_clustered_index=1;
DROP TABLE IF EXISTS `t`;
CREATE TABLE `t` (
  `c_int` int(11) NOT NULL,
  `c_int2` int(11) DEFAULT NULL,
  `c_str` varchar(40) NOT NULL,
  `c_str2` varchar(40) DEFAULT NULL,
  `c_datetime` datetime DEFAULT NULL,
  `c_datetime2` datetime DEFAULT NULL,
  `c_timestamp` timestamp NULL DEFAULT NULL,
  `c_timestamp2` timestamp NULL DEFAULT NULL,
  `c_double` double DEFAULT NULL,
  `c_double2` double DEFAULT NULL,
  `c_decimal` decimal(12,6) DEFAULT NULL,
  PRIMARY KEY (`c_int`,`c_str`),
  KEY `c_int_2` (`c_int`,`c_int2`),
  UNIQUE KEY `c_int2` (`c_int2`,`c_int`),
  KEY `c_str` (`c_str`),
  KEY `c_str2` (`c_str2`),
  KEY `c_int_3` (`c_int`,`c_str`),
  KEY `c_int_4` (`c_int`,`c_datetime`),
  UNIQUE KEY `c_decimal` (`c_decimal`),
  KEY `c_datetime` (`c_datetime`),
  KEY `c_datetime2` (`c_datetime2`),
  KEY `c_timestamp2` (`c_timestamp2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

INSERT INTO `t` VALUES (1,1,'laughing thompson','pensive cartwright','2020-06-26 06:39:46','2020-06-09 07:04:39','2020-04-15 01:08:17','2020-01-13 13:31:43',63.889258,85.363891,6.784000),(2,2,'gracious stonebraker','relaxed sutherland','2020-03-23 15:01:33','2020-02-07 16:41:47','2020-02-28 18:45:59','2020-03-21 20:45:07',97.174044,38.143057,0.554000),(4,1,'frosty hypatia','competent chandrasekhar','2020-04-10 05:42:28','2020-05-24 18:49:31','2020-05-10 17:19:06','2020-02-24 18:43:37',26.974051,82.67091,5.836000),(5,5,'stoic ellis','admiring ishizaka','2020-06-05 19:33:07','2020-03-25 15:58:46','2020-05-23 18:39:50','2020-06-22 04:04:13',41.33704,12.782612,6.652000),(6,5,'dreamy franklin','clever black','2020-01-20 22:09:25','2020-02-09 04:28:53','2020-01-24 22:25:19','2020-03-28 19:34:25',50.022685,34.785979,6.992000),(7,2,'objective brown','flamboyant jennings','2020-05-13 09:16:30','2020-06-06 07:11:18','2020-06-18 08:49:29','2020-02-29 21:32:11',70.389617,81.973416,5.418000),(8,7,'pedantic jackson','reverent cartwright','2020-03-16 14:17:47','2020-02-03 09:17:32','2020-01-14 05:50:01','2020-04-09 14:16:44',32.254282,26.008989,2.097000),(9,2,'priceless bartik','competent margulis','2020-04-02 02:04:12','2020-04-30 17:23:13','2020-05-11 12:12:44','2020-06-04 07:16:15',1.458014,26.663187,9.990000),(10,8,'optimistic hellman','boring kapitsa','2020-05-01 15:22:27','2020-06-10 19:52:06','2020-04-26 07:30:31','2020-04-13 13:50:41',5.692866,70.624673,8.380000),(11,8,'hopeful mendeleev','wizardly pare','2020-02-19 17:44:40','2020-06-09 09:04:06','2020-06-20 04:00:26','2020-02-06 19:49:39',93.092659,37.128947,5.716000),(12,10,'distracted agnesi','affectionate snyder','2020-02-26 02:07:38','2020-01-27 22:06:00','2020-06-17 13:55:27','2020-03-28 18:31:26',7.629426,69.388076,9.783000),(14,10,'amazing cohen','wonderful galileo','2020-03-01 06:30:27','2020-01-21 03:22:32','2020-01-16 18:45:06','2020-05-14 21:29:01',15.450194,97.397937,2.978000),(14,11,'angry kepler','eloquent lovelace',NULL,NULL,'2020-02-10 05:46:53','2020-05-15 22:14:44',NULL,NULL,1.813000),(15,10,'goofy carson','interesting tereshkova','2020-03-03 21:17:28','2020-01-15 04:44:54','2020-03-17 19:11:06','2020-02-11 12:51:14',54.457695,80.827438,6.944000),(16,16,'unruffled herschel','pedantic golick',NULL,NULL,'2020-01-18 21:24:45','2020-02-16 03:50:43',NULL,NULL,1.145000),(23,1,'inspiring franklin','hopeful hellman','2020-04-01 14:34:13','2020-02-23 23:13:28','2020-05-17 19:09:21','2020-03-27 17:08:34',88.755284,87.607118,3.226000);
admin check table t;

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

mysql> admin check table t;
Query OK, 0 rows affected (0.06 sec)

3. What did you see instead (Required)

mysql> admin check table t;
ERROR 1105 (HY000): [components/tidb_query_vec_executors/src/table_scan_executor.rs:369]: Data is corrupted, missing data for NOT NULL column (offset = 1)

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-798-gd941ff5cc
Edition: Community
Git Commit Hash: d941ff5cc8b4babf9dcfdd91b66a5c53b798c122
Git Branch: master
UTC Build Time: 2020-07-18 05:54:02
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
ChenPeng2013 commented 4 years ago

duplicated with https://github.com/pingcap/tidb/issues/19091