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

The real data type does not match the current column type #53634

Closed
zimulala opened this issue May 28, 2024 · 2 comments · Fixed by #54183
Closed

The real data type does not match the current column type #53634

zimulala opened this issue May 28, 2024 · 2 comments · Fixed by #54183
Assignees

Comments

@zimulala
Copy link
Contributor

zimulala commented May 28, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

daily run in TiFlash
DDLs:

[sql="\nCREATE TABLE IF NOT EXISTS stock (\n\ts_i_id INT NOT NULL,\n\ts_w_id INT NOT NULL,\n\ts_quantity INT,\n\ts_dist_01 CHAR(24), \n\ts_dist_02 CHAR(24),\n\ts_dist_03 CHAR(24),\n\ts_dist_04 CHAR(24), \n\ts_dist_05 CHAR(24), \n\ts_dist_06 CHAR(24), \n\ts_dist_07 CHAR(24), \n\ts_dist_08 CHAR(24), \n\ts_dist_09 CHAR(24), \n\ts_dist_10 CHAR(24), \n\ts_ytd INT, \n\ts_order_cnt INT, \n\ts_remote_cnt INT,\n\ts_data VARCHAR(50),\n\tPRIMARY KEY(s_w_id, s_i_id)\n)"]
[sql="alter table `tpcc`.`stock` set tiflash replica 2"]
[sql="alter table `tpcc`.`stock` set tiflash replica 2"]
[sql="alter table stock drop column cct_1"]
[sql="alter table stock add column cct_1 int default 10"]
[sql="alter table stock modify cct_1 json"]
[sql="alter table stock drop column adc_1"]
[sql="alter table stock add column adc_1 smallint"]
[sql="alter table stock drop column cct_1"]

DMLs:
Execute the following DMLs when finished alter table stock add column adc_1 smallint.

["wait latest schema version changed(get the metadata lock if tidb_enable_metadata_lock is true)"] [category=ddl] **[ver=237]** ["take time"=127.144578ms] [job="ID:203, Type:add column, State:done, SchemaState:public, SchemaID:104, TableID:120, RowCount:0, ArgLen:4, start time: 2024-05-22 11:35:43.835 +0800 CST, ts:449930577532682272, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"]

[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="SELECT c_discount, c_last, c_credit, w_tax FROM customer, warehouse WHERE w_id = ? AND c_w_id = w_id AND c_d_id = ? AND c_id = ? [arguments: (3, 2, 2679)] [arguments: (3, 2, 2679)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="SELECT d_next_o_id, d_tax FROM district WHERE d_id = ? AND d_w_id = ? FOR UPDATE [arguments: (2, 3)] [arguments: (2, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE district SET d_next_o_id = ? + 1 WHERE d_id = ? AND d_w_id = ? [arguments: (3077, 2, 3)] [arguments: (3077, 2, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="INSERT INTO orders (o_id, o_d_id, o_w_id, o_c_id, o_entry_d, o_ol_cnt, o_all_local) VALUES (?, ?, ?, ?, ?, ?, ?) [arguments: (3077, 2, 3, 2679, \"2024-05-22 03:55:50\", 15, 1)] [arguments: (3077, 2, 3, 2679, \"2024-05-22 03:55:50\", 15, 1)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="INSERT INTO new_order (no_o_id, no_d_id, no_w_id) VALUES (?, ?, ?) [arguments: (3077, 2, 3)] [arguments: (3077, 2, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="SELECT i_price, i_name, i_data, i_id FROM item WHERE i_id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) [arguments: (82805, 8283, 40613, 56731, 8565, 98165, 49253, 86893, 13931, 25427, 48693, 40805, 31473, 96885, 97965)] [arguments: (82805, 8283, 40613, 56731, 8565, 98165, 49253, 86893, 13931, 25427, 48693, 40805, 31473, 96885, 97965)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="SELECT s_i_id, s_quantity, s_data, s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_dist_05, s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10 FROM stock WHERE (s_w_id, s_i_id) IN ((?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?)) FOR UPDATE [arguments: (3, 82805, 3, 8283, 3, 40613, 3, 56731, 3, 8565, 3, 98165, 3, 49253, 3, 86893, 3, 13931, 3, 25427, 3, 48693, 3, 40805, 3, 31473, 3, 96885, 3, 97965)] [arguments: (3, 82805, 3, 8283, 3, 40613, 3, 56731, 3, 8565, 3, 98165, 3, 49253, 3, 86893, 3, 13931, 3, 25427, 3, 48693, 3, 40805, 3, 31473, 3, 96885, 3, 97965)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (36, 1, 0, 82805, 3)] [arguments: (36, 1, 0, 82805, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (22, 6, 0, 8283, 3)] [arguments: (22, 6, 0, 8283, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (30, 2, 0, 40613, 3)] [arguments: (30, 2, 0, 40613, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (34, 10, 0, 56731, 3)] [arguments: (34, 10, 0, 56731, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (15, 7, 0, 8565, 3)] [arguments: (15, 7, 0, 8565, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (55, 6, 0, 98165, 3)] [arguments: (55, 6, 0, 98165, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (38, 5, 0, 49253, 3)] [arguments: (38, 5, 0, 49253, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (29, 4, 0, 86893, 3)] [arguments: (29, 4, 0, 86893, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (21, 4, 0, 13931, 3)] [arguments: (21, 4, 0, 13931, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (62, 7, 0, 25427, 3)] [arguments: (62, 7, 0, 25427, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (90, 2, 0, 48693, 3)] [arguments: (90, 2, 0, 48693, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (80, 2, 0, 40805, 3)] [arguments: (80, 2, 0, 40805, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (16, 5, 0, 31473, 3)] [arguments: (16, 5, 0, 31473, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (94, 5, 0, 96885, 3)] [arguments: (94, 5, 0, 96885, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="UPDATE stock SET s_quantity = ?, s_ytd = s_ytd + ?, s_order_cnt = s_order_cnt + 1, s_remote_cnt = s_remote_cnt + ? WHERE s_i_id = ? AND s_w_id = ? [arguments: (73, 3, 0, 97965, 3)] [arguments: (73, 3, 0, 97965, 3)]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql="INSERT into order_line (ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_dist_info) VALUES (?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?),(?,?,?,?,?,?,?,?,?) [arguments: (3077, 2, 3, 1, 82805, 3, 1, 48.156283725, \"WWDOEWEMUWYODYNIFUAZFZGY\", 3077, 2, 3, 2, 8283, 3, 6, 341.1507168, \"KFBARKPJEWQTGXRCAJCWUBEN\", 3077, 2, 3, 3, 40613, 3, 2, 94.62137100000001, \"LHKAMJQULIYMROAKAOBRZYXE\", 3077, 2, 3, 4, 56731, 3, 10, 253.6794675, \"OEDMKGTJIXBWRPNCTNAGYXDT\", 3077, 2, 3, 5, 8565, 3, 7, 404.9024007, \"BCYOPJDCULXQMFLDAUEETFNM\", 3077, 2, 3, 6, 98165, 3, 6, 513.5243094, \"CHBQNIDGKGYOSSCMQSVYSIIN\", 3077, 2, 3, 7, 49253, 3, 5, 201.0168945, \"QCRRKIMKLVELQJVEYNRDOGSP\", 3077, 2, 3, 8, 86893, 3, 4, 136.5373539, \"WFOJUQYLLZMANUXIAPFZLDXJ\", 3077, 2, 3, 9, 13931, 3, 4, 257.74690200000003, \"FKEJMYTOAUXJQJTANAPLAIMY\", 3077, 2, 3, 10, 25427, 3, 7, 395.986156125, \"CFHIEZIBJTQAJRAHQFVJXOBL\", 3077, 2, 3, 11, 48693, 3, 2, 206.04766875, \"DMZNOATPSWLGFNYPEMJNHDIW\", 3077, 2, 3, 12, 40805, 3, 2, 28.0438905, \"YGLGTZAZXHFPUFAZAVYPRUPH\", 3077, 2, 3, 13, 31473, 3, 5, 130.960687125, \"RVDWAUINQEFDADGXXEOKJRZM\", 3077, 2, 3, 14, 96885, 3, 5, 266.684554125, \"DCHMFLLWNTPXHROTSSJBZSEW\", 3077, 2, 3, 15, 97965, 3, 3, 117.46322684999998, \"WULYCIAJYPJJHRHGHKLMYTVX\")] [arguments: (3077, 2, 3, 1, 82805, 3, 1, 48.156283725, \"WWDOEWEMUWYODYNIFUAZFZGY\", 3077, 2, 3, 2, 8283, 3, 6, 341.1507168, \"KFBARKPJEWQTGXRCAJCWUBEN\", 3077, 2, 3, 3, 40613, 3, 2, 94.62137100000001, \"LHKAMJQULIYMROAKAOBRZYXE\", 3077, 2, 3, 4, 56731, 3, 10, 253.6794675, \"OEDMKGTJIXBWRPNCTNAGYXDT\", 3077, 2, 3, 5, 8565, 3, 7, 404.9024007, \"BCYOPJDCULXQMFLDAUEETFNM\", 3077, 2, 3, 6, 98165, 3, 6, 513.5243094, \"CHBQNIDGKGYOSSCMQSVYSIIN\", 3077, 2, 3, 7, 49253, 3, 5, 201.0168945, \"QCRRKIMKLVELQJVEYNRDOGSP\", 3077, 2, 3, 8, 86893, 3, 4, 136.5373539, \"WFOJUQYLLZMANUXIAPFZLDXJ\", 3077, 2, 3, 9, 13931, 3, 4, 257.74690200000003, \"FKEJMYTOAUXJQJTANAPLAIMY\", 3077, 2, 3, 10, 25427, 3, 7, 395.986156125, \"CFHIEZIBJTQAJRAHQFVJXOBL\", 3077, 2, 3, 11, 48693, 3, 2, 206.04766875, \"DMZNOATPSWLGFNYPEMJNHDIW\", 3077, 2, 3, 12, 40805, 3, 2, 28.0438905, \"YGLGTZAZXHFPUFAZAVYPRUPH\", 3077, 2, 3, 13, 31473, 3, 5, 130.960687125, \"RVDWAUINQEFDADGXXEOKJRZM\", 3077, 2, 3, 14, 96885, 3, 5, 266.684554125, \"DCHMFLLWNTPXHROTSSJBZSEW\", 3077, 2, 3, 15, 97965, 3, 3, 117.46322684999998, \"WULYCIAJYPJJHRHGHKLMYTVX\")]"]
[schemaVersion=237] [txnStartTS=449930893901168668]...[sql=COMMIT]

select adc_1 from stock where adc_1!=0 limit 1;

Related issue: pingcap/tiflash#7024

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

Execute successfully.

3. What did you see instead (Required)

tidb>  select adc_1 from stock where adc_1!=0 limit 1;
ERROR 1105 (HY000): invalid data type: Failed to decode row v2 data as i64

4. What is your TiDB version? (Required)

master

@zimulala zimulala added the type/bug The issue is confirmed as a bug. label May 28, 2024
@zimulala
Copy link
Contributor Author

Data read from tikv:
curl http://127.0.0.1:10081/mvcc/key/tpcc/stock\?s_i_id\=8283\&s_w_id\=3

{
 "key": "7480000000000000785F7203800000000000000303800000000000205B",
 "region_id": 1983,
 "value": {
  "info": {
   "writes": [
    {
     "start_ts": 449930893901168668,
     "commit_ts": 449930893914275857
    },
    {
     "start_ts": 449930702287011868,
     "commit_ts": 449930702300119067
    }
   ],
   "values": [
    {
     "start_ts": 449930893901168668,
     "value": "gAAQAAAAAwQFBgcICQoLDA0ODxARFAEAGQAxAEkAYQB5AJEAqQDBANkA8QDyAPMA9AAcASUBFlFDTU1WWEhUWURIQ1dJU0pTS1ZMQ0tCVktGQkFSS1BKRVdRVEdYUkNBSkNXVUJFTkFUV1FOQ1laQU5NS0pHVlpXSENOWFlSVUJGT1pMVk9GWVVETFNSQ1RWRUROSlVGVERGWlZBTE1NREZYQVBSR1dUSUdCUVhWSFZZWlNNVFpDWk1YQ0JZQ0xHTEVZQURBSVdEVEFUVUZJUUZQSVBaT0JBSE1TWVNHQVlEQUpBSEpETkZPQ0ZNUEJCS0daT0JJTVBZTk1DSEpBSlNTWEdVTExKVk9MVk1KV05CUUtXUktQRkJUUExFSVJRUEtFS0ROTRACAFNCaVVjOG8wZkwyMFFmczB0QTAzbU9vQ0dsRk56bWlCV09XYUFPQUkJCgAAAAAAAAA="
    },
    {
     "start_ts": 449930702287011868,
     "value": "gAARAAAAAwQFBgcICQoLDA0ODxAREhMBABkAMQBJAGEAeQCRAKkAwQDZAPEA8gDzAPQAHAEdASYBHFFDTU1WWEhUWURIQ1dJU0pTS1ZMQ0tCVktGQkFSS1BKRVdRVEdYUkNBSkNXVUJFTkFUV1FOQ1laQU5NS0pHVlpXSENOWFlSVUJGT1pMVk9GWVVETFNSQ1RWRUROSlVGVERGWlZBTE1NREZYQVBSR1dUSUdCUVhWSFZZWlNNVFpDWk1YQ0JZQ0xHTEVZQURBSVdEVEFUVUZJUUZQSVBaT0JBSE1TWVNHQVlEQUpBSEpETkZPQ0ZNUEJCS0daT0JJTVBZTk1DSEpBSlNTWEdVTExKVk9MVk1KV05CUUtXUktQRkJUUExFSVJRUEtFS0ROTQoBAFNCaVVjOG8wZkwyMFFmczB0QTAzbU9vQ0dsRk56bWlCV09XYUFPQUkKCQoAAAAAAAAA"
    }
   ]
  }
 }
}%

When start_ts is 449930893901168668, the value is as follows:

800010000000030405060708090A0B0C0D0E0F1011140100190031004900610079009100A900C100D900F100F200F300F4001C0125011651434D4D56584854594448435749534A534B564C434B42564B464241524B504A4557515447585243414A43575542454E415457514E43595A414E4D4B4A47565A5748434E5859525542464F5A4C564F465955444C535243545645444E4A55465444465A56414C4D4D4446584150524757544947425158564856595A534D545A435A4D58434259434C474C455941444149574454415455464951465049505A4F4241484D53595347415944414A41484A444E464F43464D5042424B475A4F42494D50594E4D43484A414A53535847554C4C4A564F4C564D4A574E42514B57524B50464254504C45495251504B454B444E4D1002005342695563386F30664C323051667330744130336D4F6F43476C464E7A6D6942574F5761414F4149090A00000000000000
Version: New
IsBig: 0
Not null columns:
3:
16
\x16

4:
51434d4d56584854594448435749534a534b564c434b4256
QCMMVXHTYDHCWISJSKVLCKBV

5:
4b464241524b504a4557515447585243414a43575542454e
KFBARKPJEWQTGXRCAJCWUBEN

6:
415457514e43595a414e4d4b4a47565a5748434e58595255
ATWQNCYZANMKJGVZWHCNXYRU

7:
42464f5a4c564f465955444c535243545645444e4a554654
BFOZLVOFYUDLSRCTVEDNJUFT

8:
44465a56414c4d4d44465841505247575449474251585648
DFZVALMMDFXAPRGWTIGBQXVH

9:
56595a534d545a435a4d58434259434c474c455941444149
VYZSMTZCZMXCBYCLGLEYADAI

10:
574454415455464951465049505a4f4241484d5359534741
WDTATUFIQFPIPZOBAHMSYSGA

11:
5944414a41484a444e464f43464d5042424b475a4f42494d
YDAJAHJDNFOCFMPBBKGZOBIM

12:
50594e4d43484a414a53535847554c4c4a564f4c564d4a57
PYNMCHJAJSSXGULLJVOLVMJW

13:
4e42514b57524b50464254504c45495251504b454b444e4d
NBQKWRKPFBTPLEIRQPKEKDNM

14:
10
\x10

15:
02
\x02

16:
00
\x00

17:
5342695563386f30664c323051667330744130336d4f6f43476c464e7a6d6942574f5761414f4149
SBiUc8o0fL20Qfs0tA03mOoCGlFNzmiBWOWaAOAI

20:
090a00000000000000
\x09\x0a\x00\x00\x00\x00\x00\x00\x00

Null columns:

@jebter jebter added severity/critical component/ddl This issue is related to DDL of TiDB. labels May 31, 2024
@zimulala zimulala changed the title The data type read does not match the current column type The real data type does not match the current column type Jun 14, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 9aeaa76 Jun 26, 2024
@zimulala
Copy link
Contributor Author

Related: #51407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants