-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
92518cd
commit 0fabd47
Showing
13 changed files
with
119 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[lightning] | ||
task-info-schema-name = 'lightning_task_info' | ||
|
||
[tikv-importer] | ||
backend = 'local' | ||
add-index-by-sql = false | ||
parallel-import = true | ||
|
||
[conflict] | ||
strategy = "replace" | ||
precheck-conflict-before-import= true | ||
|
||
[checkpoint] | ||
enable = false | ||
|
||
[mydumper] | ||
batch-size = 1 | ||
|
||
[mydumper.csv] | ||
header = true |
1 change: 1 addition & 0 deletions
1
br/tests/lightning_duplicate_resolution_merge/data1/dup_resolve-schema-create.sql
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 @@ | ||
create schema dup_resolve; |
5 changes: 5 additions & 0 deletions
5
br/tests/lightning_duplicate_resolution_merge/data1/dup_resolve.a-schema.sql
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,5 @@ | ||
create table a ( | ||
a int primary key clustered, | ||
b int not null, | ||
c text | ||
); |
7 changes: 7 additions & 0 deletions
7
br/tests/lightning_duplicate_resolution_merge/data1/dup_resolve.a.1.csv
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,7 @@ | ||
a,b,c | ||
1,1,1.csv | ||
1,1,2.csv | ||
1,1,3.csv | ||
2,2,1.csv | ||
2,1,1.csv | ||
2,2,2.csv |
9 changes: 9 additions & 0 deletions
9
br/tests/lightning_duplicate_resolution_merge/data1/dup_resolve.a.2.csv
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,9 @@ | ||
a,b,c | ||
3,3,3.csv | ||
3,4,4.csv | ||
4,3,4.csv | ||
4,4,4.csv | ||
4,5,4.csv | ||
5,5,5.csv | ||
5,6,6.csv | ||
6,6,6.csv |
1 change: 1 addition & 0 deletions
1
br/tests/lightning_duplicate_resolution_merge/data2/dup_resolve-schema-create.sql
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 @@ | ||
create schema dup_resolve; |
5 changes: 5 additions & 0 deletions
5
br/tests/lightning_duplicate_resolution_merge/data2/dup_resolve.a-schema.sql
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,5 @@ | ||
create table a ( | ||
a int primary key clustered, | ||
b int not null, | ||
c text | ||
); |
7 changes: 7 additions & 0 deletions
7
br/tests/lightning_duplicate_resolution_merge/data2/dup_resolve.a.1.csv
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,7 @@ | ||
a,b,c | ||
1,1,1.csv | ||
1,1,2.csv | ||
1,1,3.csv | ||
2,2,1.csv | ||
2,1,1.csv | ||
2,2,2.csv |
9 changes: 9 additions & 0 deletions
9
br/tests/lightning_duplicate_resolution_merge/data2/dup_resolve.a.2.csv
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,9 @@ | ||
a,b,c | ||
13,3,3.csv | ||
13,4,4.csv | ||
14,3,4.csv | ||
14,4,4.csv | ||
14,5,4.csv | ||
15,5,5.csv | ||
15,6,6.csv | ||
16,6,6.csv |
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,49 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2024 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 | ||
|
||
CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
|
||
LOG_FILE1="$TEST_DIR/lightning_duplicate_resolution_merge1.log" | ||
LOG_FILE2="$TEST_DIR/lightning_duplicate_resolution_merge2.log" | ||
|
||
# let lightning run a bit slow to avoid some table in the first lightning finish too fast. | ||
export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/lightning/importer/SlowDownImport=sleep(250)" | ||
|
||
run_lightning --backend local --sorted-kv-dir "$TEST_DIR/lightning_duplicate_resolution_merge.sorted1" \ | ||
-d "$CUR/data1" --log-file "$LOG_FILE1" --config "$CUR/config.toml" & | ||
pid1="$!" | ||
|
||
run_lightning --backend local --sorted-kv-dir "$TEST_DIR/lightning_duplicate_resolution_merge.sorted2" \ | ||
-d "$CUR/data2" --log-file "$LOG_FILE2" --config "$CUR/config.toml" & | ||
pid2="$!" | ||
|
||
wait "$pid1" "$pid2" | ||
|
||
# Ensure all tables are consistent. | ||
run_sql 'admin check table dup_resolve.a' | ||
|
||
run_sql 'select count(*) from dup_resolve.a' | ||
check_contains 'count(*): 10' | ||
|
||
run_sql 'select count(*) from lightning_task_info.conflict_records' | ||
check_contains 'count(*): 16' | ||
|
||
run_sql 'select count(*) from lightning_task_info.conflict_error_v2' | ||
check_contains 'count(*): 4' |
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