From 4147b779febbad6347a98bcfb1b6ec0833cb59e1 Mon Sep 17 00:00:00 2001 From: xixirangrang <35301108+hfxsd@users.noreply.github.com> Date: Thu, 18 Nov 2021 10:53:18 +0800 Subject: [PATCH 1/5] Update tidb-lightning-faq.md --- tidb-lightning/tidb-lightning-faq.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tidb-lightning/tidb-lightning-faq.md b/tidb-lightning/tidb-lightning-faq.md index 7fd4ad9031b29..a5dd706c7baaf 100644 --- a/tidb-lightning/tidb-lightning-faq.md +++ b/tidb-lightning/tidb-lightning-faq.md @@ -223,22 +223,21 @@ Try the latest version! Maybe there is new speed improvement. ## `checksum failed: checksum mismatched remote vs local` -**Cause**: The checksum of a table in the local data source and the remote imported database differ. This error has several deeper reasons: +**Cause**: The checksum of a table in the local data source and the remote imported database differ. This error has several deeper reasons. You can further locate the reason by checking the log that contains `checksum mismatched`. -1. The table might already have data before. These old data can affect the final checksum. +The lines that contain `checksum mismatched` provides the information `total_kvs: x vs y`, where `x` indicates the number of key-value pairs (KV pairs) calculated by the import cluster after the import is completed, and `y` indicates the number of key-value pairs generated by the local data source. -2. If the remote checksum is 0, which means nothing is imported, it is possible that the cluster is too hot and fails to take in any data. - -3. If the data is mechanically generated, ensure it respects the constrains of the table: - - * `AUTO_INCREMENT` columns need to be positive, and do not contain the value "0". - * The UNIQUE and PRIMARY KEYs must have no duplicated entries. - -4. If TiDB Lightning has failed before and was not properly restarted, a checksum mismatch may happen due to data being out-of-sync. +- If `x` is greater, it means that there are more KV pairs in the import cluster. + - It is possible that this table is populated before the import and therefore affects the data checksum. It is also possible that TiDB Lightning has previously failed and shut down, but did not restart correctly. +- If `y` is greater, it means that there are more KV pairs in the local data source. + - If the checksum of the target database is all 0, it means that no import has occurred. It is possible that the cluster is too busy to receive any data. + - It is possible that the exported data contains duplicate data, such as unique and primary keys (UNIQUE and PRIMARY KEYs) with duplicate values, or that the downstream table structure is case-insensitive while the data is case-sensitive. +- Other possible reasons + - If the data source is machine-generated and not backed up by Dumpling, make sure the data conforms to the table limits, e.g., the AUTO_INCREMENT column needs to be positive and not 0. **Solutions**: -1. Delete the corrupted data using `tidb-lightning-ctl`, and restart TiDB Lightning to import the affected tables again. +1. Delete the corrupted data using `tidb-lightning-ctl`, check the table structure and the data, and restart TiDB Lightning to import the affected tables again. {{< copyable "shell-regular" >}} From 9c0f87446f44407892bd27a5ecb831be2f68f20b Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Thu, 18 Nov 2021 13:55:01 +0800 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: glorv --- tidb-lightning/tidb-lightning-faq.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tidb-lightning/tidb-lightning-faq.md b/tidb-lightning/tidb-lightning-faq.md index a5dd706c7baaf..6485032d7afaa 100644 --- a/tidb-lightning/tidb-lightning-faq.md +++ b/tidb-lightning/tidb-lightning-faq.md @@ -227,8 +227,8 @@ Try the latest version! Maybe there is new speed improvement. The lines that contain `checksum mismatched` provides the information `total_kvs: x vs y`, where `x` indicates the number of key-value pairs (KV pairs) calculated by the import cluster after the import is completed, and `y` indicates the number of key-value pairs generated by the local data source. -- If `x` is greater, it means that there are more KV pairs in the import cluster. - - It is possible that this table is populated before the import and therefore affects the data checksum. It is also possible that TiDB Lightning has previously failed and shut down, but did not restart correctly. +- If `x` is greater, it means that there are more KV pairs in the target cluster. + - It is possible that this table is not empty before the import and therefore affects the data checksum. It is also possible that TiDB Lightning has previously failed and shut down, but did not restart correctly. - If `y` is greater, it means that there are more KV pairs in the local data source. - If the checksum of the target database is all 0, it means that no import has occurred. It is possible that the cluster is too busy to receive any data. - It is possible that the exported data contains duplicate data, such as unique and primary keys (UNIQUE and PRIMARY KEYs) with duplicate values, or that the downstream table structure is case-insensitive while the data is case-sensitive. From 14a591602ce0b397cba3da40f44e693647d8af7d Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Fri, 19 Nov 2021 20:18:43 +0800 Subject: [PATCH 3/5] Update tidb-lightning/tidb-lightning-faq.md Co-authored-by: lance6716 --- tidb-lightning/tidb-lightning-faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-lightning/tidb-lightning-faq.md b/tidb-lightning/tidb-lightning-faq.md index 6485032d7afaa..95d60d07387d7 100644 --- a/tidb-lightning/tidb-lightning-faq.md +++ b/tidb-lightning/tidb-lightning-faq.md @@ -225,7 +225,7 @@ Try the latest version! Maybe there is new speed improvement. **Cause**: The checksum of a table in the local data source and the remote imported database differ. This error has several deeper reasons. You can further locate the reason by checking the log that contains `checksum mismatched`. -The lines that contain `checksum mismatched` provides the information `total_kvs: x vs y`, where `x` indicates the number of key-value pairs (KV pairs) calculated by the import cluster after the import is completed, and `y` indicates the number of key-value pairs generated by the local data source. +The lines that contain `checksum mismatched` provides the information `total_kvs: x vs y`, where `x` indicates the number of key-value pairs (KV pairs) calculated by the target cluster after the import is completed, and `y` indicates the number of key-value pairs generated by the local data source. - If `x` is greater, it means that there are more KV pairs in the target cluster. - It is possible that this table is not empty before the import and therefore affects the data checksum. It is also possible that TiDB Lightning has previously failed and shut down, but did not restart correctly. From 05796f3b68ad206ebd78c668b0fbafe162436a9d Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Fri, 19 Nov 2021 20:18:54 +0800 Subject: [PATCH 4/5] Update tidb-lightning/tidb-lightning-faq.md Co-authored-by: lance6716 --- tidb-lightning/tidb-lightning-faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-lightning/tidb-lightning-faq.md b/tidb-lightning/tidb-lightning-faq.md index 95d60d07387d7..fac5c8b78a1c7 100644 --- a/tidb-lightning/tidb-lightning-faq.md +++ b/tidb-lightning/tidb-lightning-faq.md @@ -231,7 +231,7 @@ The lines that contain `checksum mismatched` provides the information `total_kvs - It is possible that this table is not empty before the import and therefore affects the data checksum. It is also possible that TiDB Lightning has previously failed and shut down, but did not restart correctly. - If `y` is greater, it means that there are more KV pairs in the local data source. - If the checksum of the target database is all 0, it means that no import has occurred. It is possible that the cluster is too busy to receive any data. - - It is possible that the exported data contains duplicate data, such as unique and primary keys (UNIQUE and PRIMARY KEYs) with duplicate values, or that the downstream table structure is case-insensitive while the data is case-sensitive. + - It is possible that the exported data contains duplicate data, such as UNIQUE and PRIMARY KEYs with duplicate values, or that the downstream table structure is case-insensitive while the data is case-sensitive. - Other possible reasons - If the data source is machine-generated and not backed up by Dumpling, make sure the data conforms to the table limits, e.g., the AUTO_INCREMENT column needs to be positive and not 0. From 44e13d438e5e6ae407728faf662b3503a2c91c5a Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Fri, 19 Nov 2021 21:03:01 +0800 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Liuxiaozhen12 <82579298+Liuxiaozhen12@users.noreply.github.com> --- tidb-lightning/tidb-lightning-faq.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tidb-lightning/tidb-lightning-faq.md b/tidb-lightning/tidb-lightning-faq.md index fac5c8b78a1c7..1c4102eb88541 100644 --- a/tidb-lightning/tidb-lightning-faq.md +++ b/tidb-lightning/tidb-lightning-faq.md @@ -225,15 +225,15 @@ Try the latest version! Maybe there is new speed improvement. **Cause**: The checksum of a table in the local data source and the remote imported database differ. This error has several deeper reasons. You can further locate the reason by checking the log that contains `checksum mismatched`. -The lines that contain `checksum mismatched` provides the information `total_kvs: x vs y`, where `x` indicates the number of key-value pairs (KV pairs) calculated by the target cluster after the import is completed, and `y` indicates the number of key-value pairs generated by the local data source. +The lines that contain `checksum mismatched` provide the information `total_kvs: x vs y`, where `x` indicates the number of key-value pairs (KV pairs) calculated by the target cluster after the import is completed, and `y` indicates the number of key-value pairs generated by the local data source. - If `x` is greater, it means that there are more KV pairs in the target cluster. - It is possible that this table is not empty before the import and therefore affects the data checksum. It is also possible that TiDB Lightning has previously failed and shut down, but did not restart correctly. - If `y` is greater, it means that there are more KV pairs in the local data source. - If the checksum of the target database is all 0, it means that no import has occurred. It is possible that the cluster is too busy to receive any data. - - It is possible that the exported data contains duplicate data, such as UNIQUE and PRIMARY KEYs with duplicate values, or that the downstream table structure is case-insensitive while the data is case-sensitive. + - It is possible that the exported data contains duplicate data, such as the UNIQUE and PRIMARY KEYs with duplicate values, or that the downstream table structure is case-insensitive while the data is case-sensitive. - Other possible reasons - - If the data source is machine-generated and not backed up by Dumpling, make sure the data conforms to the table limits, e.g., the AUTO_INCREMENT column needs to be positive and not 0. + - If the data source is machine-generated and not backed up by Dumpling, make sure the data conforms to the table limits. For example, the AUTO_INCREMENT column needs to be positive and not 0. **Solutions**: