Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

filter: refine system database filter rule #194

Merged
merged 4 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 0 additions & 17 deletions v4/export/block_allow_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,11 @@ package export

import (
"github.com/pingcap/dumpling/v4/log"
"github.com/pingcap/tidb-tools/pkg/filter"
"go.uber.org/zap"
)

func filterDirtySchemaTables(conf *Config) {
switch conf.ServerInfo.ServerType {
case ServerTypeTiDB:
if conf.Sql == "" {
for dbName := range conf.Tables {
if filter.IsSystemSchema(dbName) {
log.Warn("unsupported dump schema in TiDB now", zap.String("schema", dbName))
delete(conf.Tables, dbName)
}
}
}
}
}

func filterTables(conf *Config) {
log.Debug("filter tables")
// filter dirty schema tables because of non-impedance implementation reasons
filterDirtySchemaTables(conf)
dbTables := DatabaseTables{}
ignoredDBTable := DatabaseTables{}

Expand Down
12 changes: 6 additions & 6 deletions v4/export/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (conf *Config) DefineFlags(flags *pflag.FlagSet) {
flags.BoolP(flagNoData, "d", false, "Do not dump table data")
flags.String(flagCsvNullValue, "\\N", "The null value used when export to csv")
flags.StringP(flagSql, "S", "", "Dump data with given sql. This argument doesn't support concurrent dump")
flags.StringSliceP(flagFilter, "f", []string{"*.*"}, "filter to select which tables to dump")
flags.StringSliceP(flagFilter, "f", []string{"*.*", DefaultTableFilter}, "filter to select which tables to dump")
flags.Bool(flagCaseSensitive, false, "whether the filter should be case-sensitive")
flags.Bool(flagDumpEmptyDatabase, true, "whether to dump empty database")
flags.Uint64(flagTidbMemQuotaQuery, DefaultTiDBMemQuotaQuery, "The maximum memory limit for a single SQL statement, in bytes. Default: 32GB")
Expand Down Expand Up @@ -483,11 +483,11 @@ func (config *Config) createExternalStorage(ctx context.Context) (storage.Extern
}

const (
UnspecifiedSize = 0
DefaultStatementSize = 1000000
TiDBMemQuotaQueryName = "tidb_mem_quota_query"

DefaultTiDBMemQuotaQuery uint64 = 32 << 30
UnspecifiedSize = 0
DefaultTiDBMemQuotaQuery = 32 << 30
DefaultStatementSize = 1000000
TiDBMemQuotaQueryName = "tidb_mem_quota_query"
DefaultTableFilter = "!/^(mysql|sys|INFORMATION_SCHEMA|PERFORMANCE_SCHEMA|METRICS_SCHEMA|INSPECTION_SCHEMA)$/.*"

defaultDumpThreads = 128
defaultDumpGCSafePointTTL = 5 * 60
Expand Down