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

index out of range in expBackoffEstimation #44369

Closed wjhuang2016 closed 1 year ago

wjhuang2016 commented 1 year ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `d5e0b6ce` (
  `a955e35b` bigint(20) DEFAULT '-6448110846193342193',
  `27d82a06` decimal(18,3) DEFAULT '405766648520663.724',
  `d53b8d8f` tinyblob DEFAULT NULL,
  `4684c1fb` bigint(20) NOT NULL DEFAULT '8308541400823053725',
  `e106f232` enum('b7ru','3','nho','ar2jd','qnnxr','z96ic','bw9','krb3','sdfs7','g','fhms') DEFAULT 'sdfs7',
  `ae526ab0` double NOT NULL DEFAULT '1.1508673011957564',
  `6659e6dd` time DEFAULT '22:45:39',
  `0e4be72e` tinyint(4) DEFAULT '108',
  `a2e927ab` int(11) DEFAULT '1314714707',
  `1b636754` char(205) DEFAULT 'nr2l2uedp396dwceufbe3tg1nlb9uq1yrq3xys4dqojno5hx9obuc4b5ihyinj7w28wn16cd1j6ugpdt00tzf6a8yw068x6ae6w156dzi9soctbpi71dbpg37uwxxukdfwkztcp0cbpuwox3dcma5y95e389sy986fv6fqe7f91v1bver099sudrvd0pcj5a',
  `1664c0ec` double DEFAULT '1.246418084758543',
  PRIMARY KEY (`4684c1fb`,`ae526ab0`) /*T![clustered_index] CLUSTERED */,
  KEY `f237276f` (`ae526ab0`),
  KEY `c5617bbc` (`4684c1fb`),
  KEY `232b2ed5` (`a955e35b`),
  UNIQUE KEY `8f90e270` (`4684c1fb`,`a955e35b`,`ae526ab0`,`a2e927ab`,`1664c0ec`),
  KEY `a6a10569` (`e106f232`),
  UNIQUE KEY `da269690` (`4684c1fb`,`1664c0ec`,`1b636754`),
  UNIQUE KEY `14c9d22a` (`a2e927ab`,`a955e35b`,`4684c1fb`,`e106f232`,`6659e6dd`),
  KEY `ac678956` (`1664c0ec`)
) ENGINE=InnoDB DEFAULT CHARSET=ascii COLLATE=ascii_bin COMMENT='98c51344'
PARTITION BY HASH (`4684c1fb`) PARTITIONS 9;

CREATE TABLE `df743dc0` (
  `315d85fc` char(235) DEFAULT 'pn9hlzot7c705hun3lft7ngsxfl4264w7jx3kc8d9z7bd5xwtgbinkfzrwti5lc7eglqcp2pn0xfiug367e37nc9k22jobrcgx6mtdfwxezad57j41f9w6kcbmkg5xycjyg90tdfqiwi8ogk5juhb7idh6c5',
  `d6d159c7` float DEFAULT '1.944891',
  `ee7ec4f9` decimal(33,1) DEFAULT '-70829769057641653952326444816118.0',
  `aac2f389` enum('l','i7','fep','pm','rp4','b','a','5','psy','dv','i4x') NOT NULL DEFAULT 'pm',
  `07e5d823` bigint(20) DEFAULT '7658638948516014551',
  `8eb6ab6d` timestamp DEFAULT '2003-10-14 06:13:46',
  `7f7befff` time DEFAULT '05:58:30',
  PRIMARY KEY (`aac2f389`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `29b5e1a2` (`aac2f389`),
  UNIQUE KEY `d2d9bfa3` (`aac2f389`,`7f7befff`,`8eb6ab6d`,`07e5d823`),
  KEY `bd59e062` (`ee7ec4f9`,`7f7befff`,`8eb6ab6d`,`07e5d823`,`aac2f389`),
  UNIQUE KEY `76c161b2` (`8eb6ab6d`,`aac2f389`,`7f7befff`,`07e5d823`),
  KEY `1a029398` (`07e5d823`),
  KEY `476d95a6` (`7f7befff`),
  KEY `b4d6c350` (`8eb6ab6d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin COMMENT='b82019d1';

INSERT INTO `df743dc0` VALUES
('XQ_&$nmO5L_%$v',1575.8138,8097.0,'fep',-1877864592605838801,'1999-06-10 00:00:00','18:20:01'),
('pn9hlzot7c705hun3lft7ngsxfl4264w7jx3kc8d9z7bd5xwtgbinkfzrwti5lc7eglqcp2pn0xfiug367e37nc9k22jobrcgx6mtdfwxezad57j41f9w6kcbmkg5xycjyg90tdfqiwi8ogk5juhb7idh6c5',1.944891,-70829769057641653952326444816118.0,'dv',7658638948516014551,'2003-10-14 06:13:46','05:58:30'),
('VH',7113.1826,417687.0,'i7',7106741963468241296,'2002-12-04 00:00:00','13:19:33'),
('9761SkB*Z!DCmjxZn7',8235.68,0.0,'rp4',-1548333376879762450,'2010-03-24 00:00:00','21:01:49');

INSERT INTO `d5e0b6ce` VALUES
(NULL,405766648520663.724,NULL,-8503539207737898077,'fhms',0,'22:45:39',NULL,-384542190,'~4hD4-N4^l',944.6205918397718),
(2291649302152893378,232436.000,x'6821753850',-7952018478436972108,'sdfs7',557.7722881968003,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(7853224480894943492,83390.860,x'524d292124247e2d6b747e6b4866',-7945162796837010282,'sdfs7',4734.931119829272,'06:53:59',-38,-1038241934,'Uv&uS%',1275.6231738174406),
(4373492154703164889,0.000,x'4029652d2b6f264d2572284b',-7548348102298588292,'nho',4023.635029856039,'06:53:59',19,-1877931459,'Uv&uS%',7829.251782320504),
(NULL,405766648520663.724,NULL,-6314271141776515322,'bw9',6137.839322592523,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(2291649302152893378,232436.000,x'3d23262a4d546d75446167626e63424376',-5513624125301393325,'sdfs7',2657.884024933866,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(-3412291436941851149,133570.230,x'6e7e4f',-4874885214484913941,'fhms',8940.663427139027,'06:53:59',127,-1334987351,'Uv&uS%',14.92372760201089),
(5401804490326700649,232436.000,x'6252',-4558813908550930693,'fhms',8032.346836273505,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(442239570563880339,145.117,x'4c354c',-3761852580959045753,'nho',7924.26573271336,'06:53:59',-55,-412301894,'Uv&uS%',6434.473204213693),
(5401804490326700649,232436.000,x'6843324d7a465f4f452b506e296277',-3314982684563595677,'z96ic',979.2612672778323,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(6802303851129479872,NULL,x'4428756a5135356b705e232b3d336b41467e30',-3286969606264628720,'bw9',7923.394177129049,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(5401804490326700649,232436.000,x'3052246c543237',-2948454116579365344,'qnnxr',8568.456080887232,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(8431443656063407946,232436.000,x'',-2259214381120412408,'ar2jd',4521.698735108902,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(-1814125338118320750,642710.000,x'55496a722644586947693d6135',-1894525813011307439,'b7ru',2770.85024100315,'06:53:59',-51,-88212897,'Uv&uS%',8215.377959279635),
(8899019673065916620,232436.000,x'3072235272374f4b374d67',-1727113956620316621,'bw9',8986.078274204923,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(5401804490326700649,232436.000,x'43325150562468434e384528',-1238449285012872575,'bw9',6199.547307017455,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(NULL,232436.000,x'77784835702478',-1216527060765607385,'fhms',7263.625141315491,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(5133315760642136212,NULL,x'245821746b385435796b42515a306d2d6f5a67',-1094229359996799510,'3',5099.299559441171,'06:53:59',97,-822622048,'Uv&uS%',9573.432296714474),
(5401804490326700649,232436.000,x'504577',-763581276404505882,'g',1002.0933362663138,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(8575437796554783446,232436.000,x'',-683113339680101042,'bw9',1.1508673011957564,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(2291649302152893378,232436.000,x'4f4e765169645a5a4e6e782a64743d',-396640750971557966,'sdfs7',6282.291627556648,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(-2059136270552522675,0.600,x'7430766657465a2d',0,'nho',4138.285511561981,'06:53:59',-9,-1948119695,'Uv&uS%',4111.32877832131),
(2291649302152893378,425.927,NULL,52219595725577299,'nho',846.8996945097094,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(8843266298289493001,232436.000,x'33703529',382963976025875958,'bw9',7896.776243392202,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(-5537381246369465906,7135.462,x'2d4c526870764553',477470172699935787,'nho',3920.581655720785,'06:53:59',-77,-1752696865,'Uv&uS%',5062.609790284405),
(2291649302152893378,232436.000,x'62363951432548594a243057744d',657684278679135621,'sdfs7',8407.150892515145,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(5401804490326700649,232436.000,x'31596c774323594e5255486c614468',745119880536331755,'g',8171.016006007865,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(-2179999818232039837,419851.221,x'4e4b6b496b68726770513379555232',1552367706275981857,'ar2jd',2194.582407482904,'06:53:59',-84,-821540321,'Uv&uS%',958.7974781728609),
(2291649302152893378,232436.000,x'315656717a692578',1717759542016359186,'sdfs7',3017.3765201180568,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(2291649302152893378,232436.000,x'6a244739742468776421',1722292863935421519,'sdfs7',1177.8796580115277,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(-2561688564559632557,449914.190,x'40794157337a483154343d4c',2813217424072555477,'bw9',6140.799512537395,'06:53:59',-89,-1478677641,'Uv&uS%',6738.373887685636),
(6473184552325535914,232436.000,x'613d',2974883022105220814,'b7ru',2702.595842563044,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(4556467144153940749,69195.310,x'752a6e6f456335536d7e774253594739',3072501201002308213,'3',7695.511934667399,'06:53:59',-71,-1581643641,'Uv&uS%',3202.3351583840363),
(5401804490326700649,232436.000,x'3031397e474564486b506f',4790027361092865347,'bw9',6447.942127741957,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(NULL,232436.000,x'3641783d434e',4790190779403202169,'nho',2631.451696433137,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(5401804490326700649,232436.000,x'675329295754736d4f565f5526673d424c68',5066928487106360628,'nho',623.0351784116124,'06:53:59',NULL,-239190366,'Uv&uS%',7319.375646735076),
(-4519458605308025574,0.370,x'726e342b572a5f4772712a50675a68374b6342',5077037547168328123,'nho',47.37123658354965,'06:53:59',84,-985274591,'Uv&uS%',9832.304511247878),
(-2097211679793331880,59.000,x'2d5a312b723166392a68',5622779990769410101,'nho',29.959489925247343,'06:53:59',-24,-373166220,'Uv&uS%',9655.263500390649),
(5833626474806154264,232436.000,x'',5744198728058900676,'qnnxr',3924.069424749052,'06:53:59',-26,-239190366,'Uv&uS%',7319.375646735076),
(6107821890307422702,0.000,x'',5912026990771590342,'nho',3977.0417758278095,'06:53:59',-81,-753849285,'Uv&uS%',9204.111203819397),
(576868580814470235,65.802,x'28366d6c2d3835406b6c43647653',7188877065024910965,'bw9',5411.097733181126,'06:53:59',-112,830464273,'Uv&uS%',7152.119456757449),
(4707703641028354067,232436.000,x'345968717a',8308541400823053725,'bw9',2075.0915763963726,'06:53:59',-26,-239190366,'Uv&uS%',9290.511064920309),
(4730982986011368061,405766648520663.724,NULL,8308541400823053725,'sdfs7',3370.6737675391328,'06:53:59',-26,-239190366,'Uv&uS%',6473.014775410192),
(-3909066081831314077,NULL,x'4d68642a6842',8308541400823053725,'ar2jd',4898.257169984379,'07:36:50',74,275096443,'OI3EqHsUMA_va6%KY8',2712.2390373442236),
(2121791191312578547,405766648520663.724,NULL,8308541400823053725,'sdfs7',5686.212429681186,'06:53:59',-26,-239190366,'Uv&uS%',6893.277881495451),
(-8896697780254135059,405766648520663.724,NULL,8308541400823053725,'sdfs7',5720.347959712006,'06:53:59',-26,-239190366,'Uv&uS%',2190.1710712963936),
(5401804490326700649,405766648520663.724,NULL,8308541400823053725,'sdfs7',6515.859676420247,'06:53:59',NULL,-239190366,'Uv&uS%',1607.9153707475484),
(779037603845767664,405766648520663.724,NULL,8308541400823053725,'sdfs7',6693.428835740763,'06:53:59',-26,-239190366,'Uv&uS%',1767.8554329082954),
(5876337840487756039,389.100,x'',8308541400823053725,'g',9113.036957013259,'04:19:25',-25,-53118419,'yks~k',4311.931976502653),
(2291649302152893378,232436.000,x'72415e30',8748734438304254423,'sdfs7',9918.125755349589,'06:53:59',-26,-239190366,'Uv&uS%',9290.511064920309),
(7945424788622741395,5317.840,x'706e',8766836167229127568,'nho',8836.543042705609,'06:53:59',98,-1458085553,'Uv&uS%',9108.556984863057),
(7282973072359652488,4.000,x'5052704f456a4b',9135197614263454525,'nho',6871.107358008866,'06:53:59',72,-2085867377,'Uv&uS%',9761.732155100699);

update `d5e0b6ce` set `d5e0b6ce`.`a2e927ab` = -1151506118 ,`d5e0b6ce`.`0e4be72e` = -110 ,`d5e0b6ce`.`e106f232` = 'ar2jd' where `d5e0b6ce`.`1b636754` in ( select `ee7ec4f9` from `df743dc0` where `d5e0b6ce`.`4684c1fb` in ( -943421426004881658 ,-5241252373443867474 ) ) and not( IsNull( `d5e0b6ce`.`a955e35b` ) );

plan_replayer.zip

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

No error

3. What did you see instead (Required)

image

4. What is your TiDB version? (Required)

master

time-and-fate commented 1 year ago

I'm not sure if it's exactly the same case, but I figured out a minimal reproduce with the same panic stack trace.

create table t(a int, b int, index iab(a,b));
insert into t value(1,1);
analyze table t;
alter table t rename column b to bb;
explain select * from t where a = 10 and bb > 20;