Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions br/pkg/conn/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ go_library(
"//pkg/ddl",
"//pkg/domain",
"//pkg/kv",
"//pkg/sessionctx/vardef",
"//pkg/sessionctx/variable",
"@com_github_docker_go_units//:go-units",
"@com_github_opentracing_opentracing_go//:opentracing-go",
"@com_github_pingcap_errors//:errors",
Expand Down
12 changes: 0 additions & 12 deletions br/pkg/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import (
"github.com/pingcap/tidb/pkg/ddl"
"github.com/pingcap/tidb/pkg/domain"
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/sessionctx/vardef"
"github.com/pingcap/tidb/pkg/sessionctx/variable"
"github.com/tikv/client-go/v2/oracle"
"github.com/tikv/client-go/v2/tikv"
"github.com/tikv/client-go/v2/txnkv/txnlock"
Expand Down Expand Up @@ -231,16 +229,6 @@ func NewMgr(
}
}

if err = g.UseOneShotSession(storage, !needDomain, func(se glue.Session) error {
enableFollowerHandleRegion, err := se.GetGlobalSysVar(vardef.PDEnableFollowerHandleRegion)
if err != nil {
return err
}
return controller.SetFollowerHandle(variable.TiDBOptOn(enableFollowerHandleRegion))
}); err != nil {
return nil, errors.Trace(err)
}

mgr := &Mgr{
PdController: controller,
storage: storage,
Expand Down
11 changes: 8 additions & 3 deletions br/pkg/task/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,14 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf
if err != nil {
log.Warn("failed to remove checkpoint data for compacted restore", zap.Error(err))
}
err = cfg.snapshotCheckpointMetaManager.RemoveCheckpointData(c)
if err != nil {
log.Warn("failed to remove checkpoint data for snapshot restore", zap.Error(err))
// Skip removing snapshot checkpoint data if this is a pure log restore
// (i.e. restoring only from log backup without a base snapshot backup),
// since snapshotCheckpointMetaManager would be nil in that case
if cfg.snapshotCheckpointMetaManager != nil {
err = cfg.snapshotCheckpointMetaManager.RemoveCheckpointData(c)
if err != nil {
log.Warn("failed to remove checkpoint data for snapshot restore", zap.Error(err))
}
}
} else {
err = cfg.snapshotCheckpointMetaManager.RemoveCheckpointData(c)
Expand Down
4 changes: 2 additions & 2 deletions br/tests/br_full_ddl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ fi

# when we have backup stats during backup, we cannot close domain during one shot session.
# so we can check the log count of `one shot domain closed`.
# we will call UseOneShotSession twice to get the value global variable.
# we will call UseOneShotSession once to get the value global variable.
one_shot_session_count=$(cat $LOG | grep "one shot session closed" | wc -l | xargs)
one_shot_domain_count=$(cat $LOG | grep "one shot domain closed" | wc -l | xargs)
if [ "${one_shot_session_count}" -ne "2" ] || [ "$one_shot_domain_count" -ne "0" ];then
if [ "${one_shot_session_count}" -ne "1" ] || [ "$one_shot_domain_count" -ne "0" ];then
echo "TEST: [$TEST_NAME] fail on one shot session check, $one_shot_session_count, $one_shot_domain_count"
exit 1
fi
Expand Down
12 changes: 6 additions & 6 deletions br/tests/br_incremental_ddl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ run_br --pd $PD_ADDR backup table -s "local://$TEST_DIR/$DB/full" --db $DB -t $T

# when we backup, we should close domain in one shot session.
# so we can check the log count of `one shot domain closed` to be 2.
# we will call UseOneShotSession twice to get the value global variable.
# we will call UseOneShotSession once to get the value global variable.
one_shot_session_count=$(cat $LOG | grep "one shot session closed" | wc -l | xargs)
one_shot_domain_count=$(cat $LOG | grep "one shot domain closed" | wc -l | xargs)
if [ "${one_shot_session_count}" -ne "2" ] || [ "$one_shot_domain_count" -ne "2" ];then
if [ "${one_shot_session_count}" -ne "1" ] || [ "$one_shot_domain_count" -ne "1" ];then
echo "TEST: [$TEST_NAME] fail on one shot session check during backup, $one_shot_session_count, $one_shot_domain_count"
exit 1
fi
Expand Down Expand Up @@ -74,13 +74,13 @@ last_backup_ts=$(run_br validate decode --field="end-version" -s "local://$TEST_
run_br --pd $PD_ADDR backup db -s "local://$TEST_DIR/$DB/inc" --db $DB --lastbackupts $last_backup_ts --log-file $LOG

# when we doing incremental backup, we should close domain in one shot session.
# so we can check the log count of `one shot domain closed` to be 3.
# we will call UseOneShotSession three times
# 1. to get the value global variable twice.
# so we can check the log count of `one shot domain closed` to be 2.
# we will call UseOneShotSession two times
# 1. to get the value global variable once.
# 2. to get all ddl jobs with session.
one_shot_session_count=$(cat $LOG | grep "one shot session closed" | wc -l | xargs)
one_shot_domain_count=$(cat $LOG | grep "one shot domain closed" | wc -l | xargs)
if [ "${one_shot_session_count}" -ne "3" ] || [ "$one_shot_domain_count" -ne "3" ];then
if [ "${one_shot_session_count}" -ne "2" ] || [ "$one_shot_domain_count" -ne "2" ];then
echo "TEST: [$TEST_NAME] fail on one shot session check during inc backup, $one_shot_session_count, $one_shot_domain_count"
exit 1
fi
Expand Down
Loading