-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lightning: check hasDupe and tableID when resolve duplicate rows (#40696
) close #40657
- Loading branch information
1 parent
76153ab
commit 06e2b29
Showing
10 changed files
with
92 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[tikv-importer] | ||
backend = "local" | ||
duplicate-resolution = "remove" | ||
|
||
[mydumper.csv] | ||
header = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE `t` ( | ||
`id` int(11) NOT NULL, | ||
`name` varchar(255) DEFAULT NULL, | ||
PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */, | ||
UNIQUE KEY `uni_name` (`name`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
id,name | ||
1,"aaa01" | ||
2,"aaa02" | ||
3,"aaa03" | ||
4,"aaa04" | ||
5,"aaa04" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE `t` ( | ||
`id` int(11) NOT NULL, | ||
`name` varchar(255) DEFAULT NULL, | ||
PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */, | ||
UNIQUE KEY `uni_name` (`name`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
id,name | ||
1,"aaa01" | ||
2,"aaa02" | ||
3,"aaa03" | ||
4,"aaa04" | ||
5,"aaa05" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2023 PingCAP, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -eux | ||
|
||
check_cluster_version 5 2 0 'duplicate detection' || exit 0 | ||
|
||
run_lightning -d "tests/$TEST_NAME/data1" | ||
run_sql 'admin check table test.t' | ||
run_sql 'select count(*) from test.t' | ||
check_contains 'count(*): 3' | ||
run_sql 'select count(*) from lightning_task_info.conflict_error_v1' | ||
check_contains 'count(*): 2' | ||
|
||
run_sql 'truncate table test.t' | ||
run_lightning -d "tests/$TEST_NAME/data2" | ||
run_sql 'admin check table test.t' | ||
run_sql 'select count(*) from test.t' | ||
check_contains 'count(*): 5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters