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

schema(cdc): refactor schema snapshot to reduce memory usage #5144

Merged
merged 34 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
044b1ff
init: put schema snapshot into a package
hicqu Apr 1, 2022
3cb6c0a
introdce a mvcc schema storage
hicqu Apr 6, 2022
46a8324
make old tests compilable
hicqu Apr 7, 2022
228b1b8
unit tests for the new implementation
hicqu Apr 8, 2022
7523f7d
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 11, 2022
2d92b03
make check
hicqu Apr 11, 2022
f06b3fe
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 12, 2022
1c588f1
fix race and make lint
hicqu Apr 12, 2022
3eea023
fix a bug
hicqu Apr 12, 2022
1d4d0d9
fix lint
hicqu Apr 12, 2022
ac1f151
address comments
hicqu Apr 13, 2022
a7a437e
address comments
hicqu Apr 15, 2022
d6f3270
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 15, 2022
bcdcee5
make lint
hicqu Apr 15, 2022
56fd03a
Merge branch 'schema-snapshot-cow-1' of github.com:hicqu/ticdc into s…
hicqu Apr 15, 2022
bebbd73
address comments
hicqu Apr 19, 2022
07a98db
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 19, 2022
a5f5a7d
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 21, 2022
8387fd3
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 21, 2022
c316856
address comments
hicqu Apr 22, 2022
7eecb33
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 22, 2022
e7092a5
a little changes
hicqu Apr 22, 2022
7d6c5c2
address comments
hicqu Apr 25, 2022
e3ca412
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 25, 2022
3c222df
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 25, 2022
bfcad32
make fmt
hicqu Apr 25, 2022
f28c990
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 25, 2022
5440419
address comments
hicqu Apr 26, 2022
dd4c157
remove unsafe code
hicqu Apr 26, 2022
31a4d4e
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 26, 2022
a71bd01
make check
hicqu Apr 26, 2022
b69db52
Merge branch 'schema-snapshot-cow-1' of github.com:hicqu/ticdc into s…
hicqu Apr 26, 2022
826f9e4
Merge branch 'master' into schema-snapshot-cow-1
hicqu Apr 26, 2022
8854352
Merge branch 'master' into schema-snapshot-cow-1
ti-chi-bot Apr 26, 2022
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
12 changes: 6 additions & 6 deletions cdc/api/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/pingcap/log"
tidbkv "github.com/pingcap/tidb/kv"
"github.com/pingcap/tiflow/cdc/capture"
"github.com/pingcap/tiflow/cdc/entry"
"github.com/pingcap/tiflow/cdc/entry/schema"
"github.com/pingcap/tiflow/cdc/kv"
"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/cdc/sink"
Expand Down Expand Up @@ -215,25 +215,25 @@ func VerifyTables(replicaConfig *config.ReplicaConfig, storage tidbkv.Storage, s
if err != nil {
return nil, nil, errors.Trace(err)
}
snap, err := entry.NewSingleSchemaSnapshotFromMeta(meta, startTs, false /* explicitTables */)
snap, err := schema.NewSingleSnapshotFromMeta(meta, startTs, false /* explicitTables */)
if err != nil {
return nil, nil, errors.Trace(err)
}

for _, tableInfo := range snap.Tables() {
snap.IterTables(true, func(tableInfo *model.TableInfo) {
if filter.ShouldIgnoreTable(tableInfo.TableName.Schema, tableInfo.TableName.Table) {
continue
return
}
// Sequence is not supported yet, TiCDC needs to filter all sequence tables.
// See https://github.com/pingcap/tiflow/issues/4559
if tableInfo.IsSequence() {
continue
return
}
if !tableInfo.IsEligible(false /* forceReplicate */) {
ineligibleTables = append(ineligibleTables, tableInfo.TableName)
} else {
eligibleTables = append(eligibleTables, tableInfo.TableName)
}
}
})
return
}
2 changes: 1 addition & 1 deletion cdc/entry/mounter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func testMounterDisableOldValue(t *testing.T, tc struct {
err := scheamStorage.HandleDDLJob(job)
require.Nil(t, err)
}
tableInfo, ok := scheamStorage.GetLastSnapshot().GetTableByName("test", tc.tableName)
tableInfo, ok := scheamStorage.GetLastSnapshot().TableByName("test", tc.tableName)
require.True(t, ok)
if tableInfo.IsCommonHandle {
// we can check this log to make sure if the clustered-index is enabled
Expand Down
Loading