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

Bootstrap failed because of an invalid default value to the corresponding type #3157

Closed
solotzg opened this issue Sep 26, 2021 · 13 comments · Fixed by #4916
Closed

Bootstrap failed because of an invalid default value to the corresponding type #3157

solotzg opened this issue Sep 26, 2021 · 13 comments · Fixed by #4916
Assignees
Labels
affects-4.0 affects-5.0 affects-5.1 affects-5.2 affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. component/storage severity/major type/bug The issue is confirmed as a bug.

Comments

@solotzg
Copy link
Contributor

solotzg commented Sep 26, 2021

TiFlash build info: TiFlash\nRelease Version: v5.1.1\nEdition: Community\nGit Commit Hash: c8fabfb\nGit Branch: heads/refs/tags/v5.1.1\nUTC Build Time: 2021-07-28 11:18:00\nProfile: RELWITHDEBINFO

[2021/09/26 19:30:33.375 +08:00] [INFO] [<unknown>] ["SchemaBuilder: Creating table db_ysb_salesmen(26465).ts_salesmen_task(28972) with statement: CREATE TABLE `db_26465`.`t_28972`(`user_id` Int32, `month` Int32, `user_type` Int8, `sys_cash` Decimal(16,2), `individual_cash` Decimal(10,2), `indiv_cash_fr` Decimal(10,2), `indiv_cash_fr_min` Decimal(10,2), `sys_group_cash` Decimal(16,2), `group_cash` Decimal(16,2), `group_cash_fr` Decimal(16,2), `individ_store_cash` Decimal(10,2), `group_store_cash` Decimal(16,2), `individ_hall_cash` Decimal(10,2), `group_hall_cash` Decimal(16,2), `adjust_cash` Decimal(10,2), `sys_store_cnt` UInt32, `indiv_store_cnt` UInt32, `indiv_store_cnt_wt` Decimal(5,4), `sys_group_store_cnt` UInt32, `group_store_cnt` UInt32, `sys_new_store_cnt` Int32, `indiv_new_store_cnt` Int32, `indiv_new_store_cnt_wt` Decimal(5,4), `sys_group_new_store_cnt` Int32, `group_new_store_cnt` Int32, `group_signed_store_cnt` Int32, `indiv_signed_store_cnt` Int32, `sys_struct_cnt` Int32, `indiv_struct_cnt` Int32, `indiv_struct_cnt_wt` Decimal(5,4), `sys_group_struct_cnt` Int32, `group_struct_cnt` Int32, `struct_stage` Int32, `mtime` MyDateTime(0), `ctime` Int32, `indiv_self_cash` Int32, `group_self_cash` Int32, `individ_proxy_cash` Decimal(8,2), `individ_proxy_drug` Int16, `b_spe_user` Int8, `b_spe_cash` Int8, `spe_dis_cash` Decimal(10,2), `b_spe_cnt` Int8, `spe_ref_cnt` Decimal(10,2), `teambuy_valid_store_cnt` Int32, `newstore_perbd` Int8, `new_store_cnt` UInt32, `self_cash_quota` Decimal(12,2), `note` Nullable(String), `plan_new_staff` Nullable(Int32), `fr_spe_cash` Int8, `fr_spe_dis_cash` Decimal(10,2), `hrbp_cash_cnt` Decimal(10,2), `hrbp_drugstore_cnt` Int32, `hrbp_fr_cash_cnt` Decimal(10,2), `hrbp_cover_rate_cnt` Decimal(4,2), `_tidb_rowid` Int64) Engine = DeltaMerge((`_tidb_rowid`), '{\"cols\":[{\"comment\":\"\\\\u4F9D\\\\u8D56user_type\\\\u5B57\\\\u6BB5\\\\uFF0C \\\\u7528\\\\u6237id\\\\u6216\\\\u8005\\\\u57CE\\\\u5E02id\\\\u6216\\\\u8005\\\\u7701\\\\u533Aid\",\"default\":null,\"default_bit\":null,\"id\":1,\"name\":{\"L\":\"user_id\",\"O\":\"user_id\"},\"offset\":0,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":4099,\"Flen\":11,\"Tp\":3}},{\"comment\":\"\\\\u6574\\\\u6570\\\\uFF0Cyyyymm\\\\u683C\\\\u5F0F\",\"default\":\"0\",\"default_bit\":null,\"id\":2,\"name\":{\"L\":\"month\",\"O\":\"month\"},\"offset\":1,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":3,\"Flen\":11,\"Tp\":3}},{\"comment\":\"0-\\\\u9500\\\\u552E\\\\u7528\\\\u6237 1-\\\\u57CE\\\\u5E02id 2-\\\\u7701\\\\u533A\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":3,\"name\":{\"L\":\"user_type\",\"O\":\"user_type\"},\"offset\":2,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":3,\"Flen\":4,\"Tp\":1}},{\"comment\":\"\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u4E2A\\\\u4EBA\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807 \",\"default\":\"0.00\",\"default_bit\":null,\"id\":4,\"name\":{\"L\":\"sys_cash\",\"O\":\"sys_cash\"},\"offset\":3,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":16,\"Tp\":246}},{\"comment\":\"\\\\u4E2A\\\\u4EBA\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807 \",\"default\":\"0.00\",\"default_bit\":null,\"id\":5,\"name\":{\"L\":\"individual_cash\",\"O\":\"individual_cash\"},\"offset\":4,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u4E2A\\\\u4EBA\\\\u9996\\\\u63A8\\\\u54C1\\\\u79CD\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":6,\"name\":{\"L\":\"indiv_cash_fr\",\"O\":\"indiv_cash_fr\"},\"offset\":5,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u4E2A\\\\u4EBA\\\\u9996\\\\u63A8\\\\u54C1\\\\u79CD\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\\\\u6700\\\\u4F4E\\\\u8FBE\\\\u6210\\\\u73B0\\\\u91D1\",\"default\":\"0.00\",\"default_bit\":null,\"id\":7,\"name\":{\"L\":\"indiv_cash_fr_min\",\"O\":\"indiv_cash_fr_min\"},\"offset\":6,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u56E2\\\\u961F\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":8,\"name\":{\"L\":\"sys_group_cash\",\"O\":\"sys_group_cash\"},\"offset\":7,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":16,\"Tp\":246}},{\"comment\":\"\\\\u56E2\\\\u961F\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":9,\"name\":{\"L\":\"group_cash\",\"O\":\"group_cash\"},\"offset\":8,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":16,\"Tp\":246}},{\"comment\":\"\\\\u56E2\\\\u961F\\\\u9996\\\\u63A8\\\\u54C1\\\\u79CD\\\\u73B0\\\\u91D1\\\\u989D\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":10,\"name\":{\"L\":\"group_cash_fr\",\"O\":\"group_cash_fr\"},\"offset\":9,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":16,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u65D7\\\\u8230\\\\u5E97\\\\u4E2A\\\\u4EBA\\\\u73B0\\\\u91D1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":11,\"name\":{\"L\":\"individ_store_cash\",\"O\":\"individ_store_cash\"},\"offset\":10,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u65D7\\\\u8230\\\\u5E97\\\\u56E2\\\\u961F\\\\u73B0\\\\u91D1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":12,\"name\":{\"L\":\"group_store_cash\",\"O\":\"group_store_cash\"},\"offset\":11,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":16,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u9500\\\\u552E\\\\u987E\\\\u95EE\\\\u6BCF\\\\u4E2A\\\\u4EBA\\\\u4E13\\\\u5E97\\\\u7C7B\\\\u578B\\\\u65D7\\\\u8230\\\\u5E97\\\\u7684\\\\u73B0\\\\u91D1\\\\u989D\\\\uFF08\\\\u53BB\\\\u9664\\\\u9000\\\\u6B3E\\\\uFF09\\\\uFF0C\\\\u7ECF\\\\u7406\\\\u4E5F\\\\u6709\\\\u4E2A\\\\u4EBA\\\\u90E8\\\\u5206\",\"default\":\"0.00\",\"default_bit\":null,\"id\":13,\"name\":{\"L\":\"individ_hall_cash\",\"O\":\"individ_hall_cash\"},\"offset\":12,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u9500\\\\u552E\\\\u7ECF\\\\u7406\\\\u6240\\\\u8D1F\\\\u8D23\\\\u7684\\\\u56E2\\\\u4F53\\\\u7684\\\\u4E13\\\\u9986\\\\u7684\\\\u73B0\\\\u91D1\\\\u989D\\\\uFF08\\\\u53BB\\\\u9664\\\\u9000\\\\u6B3E\\\\uFF09\\\\uFF0C\\\\u4E0D\\\\u5305\\\\u62EC\\\\u7ECF\\\\u7406\\\\u81EA\\\\u8EAB\\\\uFF0C\\\\u53EA\\\\u53D6\\\\u76F4\\\\u5C5E\\\\u4E8E\\\\u81EA\\\\u5DF1\\\\u7684\\\\u4EE3\\\\u8868\\\\u548C\\\\u7EC4\\\\u957F\\\\uFF0C\\\\u82E5\\\\u4E0B\\\\u5C5E\\\\u4E2D\\\\u6709\\\\u7ECF\\\\u7406\\\\u53CA\\\\u8BE5\\\\u7ECF\\\\u7406\\\\u7684\\\\u4E0B\\\\u5C5E\\\\uFF0C\\\\u8FD9\\\\u90E8\\\\u5206\\\\u4EBA\\\\u4E0D\\\\u53D6\\\\u3002\",\"default\":\"0.00\",\"default_bit\":null,\"id\":14,\"name\":{\"L\":\"group_hall_cash\",\"O\":\"group_hall_cash\"},\"offset\":13,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":16,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u8C03\\\\u6574\\\\u73B0\\\\u91D1\\\\u989D\",\"default\":\"0.00\",\"default_bit\":null,\"id\":15,\"name\":{\"L\":\"adjust_cash\",\"O\":\"adjust_cash\"},\"offset\":14,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u4E2A\\\\u4EBA\\\\u836F\\\\u5E97\\\\u6570\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":16,\"name\":{\"L\":\"sys_store_cnt\",\"O\":\"sys_store_cnt\"},\"offset\":15,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":33,\"Flen\":255,\"Tp\":3}},{\"comment\":\"\\\\u4E2A\\\\u4EBA\\\\u836F\\\\u5E97\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":17,\"name\":{\"L\":\"indiv_store_cnt\",\"O\":\"indiv_store_cnt\"},\"offset\":16,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":33,\"Flen\":255,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u4E2A\\\\u4EBA\\\\u603B\\\\u5E97\\\\u6570\\\\u6743\\\\u91CD\",\"default\":\"0.0000\",\"default_bit\":null,\"id\":18,\"name\":{\"L\":\"indiv_store_cnt_wt\",\"O\":\"indiv_store_cnt_wt\"},\"offset\":17,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":4,\"Elems\":null,\"Flag\":1,\"Flen\":5,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u56E2\\\\u961F\\\\u836F\\\\u5E97\\\\u6570\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":19,\"name\":{\"L\":\"sys_group_store_cnt\",\"O\":\"sys_group_store_cnt\"},\"offset\":18,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":33,\"Flen\":255,\"Tp\":3}},{\"comment\":\"\\\\u56E2\\\\u961F\\\\u836F\\\\u5E97\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":20,\"name\":{\"L\":\"group_store_cnt\",\"O\":\"group_store_cnt\"},\"offset\":19,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":33,\"Flen\":255,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u4E2A\\\\u4EBA\\\\u65B0\\\\u5E97\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":21,\"name\":{\"L\":\"sys_new_store_cnt\",\"O\":\"sys_new_store_cnt\"},\"offset\":20,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u4E2A\\\\u4EBA\\\\u65B0\\\\u5E97\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":22,\"name\":{\"L\":\"indiv_new_store_cnt\",\"O\":\"indiv_new_store_cnt\"},\"offset\":21,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u4E2A\\\\u4EBA\\\\u65B0\\\\u5E97\\\\u6570\\\\u6743\\\\u91CD\",\"default\":\"0.0000\",\"default_bit\":null,\"id\":23,\"name\":{\"L\":\"indiv_new_store_cnt_wt\",\"O\":\"indiv_new_store_cnt_wt\"},\"offset\":22,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":4,\"Elems\":null,\"Flag\":1,\"Flen\":5,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u56E2\\\\u4F53\\\\u65B0\\\\u5E97\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":24,\"name\":{\"L\":\"sys_group_new_store_cnt\",\"O\":\"sys_group_new_store_cnt\"},\"offset\":23,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u56E2\\\\u4F53\\\\u65B0\\\\u5E97\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":25,\"name\":{\"L\":\"group_new_store_cnt\",\"O\":\"group_new_store_cnt\"},\"offset\":24,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"\\\\u56E2\\\\u4F53\\\\/\\\\u57CE\\\\u5E02\\\\u6708\\\\u5EA6\\\\u7B7E\\\\u5230\\\\u5E97\\\\u6570\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":26,\"name\":{\"L\":\"group_signed_store_cnt\",\"O\":\"group_signed_store_cnt\"},\"offset\":25,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"\\\\u4E2A\\\\u4EBA\\\\u6708\\\\u5EA6\\\\u7B7E\\\\u5230\\\\u5E97\\\\u6570\\\\u6307\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":27,\"name\":{\"L\":\"indiv_signed_store_cnt\",\"O\":\"indiv_signed_store_cnt\"},\"offset\":26,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u4E2A\\\\u4EBA\\\\u7ED3\\\\u6784\\\\u5316\\\\u5E97\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":28,\"name\":{\"L\":\"sys_struct_cnt\",\"O\":\"sys_struct_cnt\"},\"offset\":27,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u4E2A\\\\u4EBA\\\\u7ED3\\\\u6784\\\\u5316\\\\u5E97\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":29,\"name\":{\"L\":\"indiv_struct_cnt\",\"O\":\"indiv_struct_cnt\"},\"offset\":28,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u4E2A\\\\u4EBA\\\\u7ED3\\\\u6784\\\\u5316\\\\u5E97\\\\u6570\\\\u6743\\\\u91CD\",\"default\":\"0.0000\",\"default_bit\":null,\"id\":30,\"name\":{\"L\":\"indiv_struct_cnt_wt\",\"O\":\"indiv_struct_cnt_wt\"},\"offset\":29,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":4,\"Elems\":null,\"Flag\":1,\"Flen\":5,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7CFB\\\\u7EDF\\\\u8BA1\\\\u7B97\\\\u7684\\\\u56E2\\\\u961F\\\\u7ED3\\\\u6784\\\\u5316\\\\u5E97\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":31,\"name\":{\"L\":\"sys_group_struct_cnt\",\"O\":\"sys_group_struct_cnt\"},\"offset\":30,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u56E2\\\\u961F\\\\u7ED3\\\\u6784\\\\u5316\\\\u5E97\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":32,\"name\":{\"L\":\"group_struct_cnt\",\"O\":\"group_struct_cnt\"},\"offset\":31,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u7ED3\\\\u6784\\\\u5316\\\\u9636\\\\u6BB5\\\\u5C5E\\\\u6027,3000\\\\u8868\\\\u793A3k+,5000\\\\u8868\\\\u793A5k+,8000\\\\u8868\\\\u793A8k+\\\\uFF0C\\\\u4F9D\\\\u6B64\\\\u7C7B\\\\u63A8\",\"default\":\"0\",\"default_bit\":null,\"id\":33,\"name\":{\"L\":\"struct_stage\",\"O\":\"struct_stage\"},\"offset\":32,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":3}},{\"comment\":\"\",\"default\":\"CURRENT_TIMESTAMP\",\"default_bit\":null,\"id\":34,\"name\":{\"L\":\"mtime\",\"O\":\"mtime\"},\"offset\":33,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":8321,\"Flen\":19,\"Tp\":7}},{\"comment\":\"\",\"default\":\"0\",\"default_bit\":null,\"id\":35,\"name\":{\"L\":\"ctime\",\"O\":\"ctime\"},\"offset\":34,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u4E2A\\\\u4EBA\\\\u81EA\\\\u8425\\\\u4E1A\\\\u52A1\\\\u73B0\\\\u91D1\",\"default\":\"0\",\"default_bit\":null,\"id\":36,\"name\":{\"L\":\"indiv_self_cash\",\"O\":\"indiv_self_cash\"},\"offset\":35,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u56E2\\\\u4F53\\\\u81EA\\\\u8425\\\\u4E1A\\\\u52A1\\\\u73B0\\\\u91D1\",\"default\":\"0\",\"default_bit\":null,\"id\":37,\"name\":{\"L\":\"group_self_cash\",\"O\":\"group_self_cash\"},\"offset\":36,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u5BC4\\\\u552E\\\\u4E2A\\\\u4EBA\\\\u91D1\\\\u989D\",\"default\":\"0.00\",\"default_bit\":null,\"id\":38,\"name\":{\"L\":\"individ_proxy_cash\",\"O\":\"individ_proxy_cash\"},\"offset\":37,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":8,\"Tp\":246}},{\"comment\":\"(\\\\u5E9F\\\\u5F03)\\\\u5BC4\\\\u552E\\\\u52A8\\\\u9500\\\\u54C1\\\\u79CD\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":39,\"name\":{\"L\":\"individ_proxy_drug\",\"O\":\"individ_proxy_drug\"},\"offset\":38,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":6,\"Tp\":2}},{\"comment\":\"\\\\u662F\\\\u5426\\\\u7279\\\\u6B8A\\\\u5BA1\\\\u6279\\\\u7684\\\\u5730\\\\u63A8\\\\u8D26\\\\u53F7\\\\uFF0C0-\\\\u5426 1-\\\\u662F\\\\uFF0C\\\\u5F53user_type=0\\\\u65F6\\\\u4F7F\\\\u7528\",\"default\":\"0\",\"default_bit\":null,\"id\":40,\"name\":{\"L\":\"b_spe_user\",\"O\":\"b_spe_user\"},\"offset\":39,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":4,\"Tp\":1}},{\"comment\":\"\\\\u662F\\\\u5426\\\\u73B0\\\\u91D1\\\\u7279\\\\u6279\\\\uFF0C0-\\\\u5426 1-\\\\u662F\",\"default\":\"0\",\"default_bit\":null,\"id\":41,\"name\":{\"L\":\"b_spe_cash\",\"O\":\"b_spe_cash\"},\"offset\":40,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":4,\"Tp\":1}},{\"comment\":\"\\\\u7279\\\\u6279\\\\u73B0\\\\u91D1\\\\u6263\\\\u9664\\\\u91D1\\\\u989D\",\"default\":\"0.00\",\"default_bit\":null,\"id\":42,\"name\":{\"L\":\"spe_dis_cash\",\"O\":\"spe_dis_cash\"},\"offset\":41,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u662F\\\\u5426\\\\u5E97\\\\u6570\\\\u7279\\\\u6279\\\\uFF0C0-\\\\u5426 1-\\\\u662F\",\"default\":\"0\",\"default_bit\":null,\"id\":43,\"name\":{\"L\":\"b_spe_cnt\",\"O\":\"b_spe_cnt\"},\"offset\":42,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":4,\"Tp\":1}},{\"comment\":\"\\\\u5E97\\\\u6570\\\\u7279\\\\u6279-\\\\u53C2\\\\u8003\\\\u5E97\\\\u6570\",\"default\":\"0.00\",\"default_bit\":null,\"id\":44,\"name\":{\"L\":\"spe_ref_cnt\",\"O\":\"spe_ref_cnt\"},\"offset\":43,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u8BE5\\\\u6708\\\\u62FC\\\\u56E2\\\\u5E97\\\\u6570\\\\u57FA\\\\u51C6\\\\u503C\",\"default\":\"0\",\"default_bit\":null,\"id\":45,\"name\":{\"L\":\"teambuy_valid_store_cnt\",\"O\":\"teambuy_valid_store_cnt\"},\"offset\":44,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":11,\"Tp\":3}},{\"comment\":\"\\\\u56FA\\\\u5B9A\\\\u4EBA\\\\u5747\\\\u65B0\\\\u5E97\\\\u503C\",\"default\":\"0\",\"default_bit\":null,\"id\":52,\"name\":{\"L\":\"newstore_perbd\",\"O\":\"newstore_perbd\"},\"offset\":45,\"origin_default\":\"0\",\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":4,\"Tp\":1}},{\"comment\":\"\\\\u65B0\\\\u5E97\\\\u6570\\\\u76EE\\\\u6807\",\"default\":\"0\",\"default_bit\":null,\"id\":46,\"name\":{\"L\":\"new_store_cnt\",\"O\":\"new_store_cnt\"},\"offset\":46,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":33,\"Flen\":11,\"Tp\":3}},{\"comment\":\"\\\\u81EA\\\\u8425\\\\u73B0\\\\u91D1\\\\u6307\\\\u6807\",\"default\":\"0.00\",\"default_bit\":null,\"id\":47,\"name\":{\"L\":\"self_cash_quota\",\"O\":\"self_cash_quota\"},\"offset\":47,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":12,\"Tp\":246}},{\"comment\":\"\\\\u6307\\\\u6807\\\\u672A\\\\u5206\\\\u89E3\\\\u5B8C\\\\u6210\\\\u539F\\\\u56E0\\\\u5907\\\\u6CE8\",\"default\":null,\"default_bit\":null,\"id\":48,\"name\":{\"L\":\"note\",\"O\":\"note\"},\"offset\":48,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"utf8\",\"Collate\":\"utf8_bin\",\"Decimal\":0,\"Elems\":null,\"Flag\":0,\"Flen\":255,\"Tp\":15}},{\"comment\":\"\\\\u8BA1\\\\u5212\\\\u62DB\\\\u65B0\\\\u4EBA\\\\u6570\",\"default\":\"0\",\"default_bit\":null,\"id\":49,\"name\":{\"L\":\"plan_new_staff\",\"O\":\"plan_new_staff\"},\"offset\":49,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":0,\"Flen\":6,\"Tp\":9}},{\"comment\":\"\\\\u662F\\\\u5426\\\\u9996\\\\u63A8\\\\u73B0\\\\u91D1\\\\u7279\\\\u6279\\\\uFF0C0-\\\\u5426 1-\\\\u662F\",\"default\":\"0\",\"default_bit\":null,\"id\":50,\"name\":{\"L\":\"fr_spe_cash\",\"O\":\"fr_spe_cash\"},\"offset\":50,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":4,\"Tp\":1}},{\"comment\":\"\\\\u7279\\\\u6279\\\\u9996\\\\u63A8\\\\u73B0\\\\u91D1\\\\u6263\\\\u9664\\\\u91D1\\\\u989D\",\"default\":\"0.00\",\"default_bit\":null,\"id\":51,\"name\":{\"L\":\"fr_spe_dis_cash\",\"O\":\"fr_spe_dis_cash\"},\"offset\":51,\"origin_default\":null,\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u57CE\\\\u5E02\\\\u73B0\\\\u91D1\\\\u6307\\\\u5BFC\\\\u503C\",\"default\":\"0.00\",\"default_bit\":null,\"id\":53,\"name\":{\"L\":\"hrbp_cash_cnt\",\"O\":\"hrbp_cash_cnt\"},\"offset\":52,\"origin_default\":\"0.00\",\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u57CE\\\\u5E02\\\\u5E97\\\\u6570\\\\u6307\\\\u5BFC\\\\u503C\",\"default\":\"0.00\",\"default_bit\":null,\"id\":54,\"name\":{\"L\":\"hrbp_drugstore_cnt\",\"O\":\"hrbp_drugstore_cnt\"},\"offset\":53,\"origin_default\":\"0.00\",\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":0,\"Elems\":null,\"Flag\":1,\"Flen\":6,\"Tp\":3}},{\"comment\":\"\\\\u57CE\\\\u5E02\\\\u9996\\\\u63A8\\\\u73B0\\\\u91D1\\\\u6307\\\\u5BFC\\\\u503C\",\"default\":\"0.00\",\"default_bit\":null,\"id\":55,\"name\":{\"L\":\"hrbp_fr_cash_cnt\",\"O\":\"hrbp_fr_cash_cnt\"},\"offset\":54,\"origin_default\":\"0.00\",\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":10,\"Tp\":246}},{\"comment\":\"\\\\u57CE\\\\u5E02\\\\u9996\\\\u63A8\\\\u8986\\\\u76D6\\\\u7387\",\"default\":\"0.00\",\"default_bit\":null,\"id\":56,\"name\":{\"L\":\"hrbp_cover_rate_cnt\",\"O\":\"hrbp_cover_rate_cnt\"},\"offset\":55,\"origin_default\":\"0.00\",\"state\":5,\"type\":{\"Charset\":\"binary\",\"Collate\":\"binary\",\"Decimal\":2,\"Elems\":null,\"Flag\":1,\"Flen\":4,\"Tp\":246}}],\"comment\":\"\\\\u6BCF\\\\u6708\\\\u4EFB\\\\u52A1\\\\u6307\\\\u6807\\\\u4E0B\\\\u8FBE\\\\u8868\",\"id\":28972,\"index_info\":[],\"is_common_handle\":false,\"name\":{\"L\":\"ts_salesmen_task\",\"O\":\"ts_salesmen_task\"},\"partition\":null,\"pk_is_handle\":false,\"schema_version\":25171,\"state\":5,\"tiflash_replica\":{\"Count\":0},\"update_timestamp\":427987705934381079}')"] [thread_id=1]
[2021/09/26 19:30:33.376 +08:00] [INFO] [<unknown>] ["StorageDeltaMerge: /home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/tics/dbms/src/Storages/StorageDeltaMerge.cpp updateTableColumnInfo TableName t_28972 ordinary columns format version: 1\n57 columns:\n`user_id` Int32\n`month` Int32\n`user_type` Int8\n`sys_cash` Decimal(16,2)\n`individual_cash` Decimal(10,2)\n`indiv_cash_fr` Decimal(10,2)\n`indiv_cash_fr_min` Decimal(10,2)\n`sys_group_cash` Decimal(16,2)\n`group_cash` Decimal(16,2)\n`group_cash_fr` Decimal(16,2)\n`individ_store_cash` Decimal(10,2)\n`group_store_cash` Decimal(16,2)\n`individ_hall_cash` Decimal(10,2)\n`group_hall_cash` Decimal(16,2)\n`adjust_cash` Decimal(10,2)\n`sys_store_cnt` UInt32\n`indiv_store_cnt` UInt32\n`indiv_store_cnt_wt` Decimal(5,4)\n`sys_group_store_cnt` UInt32\n`group_store_cnt` UInt32\n`sys_new_store_cnt` Int32\n`indiv_new_store_cnt` Int32\n`indiv_new_store_cnt_wt` Decimal(5,4)\n`sys_group_new_store_cnt` Int32\n`group_new_store_cnt` Int32\n`group_signed_store_cnt` Int32\n`indiv_signed_store_cnt` Int32\n`sys_struct_cnt` Int32\n`indiv_struct_cnt` Int32\n`indiv_struct_cnt_wt` Decimal(5,4)\n`sys_group_struct_cnt` Int32\n`group_struct_cnt` Int32\n`struct_stage` Int32\n`mtime` MyDateTime(0)\n`ctime` Int32\n`indiv_self_cash` Int32\n`group_self_cash` Int32\n`individ_proxy_cash` Decimal(8,2)\n`individ_proxy_drug` Int16\n`b_spe_user` Int8\n`b_spe_cash` Int8\n`spe_dis_cash` Decimal(10,2)\n`b_spe_cnt` Int8\n`spe_ref_cnt` Decimal(10,2)\n`teambuy_valid_store_cnt` Int32\n`newstore_perbd` Int8\n`new_store_cnt` UInt32\n`self_cash_quota` Decimal(12,2)\n`note` Nullable(String)\n`plan_new_staff` Nullable(Int32)\n`fr_spe_cash` Int8\n`fr_spe_dis_cash` Decimal(10,2)\n`hrbp_cash_cnt` Decimal(10,2)\n`hrbp_drugstore_cnt` Int32\n`hrbp_fr_cash_cnt` Decimal(10,2)\n`hrbp_cover_rate_cnt` Decimal(4,2)\n`_tidb_rowid` Int64\n materialized columns format version: 1\n0 columns:\n"] [thread_id=1]
[2021/09/26 19:30:33.377 +08:00] [ERROR] [<unknown>] ["Application: Bootstrap failed because sync schema error: Syntax error: Not a valid integer: 0.00\nWe will sleep for 3 seconds and try again."] [thread_id=1]
@solotzg solotzg added the type/bug The issue is confirmed as a bug. label Sep 26, 2021
@solotzg
Copy link
Contributor Author

solotzg commented Sep 26, 2021

@JaySon-Huang PTAL

@solotzg
Copy link
Contributor Author

solotzg commented Sep 26, 2021

https://asktug.com/t/topic/182849/11 tiflash log files

@JaySon-Huang
Copy link
Contributor

Minimal reproduce steps:

mysql test> create table t (a int);
-- The type of column i is int, but the default value is set to "0.00"
mysql test> alter table t add column i int not null default 0.00; 
mysql test> show create table t;
+-------+-------------------------------------------------------------+
| Table | Create Table                                                |
+-------+-------------------------------------------------------------+
| t     | CREATE TABLE `t` (                                          |
|       |   `a` int(11) DEFAULT NULL,                                 |
|       |   `i` int(11) NOT NULL DEFAULT '0.00'                       |
|       | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+-------------------------------------------------------------+

And tidb store "0.00" as the default value of "origin_default" in column "i"

>  curl "http://127.0.0.1:10080/schema/test/t"
{
 "id": 53,
 "name": {
  "O": "t",
  "L": "t"
 },
 "charset": "utf8mb4",
 "collate": "utf8mb4_bin",
 "cols": [
  {
   "id": 1,
   "name": {
    "O": "a",
    "L": "a"
   },
   "offset": 0,
   "origin_default": null,
   "origin_default_bit": null,
   "default": null,
   "default_bit": null,
   "default_is_expr": false,
   "generated_expr_string": "",
   "generated_stored": false,
   "dependences": null,
   "type": {
    "Tp": 3,
    "Flag": 0,
    "Flen": 11,
    "Decimal": 0,
    "Charset": "binary",
    "Collate": "binary",
    "Elems": null
   },
   "state": 5,
   "comment": "",
   "hidden": false,
   "change_state_info": null,
   "version": 2
  },
  {
   "id": 2,
   "name": {
    "O": "i",
    "L": "i"
   },
   "offset": 1,
   },
   "offset": 1,
   "origin_default": "0.00",  <-- "0.00"
   "origin_default_bit": null,
   "default": "0.00",
   "default_bit": null,
   "default_is_expr": false,
   "generated_expr_string": "",
   "generated_stored": false,
   "dependences": null,
   "type": {
    "Tp": 3,
    "Flag": 1,
    "Flen": 11,
    "Decimal": 0,
    "Charset": "binary",
    "Collate": "binary",
    "Elems": null
   },
   "state": 5,
   "comment": "",
   "hidden": false,
   "change_state_info": null,
   "version": 2
  }
 ],
 "index_info": null,
 "constraint_info": null,
 "fk_info": null,
 "state": 5,
 "pk_is_handle": false,
 "is_common_handle": false,
 "common_handle_version": 0,
 "comment": "",
 "auto_inc_id": 0,
 "auto_id_cache": 0,
 "auto_rand_id": 0,
 "max_col_id": 2,
 "max_idx_id": 0,
 "max_cst_id": 0,
 "update_timestamp": 427992978283823105,
 "ShardRowIDBits": 0,
 "max_shard_row_id_bits": 0,
 "auto_random_bits": 0,
 "pre_split_regions": 0,
 "partition": null,
 "compression": "",
 "view": null,
 "sequence": null,
 "Lock": null,
 "version": 4,
 "tiflash_replica": null,
 "is_columnar": false,
 "temp_table_type": 0
}

TiFlash store "0.00" as a Poco::Dynamic::Var and parse it as int later, which throw an exception
https://github.com/pingcap/tics/blob/e415b4300b78a64c43d01f4a8fd3fda95bea4113/dbms/src/Storages/Transaction/TiDB.h#L170-L172
https://github.com/pingcap/tics/blob/e415b4300b78a64c43d01f4a8fd3fda95bea4113/dbms/src/Storages/Transaction/TiDB.cpp#L51-L58

@JaySon-Huang
Copy link
Contributor

Modifying the default value of the column "i" from "0.00" to "0" does not help recover from this error. It only changes the "default_value" in ColumnInfo, but does not change the "origin_default_value".

In order to workaround this error, user can

  • add another column "i2" with default value "0"
  • copy the values from "i" to "i2"
  • drop the column "i"
  • rename the column "i2" to "i"

@JaySon-Huang
Copy link
Contributor

BTW, If we do the same add column in MySQL 5.7, it will store "0" as the default value for int column instead of "0.00"

mysql> create table t (a int);
mysql>  alter table t add column i int not null default 0.00;
mysql> show create table t;
+-------+--------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                             |
+-------+--------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` int(11) DEFAULT NULL,
  `i` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------------+
mysql> select version();
+-------------------------+
| version()               |
+-------------------------+
| 5.7.33-0ubuntu0.16.04.1 |
+-------------------------+

@solotzg
Copy link
Contributor Author

solotzg commented Sep 27, 2021

It can be solved by delete and re-create table with correct default value.

@solotzg
Copy link
Contributor Author

solotzg commented Sep 28, 2021

QA and PR think it's a bug. TiF;ash should support such case. @JaySon-Huang Do you have any idea ?

@JaySon-Huang
Copy link
Contributor

It is necessary to further investigate how the DDL behaves in the case of some illegal inputs.
For example, an int column with floating-point default value; a tiny int column with default value larger than it maximum; an unsigned column with negative default value; a datetime column with invalid date... etc

@JaySon-Huang JaySon-Huang changed the title Bootstrap failed because sync schema error Bootstrap failed because of an invalid default value to the corresponding type Sep 28, 2021
@solotzg
Copy link
Contributor Author

solotzg commented Sep 29, 2021

It is necessary to further investigate how the DDL behaves in the case of some illegal inputs. For example, an int column with floating-point default value; a tiny int column with default value larger than it maximum; an unsigned column with negative default value; a datetime column with invalid date... etc

Agree. There is no need for TiDB to support all ridiculous behaviours.

@Lloyd-Pottiger
Copy link
Contributor

@JaySon-Huang maybe we should resolve "0.0" as "0" in tidb just like mysql rather than pass "0.0" to tiflash and handle it in tiflash?

@JaySon-Huang
Copy link
Contributor

@JaySon-Huang maybe we should resolve "0.0" as "0" in tidb just like mysql rather than pass "0.0" to tiflash and handle it in tiflash?

This is one of the solutions. But it does not resolve the problem totally. Consider that the user created a table with that invalid default value in the old version(5.4 for example), and we fix that in a newer version (TiDB 6.2 for example). After user upgraded from 5.4 to 6.2 and deploy TiFlash node, they still meet this error.

@Lloyd-Pottiger
Copy link
Contributor

Lloyd-Pottiger commented May 17, 2022

  1. Add a backstop strategy by replacing https://github.com/pingcap/tiflash/blob/master/dbms/src/Storages/Transaction/TiDB.cpp#L119-L120 with
case TypeInt24:
{
    try {
        return value.convert<Int64>();
    } catch (...) {
        return static_cast<Int64>(std::stoull(value.convert<String>()));
    }
}
  1. Report a bug for tidb to resolve "0.0" as "0" in later version

@JaySon-Huang Do you think it is acceptable? or any suggestions?

@JaySon-Huang
Copy link
Contributor

@Lloyd-Pottiger LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 affects-5.0 affects-5.1 affects-5.2 affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. component/storage severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants