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

dumpling: dump failed when a sequence created #30149

Closed
sylzd opened this issue Nov 25, 2021 · 5 comments · Fixed by #30164
Closed

dumpling: dump failed when a sequence created #30149

sylzd opened this issue Nov 25, 2021 · 5 comments · Fixed by #30164
Assignees
Labels
affects-5.3 This bug affects 5.3.x versions. component/dumpling This is related to Dumpling of TiDB. severity/major type/bug The issue is confirmed as a bug.

Comments

@sylzd
Copy link
Contributor

sylzd commented Nov 25, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

tidb> use test;
tidb> create sequence seq;

./dumpling -h host -u test_user -p test_password -P 4000 --filetype sql --threads 32 -o .

return dump failed. Since many people do not know what seq is, and error info is Error 1051: Unknown table '', it will make them confused and worried.

2. What did you expect to see? (Required)

dump successfully.

3. What did you see instead (Required)

dump failed: sql: SELECT * FROM `test`.`seq` LIMIT 1: Error 1051: Unknown table ''

4. What is your TiDB version? (Required)

master

@sylzd sylzd added the type/bug The issue is confirmed as a bug. label Nov 25, 2021
@sylzd
Copy link
Contributor Author

sylzd commented Nov 25, 2021

/assign

@kennytm kennytm added the component/dumpling This is related to Dumpling of TiDB. label Nov 25, 2021
@lichunzhu lichunzhu added type/feature-request Categorizes issue or PR as related to a new feature. and removed type/bug The issue is confirmed as a bug. severity/major labels Nov 25, 2021
@sylzd
Copy link
Contributor Author

sylzd commented Nov 25, 2021

show table status(the default show table method) cannot distinguish sequence from base table
image

related code:

func prepareTableListToDump(tctx *tcontext.Context, conf *Config, db *sql.Conn) error {
	databases, err := prepareDumpingDatabases(tctx, conf, db)
	if err != nil {
		return err
	}

	tableTypes := []TableType{TableTypeBase}
	if !conf.NoViews {
		tableTypes = append(tableTypes, TableTypeView)
	}
	conf.Tables, err = ListAllDatabasesTables(tctx, db, databases, getListTableTypeByConf(conf), tableTypes...)
	if err != nil {
		return err
	}

	filterTables(tctx, conf)
	return nil
}

func getListTableTypeByConf(conf *Config) listTableType {
	// use listTableByShowTableStatus by default because it has better performance
	listType := listTableByShowTableStatus
	if conf.Consistency == consistencyTypeLock {
		// for consistency lock, we need to build the tables to dump as soon as possible
		listType = listTableByInfoSchema
	} else if conf.Consistency == consistencyTypeFlush && matchMysqlBugversion(conf.ServerInfo) {
		// For some buggy versions of mysql, we need a workaround to get a list of table names.
		listType = listTableByShowFullTables
	}
	return listType
}

@sylzd
Copy link
Contributor Author

sylzd commented Nov 25, 2021

I think support sequence dump is a new feature, but dump failed is still a bug that should be fixed first (it will return error at once and affected other tables dump which makes tables dump incompletely!).

the feature pr can replace the unsupported error then. @kennytm @lichunzhu

@lichunzhu
Copy link
Contributor

I think support sequence dump is a new feature, but dump failed is still a bug that should be fixed first (it will return error at once and affected other tables dump which makes tables dump incompletely!).

I agree.

@lichunzhu lichunzhu added type/bug The issue is confirmed as a bug. severity/major and removed type/feature-request Categorizes issue or PR as related to a new feature. labels Nov 26, 2021
@fubinzh fubinzh added the affects-5.3 This bug affects 5.3.x versions. label Dec 2, 2021
@github-actions
Copy link

github-actions bot commented Dec 6, 2021

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 This bug affects 5.3.x versions. component/dumpling This is related to Dumpling of TiDB. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants