Error in Data Export with Dump

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: dump导出数据报错

| username: TiDBer_OB4kHrS7

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] Error when exporting data using dumpling
[Encountered Problem: Problem Phenomenon and Impact]
/data/software/tidb-toolkit-v5.3.2-linux-amd64/bin/dumpling -u $YOUR_USER -p $YOUR_PASSWD -P 4000 -h 10.8.123.8 --filetype sql -t 8 -B erp2stock10 -r 1000 -F 32MB -o /data/erp2stock10/
Export error, the prompt is as follows:

[Resource Configuration]
[Attachment: Screenshot/Log/Monitoring]

| username: 路在何chu | Original post link

Check if there are any issues with the two tables that are reporting errors.

| username: TiDBer_OB4kHrS7 | Original post link

Can this be fixed?

| username: RenlySir | Original post link

Try this to repair the index.

| username: Fly-bird | Original post link

:100: :100: :100: :100:

| username: TiDBer_OB4kHrS7 | Original post link

After deleting the index, an error occurred when rebuilding the index.

| username: TiDBer_OB4kHrS7 | Original post link

After deleting the index, the export still reports the same error.

| username: hey-hoho | Original post link

Try running this show index statement on TiDB to see if it reports an error. If it does, check the tidb.log for any abnormal information.

| username: TiDBer_OB4kHrS7 | Original post link

The original index was deleted, and an error occurred when it was recreated later.

mysql> alter table inv_stock_daily_summary add INDEX idx_stockdate_goodsid_entid_depotid_transtypeid_deleted (depot_id,goods_id,stock_date,trans_type_id,ent_id,deleted);
ERROR 8202 (HY000): Cannot decode index value, because [types:1292]Incorrect time value: '{0 0 0 0 0 0 1554}'

Only checking the primary key index, no issues.

| username: hey-hoho | Original post link

Try removing stock_date and then creating the index.

| username: TiDBer_OB4kHrS7 | Original post link

It still doesn’t work
mysql> alter table inv_stock_daily_summary add UNIQUE KEY ux_stockdate_goodsid_entid_depotid_transtypeid_deleted (depot_id,goods_id,trans_type_id,ent_id,deleted);
ERROR 8202 (HY000): Cannot decode index value, because [types:1292]Incorrect time value: ‘{0 0 0 0 0 0 1554}’

| username: Miracle | Original post link

Is “deleted” a time-type field?

| username: zhanggame1 | Original post link

Try using select insert to rebuild the table if the data volume is not large.

| username: 大飞哥online | Original post link

Show the table structure.

| username: TiDBer_小阿飞 | Original post link

The error message says there is no connection. Is there an issue with this index?

| username: TiDBer_OB4kHrS7 | Original post link

CREATE TABLE `inv_stock_daily_summary` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `ent_id` bigint(20) NOT NULL,
  `org_id` bigint(20) DEFAULT NULL,
  `depot_id` bigint(20) NOT NULL,
  `depot_code` varchar(35) NOT NULL DEFAULT '',
  `depot_name` varchar(60) NOT NULL DEFAULT '',
  `goods_id` bigint(20) NOT NULL,
  `goods_code` varchar(30) NOT NULL,
  `goods_name` varchar(60) NOT NULL,
  `stock_date` date NOT NULL,
  `period_no` varchar(6) NOT NULL,
  `trans_type_id` bigint(20) NOT NULL,
  `trans_type` varchar(35) NOT NULL,
  `trans_name` varchar(60) NOT NULL DEFAULT '',
  `io_flag` int(11) NOT NULL DEFAULT '1',
  `day_acc_qty` decimal(18,6) NOT NULL DEFAULT '0.000000',
  `day_acc_amt` decimal(18,6) NOT NULL DEFAULT '0.000000',
  `day_acc_fin_amt` decimal(18,6) NOT NULL DEFAULT '0.000000',
  `version` int(11) NOT NULL DEFAULT '1',
  `deleted` bigint(20) NOT NULL DEFAULT '0',
  `creator_code` varchar(35) NOT NULL DEFAULT '',
  `creator_name` varchar(60) NOT NULL DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `creator_org_code` varchar(35) NOT NULL DEFAULT '',
  `modifier_code` varchar(35) NOT NULL DEFAULT '',
  `modifier_name` varchar(60) NOT NULL DEFAULT '',
  `last_modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `modifier_org_code` varchar(35) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=668267625;
| username: TiDBer_OB4kHrS7 | Original post link

deleted bigint(20)

| username: TiDBer_OB4kHrS7 | Original post link

mysql> insert into inv_stock_daily_summary_bak1027 select * from inv_stock_daily_summary;
ERROR 1105 (HY000): invalid data type: Failed to decode row v2 data as u64

| username: TiDBer_QHSxuEa1 | Original post link

“‘{0 0 0 0 0 0 1554}’ Should we first check if there are any special values in the row under this unique index? Record the data, delete this row, and then see if it can be exported?”

| username: TiDBer_OB4kHrS7 | Original post link

Querying with the WHERE condition results in an error.