Skip to content

Commit

Permalink
lightning: fix lightning-ctl dump checkpoint file name (pingcap#58533)
Browse files Browse the repository at this point in the history
  • Loading branch information
River2000i authored Jan 2, 2025
1 parent f840fa9 commit 50ac5cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lightning/cmd/tidb-lightning-ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func run() error {
cpRemove = fs.String("checkpoint-remove", "", "remove the checkpoint associated with the given table (value can be 'all' or '`db`.`table`')")
cpErrIgnore = fs.String("checkpoint-error-ignore", "", "ignore errors encoutered previously on the given table (value can be 'all' or '`db`.`table`'); may corrupt this table if used incorrectly")
cpErrDestroy = fs.String("checkpoint-error-destroy", "", "deletes imported data with table which has an error before (value can be 'all' or '`db`.`table`')")
cpDump = fs.String("checkpoint-dump", "", "dump the checkpoint information as two CSV files in the given folder")
cpDump = fs.String("checkpoint-dump", "", "dump the checkpoint information as three CSV files in the given folder")

localStoringTables = fs.Bool("check-local-storage", false, "show tables that are missing local intermediate files (value can be 'all' or '`db`.`table`')")

Expand Down Expand Up @@ -252,7 +252,7 @@ func checkpointDump(ctx context.Context, cfg *config.Config, dumpFolder string)
defer tablesFile.Close()

enginesFileName := filepath.Join(dumpFolder, "engines.csv")
enginesFile, err := os.Create(tablesFileName)
enginesFile, err := os.Create(enginesFileName)
if err != nil {
return errors.Annotatef(err, "failed to create %s", enginesFileName)
}
Expand Down
12 changes: 12 additions & 0 deletions lightning/tests/lightning_local_backend/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,16 @@ for ckpt in mysql file; do
--config=$CUR/$ckpt.toml >$TEST_DIR/lightning_ctl.output 2>&1
grep -Fq "No table has lost intermediate files according to given config" $TEST_DIR/lightning_ctl.output
done
run_lightning_ctl \
--backend local \
--enable-checkpoint=1 \
--checkpoint-dump $TEST_DIR \
--config=$CUR/mysql.toml >$TEST_DIR/lightning_ctl.output 2>&1
# --checkpoint-dump option in lightning-ctl will dump checkpoint table as csv files to $TEST_DIR
for file in engines.csv chunks.csv tables.csv; do
if [ ! -f "$TEST_DIR/$file" ]; then
echo "$file does not exist in $TEST_DIR"
exit 1
fi
done
rm -r $TEST_DIR/$TEST_NAME.sorted

0 comments on commit 50ac5cc

Please sign in to comment.