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

When lightning is less capabile than downstream, USE <database> may miss so failed with "no database selected" #51800

Closed
lance6716 opened this issue Mar 15, 2024 · 0 comments · Fixed by #51801
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 component/lightning This issue is related to Lightning of TiDB. severity/major type/bug The issue is confirmed as a bug.

Comments

@lance6716
Copy link
Contributor

The source schema files may contain some unsupported feature, like unsupported chatset. When lightning failed to rewrite the statement, it directly uses the source file content. However, USE <database> is missing

func (worker *restoreSchemaWorker) addJob(sqlStr string, job *schemaJob) error {
stmts, err := createIfNotExistsStmt(worker.parser, sqlStr, job.dbName, job.tblName)
if err != nil {
worker.logger.Warn("failed to rewrite statement, will use raw input instead",
zap.String("db", job.dbName),
zap.String("table", job.tblName),
zap.String("statement", sqlStr),
zap.Error(err))
job.stmts = []string{sqlStr}
} else {
job.stmts = stmts
}
return worker.appendJob(job)
}

@lance6716 lance6716 added the type/bug The issue is confirmed as a bug. label Mar 15, 2024
@jebter jebter added component/lightning This issue is related to Lightning of TiDB. severity/major labels Mar 15, 2024
@lance6716 lance6716 changed the title When lightning failed to rewrite statement for schema files, USE <database> is missing When lightning failed to rewrite statement for schema files, USE <database> is missing so failed with "no database selected" Mar 15, 2024
@lance6716 lance6716 changed the title When lightning failed to rewrite statement for schema files, USE <database> is missing so failed with "no database selected" When lightning is less capabile than downstream, USE <database> may miss so failed with "no database selected" Mar 15, 2024
ti-chi-bot bot pushed a commit that referenced this issue Mar 18, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 2, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 15, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 component/lightning This issue is related to Lightning of TiDB. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
2 participants