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

lightning precheck failed for the first time but passed for the following import #30772

Closed
fubinzh opened this issue Dec 16, 2021 · 1 comment · Fixed by #31033
Closed

lightning precheck failed for the first time but passed for the following import #30772

fubinzh opened this issue Dec 16, 2021 · 1 comment · Fixed by #31033
Assignees
Labels
affects-5.3 This bug affects 5.3.x versions. component/lightning This issue is related to Lightning of TiDB. found/automation Found by automation tests severity/major type/bug The issue is confirmed as a bug.

Comments

@fubinzh
Copy link

fubinzh commented Dec 16, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Prepare lightning test data, table schema with colomn new_col1 with no default value, and data source doesn't have data for this column
[root@centos76_vm dbgen]# cat precheck/precheck.t1-schema.sql
CREATE TABLE t1 (
    pid varchar(100) NOT NULL,
    goods_id varchar(100) NOT NULL,
    title varchar(200) DEFAULT NULL,
    image_url mediumtext DEFAULT NULL,
    updatetime varchar(50) DEFAULT NULL,
    new_col1 int NOT NULL,
    PRIMARY KEY(pid,goods_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
[root@centos76_vm dbgen]# head precheck/precheck.t1.1.csv
"pid","goods_id","title","image_url","updatetime"
"37637890044074","2946892232737829","8rbZ8sZ_oYE9EZLUAJWrX","Vamr4Lgx56BzXvKZ4KQGfem9L0tCMVBv6dLu0k5tg0vmS1YO9T1ZGF5OAUgoVinZoKS9ſNQlJdWzQ8wDTp6oR1yviYc1pHyaulorEhtaqF4W1VyLsPGhNgQkDrHjtwVM75BMUVLas9Npuy83KMſTQOmGF0ktlQxXW_8C-hwK2oOLYyEf4hZ4Hnj7I2i",2001-12-24 19:10:48
"6688000924385","691553188377774412","rz_GPQED","bYaG3ZoHiVyHa6HDP5fOY6J0BZ-iit-5Vſk7UB4Rk5xmrvNRkKUhsjr9BqKKDQboybo80iuzfcWj-N1CcrNLDqJKCm80dGfw-EqpGmaFAW8_m95FKSjKJs2VqIKHſ6NMXlExHGTSkwVu",2000-08-17 07:24:26
"2215546251974526","096840957","WAWWVX_RBHei","Eftuy_VmlAkHcſPS_Ch1Z8TvMEz7ZCZ1K-MkdA_SOTMfIUB5NI2EixoH0_riO7FdFlEoh2OzKqkYxxzj3ElegZ7KEXmaPQEQEAf7bmsbe-1pF96aDfi2pW6_HlxHQu6ttHyoPmVmi2N3WWh1UUz_9ſ",2028-12-27 21:21:18
"0055630","13525206","l1IhO1JauW0lJ","KſmLYrFGZK5mbPTUuhg6gz09j-ſK2KEK8Man5mjqCEPn15ULjZYlBboo",2003-12-06 19:31:42
"8437472036991143","11911","rtBkV","Z4K02P4sNy0wg5G1DxJr8ahK6W8o1GJQDSoUuce",2004-12-24 12:27:13
"1935123630031169294","05916","gCx80whwy7KqWN5l19lo2","mteOzjEXIE66aLBN6c8yfG0JCjo8C2wLF0MuST1VJs1cxeAOeKo9Ko9Jſ49L4z2S1YnDſetPg_n6dwNa2tsRz-Cp7gdv4UNh0mBGNv3W2nQKPOQmPUFhAy9wKpJYf-3n7qEFtwCcwrcC0r",2029-04-27 11:36:19
"89589244614204429","27352091","wWILMbh3nur","ſeſwMPhv87etyoKbx",1987-05-04 23:21:46
"19644","2297395953","zZ2_H7kX","e1cCSrnvn04mA_yhPaCmS6mnKAtaTKeBPKHod0L72F6Bm3ſLlat-OV5kK6Lx7_iJIcQfFIEODf3MiR-cKcZp33Pnd_V7aB8ORwN8iQUAT1DqTsVJh4yſg5075L8_vYuqhcQpr7mK_X-SKdULeR5NivYs_qCT2no5QLF0aL8SaqgK7QcNdJTRoGz4hu0cRK8J",2004-10-23 00:47:53
"95551","367889764131665","cyc4sB","ZPI1IUP1nbzjy2hSgFipITSY2Nh-i0fxzi97s2XXſPA6V2_WPKasce",2026-10-03 02:37:23
  1. Use lightning to import the data to TiDB -> Precheck failed as expected
[root@centos76_vm dbgen]# tiup tidb-lightning -config lighting.toml
Starting component `tidb-lightning`: /root/.tiup/components/tidb-lightning/v5.3.0/tidb-lightning -config lighting.toml
Verbose debug logs will be written to tidb-lightning.log

+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| # | CHECK ITEM                                                                                                                         | TYPE        | PASSED |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 1 | Source csv files size is proper                                                                                                    | performance | true   |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 2 | checkpoints are valid                                                                                                              | critical    | true   |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 3 | TiDB schema `precheck`.`t1` doesn't have the default value for new_col1please give a default value for new_col1 or choose another  | critical    | false  |
|   | column to ignore or add this column in data file                                                                                   |             |        |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 4 | Cluster is available                                                                                                               | critical    | true   |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 5 | Lightning has the correct storage permission                                                                                       | critical    | true   |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 6 | sorted-kv-dir:/home/sorted-kv-dir and data-source-dir:/home/tools_test_data/dbgen/precheck are in the same disk, may slow down per | performance | false  |
|   | formance                                                                                                                           |             |        |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 7 | local disk resources are rich, estimate sorted data size 9.721KiB, local available is 184.9GiB                                     | critical    | true   |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
| 8 | Cluster available is rich, available is 185.3GiB, we need 33.39GiB                                                                 | critical    | true   |
+---+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
1 critical check failed,1 performance check failedError: tidb-lightning check failed. Please fix the failed check(s):
 Source csv files size is proper;
checkpoints are valid;
TiDB schema `precheck`.`t1` doesn't have the default value for new_col1please give a default value for new_col1 or choose another column to ignore or add this column in data file;
Cluster is available;
Lightning has the correct storage permission;
sorted-kv-dir:/home/sorted-kv-dir and data-source-dir:/home/tools_test_data/dbgen/precheck are in the same disk, may slow down performance;
local disk resources are rich, estimate sorted data size 9.721KiB, local available is 184.9GiB;
Cluster available is rich, available is 185.3GiB, we need 33.39GiB
tidb lightning encountered error:  tidb-lightning check failed. Please fix the failed check(s):
 Source csv files size is proper;
checkpoints are valid;
TiDB schema `precheck`.`t1` doesn't have the default value for new_col1please give a default value for new_col1 or choose another column to ignore or add this column in data file;
Cluster is available;
Lightning has the correct storage permission;
sorted-kv-dir:/home/sorted-kv-dir and data-source-dir:/home/tools_test_data/dbgen/precheck are in the same disk, may slow down performance;
local disk resources are rich, estimate sorted data size 9.721KiB, local available is 184.9GiB;
Cluster available is rich, available is 185.3GiB, we need 33.39GiB
Error: run `/root/.tiup/components/tidb-lightning/v5.3.0/tidb-lightning` (wd:/root/.tiup/data/SrjKwQT) failed: exit status 1
  1. Don't do anything, run lightning import again

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

For the 2nd import, lightning should fail due to precheck as well.

3. What did you see instead (Required)

2nd import was successful, in lightning log we can see: "column missing from data file, going to fill with default value"

[2021/12/16 13:12:46.038 +08:00] [INFO] [restore.go:1685] ["switch to import mode"]
[2021/12/16 13:12:46.044 +08:00] [INFO] [restore.go:1464] ["restore table start"] [table=`precheck`.`t1`]
[2021/12/16 13:12:46.044 +08:00] [INFO] [table_restore.go:91] ["load engines and files start"] [table=`precheck`.`t1`]
[2021/12/16 13:12:46.045 +08:00] [INFO] [region.go:241] [makeTableRegions] [filesCount=5] [MaxRegionSize=268435456] [RegionsCount=5] [BatchSize=107374182400] [cost=135.577µs]
[2021/12/16 13:12:46.045 +08:00] [INFO] [table_restore.go:129] ["load engines and files completed"] [table=`precheck`.`t1`] [enginesCnt=2] [filesCnt=5] [takeTime=226.839µs] []
[2021/12/16 13:12:46.063 +08:00] [INFO] [meta_manager.go:330] ["allocate table row_id base"] [table=`precheck`.`t1`] [row_id_base=0]
[2021/12/16 13:12:46.075 +08:00] [INFO] [backend.go:346] ["open engine"] [engineTag=`precheck`.`t1`:-1] [engineUUID=b9a7cbef-f770-547a-b1db-dfe162b6131e]
[2021/12/16 13:12:46.075 +08:00] [INFO] [table_restore.go:264] ["import whole table start"] [table=`precheck`.`t1`]
[2021/12/16 13:12:46.076 +08:00] [INFO] [table_restore.go:311] ["restore engine start"] [table=`precheck`.`t1`] [engineNumber=0]
[2021/12/16 13:12:46.076 +08:00] [INFO] [table_restore.go:416] ["encode kv data and write start"] [table=`precheck`.`t1`] [engineNumber=0]
[2021/12/16 13:12:46.089 +08:00] [INFO] [backend.go:346] ["open engine"] [engineTag=`precheck`.`t1`:0] [engineUUID=6f025642-1888-5b63-a070-a69b34753392]
[2021/12/16 13:12:46.101 +08:00] [INFO] [restore.go:2440] ["restore file start"] [table=`precheck`.`t1`] [engineNumber=0] [fileIndex=0] [path=precheck.t1.1.csv:0]
[2021/12/16 13:12:46.101 +08:00] [WARN] [table_restore.go:890] ["column missing from data file, going to fill with default value"] [table=t1] [colName=new_col1] [colType=int(11)]
[2021/12/16 13:12:46.103 +08:00] [INFO] [restore.go:2450] ["restore file completed"] [table=`precheck`.`t1`] [engineNumber=0] [fileIndex=0] [path=precheck.t1.1.csv:0] [readDur=274.242µs] [encodeDur=509.981µs] [deliverDur=252.756µs] [checksum="{cksum=17040059719714780867,size=2705,kvs=20}"] [takeTime=1.340621ms] []

4. What is your TiDB version? (Required)

[release-version=v5.3.0]
[git-hash=79e237d9d336e78f1933e38940f2e1703e383b1f]
[git-branch=heads/refs/tags/v5.3.0]
[go-version=go1.16.4]

@fubinzh fubinzh added type/bug The issue is confirmed as a bug. severity/major component/lightning This issue is related to Lightning of TiDB. found/automation Found by automation tests labels Dec 16, 2021
@fubinzh fubinzh changed the title lightning precheck failed for the first time but passed for the second run lightning precheck failed for the first time but passed for the following import Dec 16, 2021
@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

@jebter jebter added the affects-5.3 This bug affects 5.3.x versions. label Jan 18, 2022
YuJuncen pushed a commit to pingcap/br that referenced this issue Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 This bug affects 5.3.x versions. component/lightning This issue is related to Lightning of TiDB. found/automation Found by automation tests severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants