Skip to content

Commit

Permalink
hotfix: cherry pick pull 38232 38870 to release-6.3-20221108-v6.3.0 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Leavrth committed Nov 8, 2022
1 parent ecd6753 commit e8c6287
Show file tree
Hide file tree
Showing 7 changed files with 2,260 additions and 307 deletions.
1 change: 1 addition & 0 deletions br/pkg/restore/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ go_test(
"//types",
"//util/codec",
"//util/mathutil",
"@com_github_fsouza_fake_gcs_server//fakestorage",
"@com_github_golang_protobuf//proto",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
Expand Down
9 changes: 0 additions & 9 deletions br/pkg/restore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,6 @@ func (rc *Client) GetSupportPolicy() bool {
return rc.supportPolicy
}

// GetTruncateSafepoint read the truncate checkpoint from the storage bind to the client.
func (rc *Client) GetTruncateSafepoint(ctx context.Context) (uint64, error) {
ts, err := GetTSFromFile(ctx, rc.storage, TruncateSafePointFileName)
if err != nil {
log.Warn("failed to get truncate safepoint, using 0", logutil.ShortError(err))
}
return ts, err
}

func (rc *Client) GetDomain() *domain.Domain {
return rc.dom
}
Expand Down
21 changes: 17 additions & 4 deletions br/pkg/restore/log_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,19 @@ func TestReadFromMetadata(t *testing.T) {

meta := new(StreamMetadataSet)
meta.Helper = stream.NewMetadataHelper()
meta.LoadUntil(ctx, loc, c.untilTS)
meta.LoadUntilAndCalculateShiftTS(ctx, loc, c.untilTS)

var metas []*backuppb.Metadata
for _, m := range meta.metadata {
for path := range meta.metadataInfos {
data, err := loc.ReadFile(ctx, path)
require.NoError(t, err)

m, err := meta.Helper.ParseToMetadataHard(data)
require.NoError(t, err)

metas = append(metas, m)
}

actualStoreIDs := make([]int64, 0, len(metas))
for _, meta := range metas {
actualStoreIDs = append(actualStoreIDs, meta.StoreId)
Expand Down Expand Up @@ -436,10 +443,16 @@ func TestReadFromMetadataV2(t *testing.T) {

meta := new(StreamMetadataSet)
meta.Helper = stream.NewMetadataHelper()
meta.LoadUntil(ctx, loc, c.untilTS)
meta.LoadUntilAndCalculateShiftTS(ctx, loc, c.untilTS)

var metas []*backuppb.Metadata
for _, m := range meta.metadata {
for path := range meta.metadataInfos {
data, err := loc.ReadFile(ctx, path)
require.NoError(t, err)

m, err := meta.Helper.ParseToMetadataHard(data)
require.NoError(t, err)

metas = append(metas, m)
}
actualStoreIDs := make([]int64, 0, len(metas))
Expand Down
Loading

0 comments on commit e8c6287

Please sign in to comment.