From 22899aefefea359c628da07bbbc96df07375a423 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Wed, 25 Sep 2024 18:27:15 +0800 Subject: [PATCH] br: fix checkpoint path (#55266) (#55298) close pingcap/tidb#55265 --- br/pkg/checkpoint/checkpoint.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/br/pkg/checkpoint/checkpoint.go b/br/pkg/checkpoint/checkpoint.go index a7707afda2e04..eac317ca0a5f3 100644 --- a/br/pkg/checkpoint/checkpoint.go +++ b/br/pkg/checkpoint/checkpoint.go @@ -22,6 +22,7 @@ import ( "encoding/json" "fmt" "math/rand" + "path" "strings" "sync" "time" @@ -41,7 +42,7 @@ import ( "golang.org/x/sync/errgroup" ) -const CheckpointDir = "/checkpoints" +const CheckpointDir = "checkpoints" type flushPosition struct { CheckpointDataDir string @@ -641,8 +642,8 @@ func (r *CheckpointRunner[K, V]) checkLockFile(ctx context.Context, now int64) e } else if lock.LockId != r.lockId { return errors.Errorf("The existing lock will expire in %d seconds. "+ "There may be another BR(%d) running. If not, you can wait for the lock to expire, "+ - "or delete the file `%s%s` manually.", - (lock.ExpireAt-now)/1000, lock.LockId, strings.TrimRight(r.storage.URI(), "/"), r.CheckpointLockPath) + "or delete the file `%s` manually.", + (lock.ExpireAt-now)/1000, lock.LockId, path.Join(r.storage.URI(), r.CheckpointLockPath)) } return nil