Skip to content

Commit 68d54f5

Browse files
lichunzhuti-chi-bot
authored andcommitted
address comments
1 parent f56dc66 commit 68d54f5

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

br/pkg/lightning/restore/table_restore.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,12 @@ func (tr *TableRestore) postProcess(
794794
}
795795
hasDupe = hasLocalDupe
796796
}
797-
failpoint.Inject("SlowDownCheckDupe", func() {})
797+
failpoint.Inject("SlowDownCheckDupe", func(v failpoint.Value) {
798+
sec := v.(int)
799+
tr.logger.Warn("start to sleep several seconds before checking other dupe",
800+
zap.Int("seconds", sec))
801+
time.Sleep(time.Duration(sec) * time.Second)
802+
})
798803

799804
otherHasDupe, needRemoteDupe, baseTotalChecksum, err := metaMgr.CheckAndUpdateLocalChecksum(ctx, &localChecksum, hasDupe)
800805
if err != nil {

br/tests/lightning_duplicate_resolution_incremental/run.sh

+20-1
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,33 @@ LOG_FILE1="$TEST_DIR/lightning-duplicate-resolution1.log"
2222
LOG_FILE2="$TEST_DIR/lightning-duplicate-resolution2.log"
2323

2424
# let lightning run a bit slow to avoid some table in the first lightning finish too fast.
25-
export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/lightning/restore/SlowDownCheckDupe=sleep(5000)"
25+
export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/lightning/restore/SlowDownCheckDupe=return(10)"
2626
run_lightning --backend local --sorted-kv-dir "$TEST_DIR/lightning_duplicate_resolution_incremental.sorted1" \
2727
--enable-checkpoint=1 --log-file "$LOG_FILE1" --config "tests/$TEST_NAME/config1.toml" &
28+
29+
counter=0
30+
while [ $counter -lt 10 ]; do
31+
if grep -Fq "start to sleep several seconds before checking other dupe" "$LOG_FILE1"; then
32+
echo "lightning 1 already starts waiting for dupe"
33+
break
34+
fi
35+
((counter += 1))
36+
echo "waiting for lightning 1 starts"
37+
sleep 1
38+
done
39+
40+
if [ $counter -ge 10 ]; then
41+
echo "fail to wait for lightning 1 starts"
42+
exit 1
43+
fi
44+
2845
run_lightning --backend local --sorted-kv-dir "$TEST_DIR/lightning_duplicate_resolution_incremental.sorted2" \
2946
--enable-checkpoint=1 --log-file "$LOG_FILE2" --config "tests/$TEST_NAME/config2.toml" &
3047

3148
wait
3249

50+
export GO_FAILPOINTS=""
51+
3352
# Ensure table is consistent.
3453
run_sql 'admin check table dup_resolve_detect.ta'
3554

0 commit comments

Comments
 (0)