forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pitr: prevent from restore point to cluster running log backup (pingc…
…ap#40871) ref pingcap#40797
- Loading branch information
1 parent
b811752
commit 576655e
Showing
5 changed files
with
99 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
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,56 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright 2022 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 | ||
DB="$TEST_NAME" | ||
TABLE="usertable" | ||
|
||
# start log task | ||
run_br log start --task-name 1234 -s "local://$TEST_DIR/$DB/log" --pd $PD_ADDR | ||
|
||
run_sql "CREATE DATABASE $DB;" | ||
run_sql "CREATE TABLE $DB.$TABLE (id int);" | ||
run_sql "INSERT INTO $DB.$TABLE VALUES (1), (2), (3);" | ||
|
||
# backup full | ||
run_br backup full -s "local://$TEST_DIR/$DB/full" --pd $PD_ADDR | ||
|
||
# clean db | ||
run_sql "DROP DATABASE $DB;" | ||
|
||
# restore full (should be failed) | ||
run_br restore full -s "local://$TEST_DIR/$DB/full" --pd $PD_ADDR && exit 1 | ||
|
||
# restore point (should be failed) | ||
run_br restore point -s "local://$TEST_DIR/$DB/log" --pd $PD_ADDR && exit 1 | ||
|
||
# pause log task | ||
run_br log pause --task-name 1234 --pd $PD_ADDR | ||
|
||
# restore full (should be failed) | ||
run_br restore full -s "local://$TEST_DIR/$DB/full" --pd $PD_ADDR && exit 1 | ||
|
||
# restore point (should be failed) | ||
run_br restore point -s "local://$TEST_DIR/$DB/log" --pd $PD_ADDR && exit 1 | ||
|
||
# stop log task | ||
run_br log stop --task-name 1234 --pd $PD_ADDR | ||
|
||
# restore full (should be success) | ||
run_br restore full -s "local://$TEST_DIR/$DB/full" --pd $PD_ADDR | ||
|
||
# clean db | ||
run_sql "DROP DATABASE $DB" |