pingcap / tidb

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

assertion failed when updating the vector column #56477

Open wjhuang2016 opened 1 month ago

wjhuang2016 commented 1 month ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `tlacd0e574` (
  `col_1` vector(9) NOT NULL,
  `col_2` double DEFAULT NULL,
  VECTOR INDEX `idx_14_1`((VEC_COSINE_DISTANCE(`col_1`)))
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci;
INSERT INTO `tlacd0e574` VALUES ('[0.137904,0.341333,0.737963,0.957513,0.477003,0.825102,0.162301,0.686659,0.214486]',260.37315233197836), ('[0.178323,0.863416,0.043341,0.689893,0.069284,0.037543,0.268575,0.509904,0.999812]',6469.030726657345), ('[0.757923,0.989432,0.055612,0.254822,0.688903,0.793445,0.102875,0.346934,0.66906]',8095.017659724292), ('[0.37668,0.830476,0.622297,0.718953,0.485307,0.396928,0.108128,0.692141,0.884397]',1359.3877113095714), ('[0.234855,0.24657,0.693257,0.786309,0.078358,0.567803,0.377927,0.507886,0.213475]',5542.484694331791), ('[0.192961,0.70145,0.012639,0.088539,0.763696,0.310705,0.686996,0.782491,0.106497]',1680.089435881278), ('[0.739328,0.239061,0.164271,0.991812,0.780108,0.513716,0.785504,0.565403,0.533331]',1683.5906366118172), ('[0.283044,0.687838,0.216801,0.691966,0.128828,0.747022,0.223582,0.106338,0.972051]',7095.552906392812), ('[0.894022,0.061245,0.485419,0.860185,0.678603,0.622004,0.376151,0.060719,0.397429]',7120.854548467046), ('[0.541696,0.171818,0.829202,0.978428,0.307429,0.112689,0.569152,0.651088,0.98789]',9101.162481456933), ('[0.440904,0.733038,0.621817,0.801622,0.278622,0.55168,0.957654,0.461978,0.559665]',3231.899882671888), ('[0.155362,0.023293,0.84271,0.954513,0.685551,0.992756,0.53886,0.253939,0.49856]',2477.746108377076), ('[0.447785,0.785992,0.767436,0.265539,0.90634,0.162081,0.137067,0.5313,0.070507]',5853.608073499064), ('[0.642204,0.012352,0.790861,0.13278,0.557451,0.079013,0.061831,0.471095,0.171802]',7521.937789776166), ('[0.160233,0.755107,0.088231,0.515382,0.749338,0.987978,0.368829,0.697019,0.373631]',981.1301771178565), ('[0.608105,0.94104,0.568016,0.606699,0.8413,0.766571,0.492482,0.751098,0.842392]',159.53330465705403), ('[0.926117,0.462704,0.418982,0.299372,0.354598,0.127335,0.031815,0.42909,0.34749]',1226.706870950491), ('[0.544824,0.923904,0.516958,0.435945,0.958391,0.069867,0.123447,0.785902,0.28848]',568.9710085196599), ('[0.135297,0.310037,0.912851,0.200695,0.566026,0.695045,0.385232,0.101107,0.185239]',7438.680802465283), ('[0.423496,0.163576,0.308951,0.553785,0.034301,0.018519,0.022366,0.00545,0.530672]',9174.319733239523), ('[0.0404,0.077271,0.593113,0.454823,0.559854,0.990679,0.952428,0.73508,0.97369]',2148.326751779016), ('[0.138851,0.837257,0.64634,0.958783,0.087701,0.132925,0.408299,0.44522,0.607282]',9454.339066420927), ('[0.854693,0.01627,0.984095,0.18403,0.45103,0.506204,0.900849,0.91555,0.214767]',2264.3588564317033), ('[0.916406,0.580299,0.59651,0.329086,0.5697,0.810066,0.648182,0.685034,0.289248]',6511.491865830014), ('[0.536582,0.488636,0.056253,0.911939,0.812591,0.039117,0.225562,0.368035,0.341628]',7843.424509411888), ('[0.078103,0.159659,0.033632,0.792029,0.972326,0.995959,0.623306,0.784788,0.983506]',8888.601421310022), ('[0.073322,0.505253,0.798997,0.067108,0.135532,0.086732,0.991036,0.842291,0.136719]',9279.609393417848), ('[0.145781,0.11181,0.972434,0.101178,0.420948,0.5965,0.367454,0.357667,0.639749]',1211.3984890431934), ('[0.353904,0.99093,0.969231,0.404539,0.349348,0.81847,0.338905,0.56656,0.849811]',879.6675626766221), ('[0.090924,0.8125,0.178183,0.795376,0.987919,0.152255,0.593442,0.622453,0.007933]',4321.25976733023), ('[0.756131,0.939533,0.256786,0.271975,0.02746,0.232467,0.015147,0.483903,0.784082]',3650.7938115342963), ('[0.620982,0.640012,0.669774,0.999341,0.017054,0.100535,0.13468,0.72968,0.706689]',4460.9870733672915), ('[0.730285,0.528781,0.133443,0.172361,0.443755,0.163241,0.658785,0.770798,0.792562]',7034.678841929595), ('[0.738961,0.653894,0.807404,0.427002,0.232611,0.374894,0.570295,0.730268,0.010808]',3672.965929955903), ('[0.819584,0.686727,0.341086,0.997377,0.619797,0.513186,0.154524,0.696595,0.624515]',2127.1132502633295), ('[0.590518,0.634406,0.984055,0.941763,0.524286,0.364567,0.032957,0.055784,0.652055]',6555.416268323397), ('[0.008599,0.733596,0.148219,0.239637,0.802355,0.907341,0.051095,0.736211,0.502906]',2450.841474227294), ('[0.878267,0.287596,0.54337,0.678268,0.759443,0.333916,0.822013,0.666345,0.591035]',5225.393324600178), ('[0.097983,0.263364,0.134173,0.619143,0.585584,0.682246,0.53217,0.582648,0.775649]',4156.191479620557), ('[0.657748,0.119692,0.592587,0.088282,0.825302,0.480856,0.683327,0.973109,0.637968]',8444.961953471719);
update tlacd0e574 set tlacd0e574.col_1 = '[0.152702, 0.445272, 0.377179, 0.111767, 0.807776, 0.877910, 0.898105, 0.995922, 0.965686]' ,tlacd0e574.col_1 = '[0.324944, 0.431561, 0.017492, 0.516322, 0.370232, 0.110380, 0.393603, 0.701649, 0.324861]' ,tlacd0e574.col_1 = '[0.940073, 0.035516, 0.687204, 0.833334, 0.788326, 0.810769, 0.750157, 0.392805, 0.427114]' where not( tlacd0e574.col_2 between 1211.3984890431934 and 3683.629829863743 ) and not( tlacd0e574.col_1 < '[0.739299, 0.033288, 0.536549, 0.437581, 0.360288, 0.945760, 0.400300, 0.321833, 0.218258]' ) ;

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

No error

3. What did you see instead (Required)

mysql> update tlacd0e574 set tlacd0e574.col_1 = '[0.152702, 0.445272, 0.377179, 0.111767, 0.807776, 0.877910, 0.898105, 0.995922, 0.965686]' ,tlacd0e574.col_1 = '[0.324944, 0.431561, 0.017492, 0.516322, 0.370232, 0.110380, 0.393603, 0.701649, 0.324861]' ,tlacd0e574.col_1 = '[0.940073, 0.035516, 0.687204, 0.833334, 0.788326, 0.810769, 0.750157, 0.392805, 0.427114]' where not( tlacd0e574.col_2 between 1211.3984890431934 and 3683.629829863743 ) and not( tlacd0e574.col_1 < '[0.739299, 0.033288, 0.536549, 0.437581, 0.360288, 0.945760, 0.400300, 0.321833, 0.218258]' ) ;
ERROR 8141 (HY000): assertion failed: key: 7480000000000010045f69800000000000000114090000003e07423f6a4b7d3f69c9633d0778823ef25b303f361f4b3f21b0d23d55a1b13e84472b3f038000000000000003, assertion: Exist, start_ts: 453084667595456514, existing start ts: 0, existing commit ts: 0

4. What is your TiDB version? (Required)

master

wuhuizuo commented 2 weeks ago

/assign kolafish

ti-chi-bot[bot] commented 2 weeks ago

@wuhuizuo: GitHub didn't allow me to assign the following users: kolafish.

Note that only pingcap members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide

In response to [this](https://github.com/pingcap/tidb/issues/56477#issuecomment-2456126898): >/assign kolafish Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
wuhuizuo commented 2 weeks ago

/assign

wuhuizuo commented 2 weeks ago

/un-assign

EricZequan commented 2 weeks ago

The described SQL cannot be reproduced in testing. During the bug fix process, we fixed a series of consistency issues. This issue may have been fixed or not involved. It can be discussed in detail when it is encountered later.

wuhuizuo commented 2 weeks ago

@kolafish you can assign yourself

kolafish commented 2 weeks ago

@kolafish you can assign yourself

I see it, thanks!

wjhuang2016 commented 6 days ago

https://github.com/wjhuang2016/schrddl/tree/fix_vector It can be reproduce using this branch.