Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: avoid using Tables field of model.DBInfo, use API instead #52302

Merged
merged 31 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8401765
*: do not expose Tables field of model.DBInfo, use API instead
tiancaiamao Apr 2, 2024
bdc5779
fix build of parser/model
tiancaiamao Apr 2, 2024
5489b8a
fix build
tiancaiamao Apr 2, 2024
e6f73ed
fix build of dumpling
tiancaiamao Apr 2, 2024
bdf5261
fix test ingest
tiancaiamao Apr 2, 2024
739e917
fix test
tiancaiamao Apr 2, 2024
b39e43a
Merge branch 'master' into dbinfo-tables
tiancaiamao Apr 2, 2024
3a3af26
make fmt
tiancaiamao Apr 2, 2024
dab34d7
fix build for pkg/infoschema
tiancaiamao Apr 2, 2024
9595e5c
fix build
tiancaiamao Apr 2, 2024
4d37cfc
fix test build of restore
tiancaiamao Apr 2, 2024
b31473b
fix build of planner/core
tiancaiamao Apr 2, 2024
5c08b24
fix br ci
tiancaiamao Apr 3, 2024
6d73408
make fmt
tiancaiamao Apr 3, 2024
30e50a4
Merge branch 'master' into dbinfo-tables
tiancaiamao Apr 3, 2024
d381709
Merge branch 'master' into dbinfo-tables
tiancaiamao Apr 7, 2024
223a809
Merge branch 'master' into dbinfo-tables
tiancaiamao Apr 18, 2024
4e06c45
fix CI
tiancaiamao Apr 18, 2024
5f230d9
Merge branch 'master' into dbinfo-tables
tiancaiamao Apr 25, 2024
65fc35a
Merge branch 'master' into dbinfo-tables
tiancaiamao Jul 24, 2024
aa92dd3
resolve conflict
tiancaiamao Jul 24, 2024
a80d11e
fix build
tiancaiamao Jul 24, 2024
62a42c0
fix test build
tiancaiamao Jul 24, 2024
b3874ad
fix build
tiancaiamao Jul 24, 2024
dc49340
make bazel_prepare
tiancaiamao Jul 24, 2024
386b847
fix build
tiancaiamao Jul 24, 2024
95e2855
Merge branch 'master' into dbinfo-tables
tiancaiamao Jul 24, 2024
75ffbf5
Merge branch 'master' into dbinfo-tables
tiancaiamao Jul 24, 2024
59867b9
resolve conflict
tiancaiamao Jul 24, 2024
43591ba
Merge branch 'master' into dbinfo-tables
tiancaiamao Jul 25, 2024
b7ff03e
Merge branch 'master' into dbinfo-tables
tiancaiamao Jul 25, 2024
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
18 changes: 9 additions & 9 deletions br/pkg/metautil/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ func TestLoadBackupMeta(t *testing.T) {
mockDB := model.DBInfo{
ID: 1,
Name: dbName,
Tables: []*model.TableInfo{
mockTbl,
},
}
mockDB.Deprecated.Tables = []*model.TableInfo{
mockTbl,
}
dbBytes, err := json.Marshal(mockDB)
require.NoError(t, err)
Expand Down Expand Up @@ -140,9 +140,9 @@ func TestLoadBackupMetaPartionTable(t *testing.T) {
mockDB := model.DBInfo{
ID: 1,
Name: dbName,
Tables: []*model.TableInfo{
mockTbl,
},
}
mockDB.Deprecated.Tables = []*model.TableInfo{
mockTbl,
}
dbBytes, err := json.Marshal(mockDB)
require.NoError(t, err)
Expand Down Expand Up @@ -249,9 +249,9 @@ func buildBenchmarkBackupmeta(b *testing.B, dbName string, tableCount, fileCount
mockDB := model.DBInfo{
ID: 1,
Name: model.NewCIStr(dbName),
Tables: []*model.TableInfo{
mockTbl,
},
}
mockDB.Deprecated.Tables = []*model.TableInfo{
mockTbl,
}
dbBytes, err := json.Marshal(mockDB)
require.NoError(b, err)
Expand Down
2 changes: 2 additions & 0 deletions br/pkg/restore/ingestrec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
importpath = "github.com/pingcap/tidb/br/pkg/restore/ingestrec",
visibility = ["//visibility:public"],
deps = [
"//pkg/infoschema/context",
"//pkg/parser/model",
"//pkg/types",
"@com_github_pingcap_errors//:errors",
Expand All @@ -20,6 +21,7 @@ go_test(
shard_count = 3,
deps = [
":ingestrec",
"//pkg/infoschema/context",
"//pkg/parser/model",
"@com_github_pingcap_errors//:errors",
"@com_github_stretchr_testify//require",
Expand Down
9 changes: 6 additions & 3 deletions br/pkg/restore/ingestrec/ingest_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
package ingestrec

import (
"context"
"fmt"
"strings"

"github.com/pingcap/errors"
infoschema "github.com/pingcap/tidb/pkg/infoschema/context"
"github.com/pingcap/tidb/pkg/parser/model"
"github.com/pingcap/tidb/pkg/types"
)
Expand Down Expand Up @@ -136,9 +138,10 @@ func (i *IngestRecorder) RewriteTableID(rewriteFunc func(tableID int64) (int64,
}

// UpdateIndexInfo uses the newest schemas to update the ingest index's information
func (i *IngestRecorder) UpdateIndexInfo(dbInfos []*model.DBInfo) {
for _, dbInfo := range dbInfos {
for _, tblInfo := range dbInfo.Tables {
func (i *IngestRecorder) UpdateIndexInfo(is infoschema.SchemaAndTable) {
for _, dbInfo := range is.AllSchemas() {
tblInfos, _ := is.SchemaTableInfos(context.Background(), dbInfo.Name)
for _, tblInfo := range tblInfos {
tableindexes, tblexists := i.items[tblInfo.ID]
if !tblexists {
continue
Expand Down
Loading
Loading