Skip to content

Commit

Permalink
ignore some dirty schema in tidb (pingcap#35)
Browse files Browse the repository at this point in the history
Co-authored-by: 3pointer <[email protected]>
  • Loading branch information
3pointer and 3pointer committed Mar 5, 2020
1 parent 5b532ab commit be707a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions v4/export/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func Dump(conf *Config) (err error) {
if err != nil {
return err
}

if !conf.NoViews {
views, err := listAllViews(pool, databases)
if err != nil {
Expand All @@ -37,6 +38,8 @@ func Dump(conf *Config) (err error) {
conf.Tables.Merge(views)
}

filterDirtySchemaTables(conf)

conCtrl, err := NewConsistencyController(conf, pool)
if err != nil {
return err
Expand Down
14 changes: 14 additions & 0 deletions v4/export/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"

"github.com/pingcap/dumpling/v4/log"
"go.uber.org/zap"
)

func detectServerInfo(db *sql.DB) (ServerInfo, error) {
Expand Down Expand Up @@ -92,3 +93,16 @@ func (d DatabaseTables) Merge(other DatabaseTables) {
d[name] = append(d[name], infos...)
}
}

func filterDirtySchemaTables(conf *Config) {
switch conf.ServerInfo.ServerType {
case ServerTypeTiDB:
for dbName := range conf.Tables {
switch strings.ToUpper(dbName) {
case "INSPECTION_SCHEMA", "METRICS_SCHEMA", "PERFORMANCE_SCHEMA", "INFORMATION_SCHEMA":
log.Zap().Warn("unsupported dump schema in TiDB now", zap.String("schema", dbName))
delete(conf.Tables, dbName)
}
}
}
}

0 comments on commit be707a3

Please sign in to comment.