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

domain information schema may be wrong if switching schema cache v1/v2 and getting snapshot information schema #55114

Closed
wjhuang2016 opened this issue Jul 31, 2024 · 0 comments · Fixed by #55129
Assignees
Labels
feature/developing the related feature is in development severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

When switching schema cache v1/v2, we would clear the whole schema cache.

	if isV1V2Switch && schemaTs > 0 {
		// Reset the whole info cache to avoid co-existing of both v1 and v2, causing the memory usage doubled.
		fn := do.infoCache.Upsert(is, schemaTs)
		do.deferFn.add(fn, time.Now().Add(10*time.Minute))
	} else {
		do.infoCache.Insert(is, schemaTs)
	}

After getting the snapshot schema, the only schema in the cache is the snapshot schema, which is not the newest schema.
Then domain.Infoschma is wrong.

// InfoSchema gets the latest information schema from domain.
func (do *Domain) InfoSchema() infoschema.InfoSchema {
	return do.infoCache.GetLatest()
}

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

N/A

3. What did you see instead (Required)

N/A

4. What is your TiDB version? (Required)

master

@wjhuang2016 wjhuang2016 added the type/bug The issue is confirmed as a bug. label Jul 31, 2024
@tiancaiamao tiancaiamao self-assigned this Jul 31, 2024
@tiancaiamao tiancaiamao added the feature/developing the related feature is in development label Aug 1, 2024
@jebter jebter added the sig/sql-infra SIG: SQL Infra label Aug 2, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 52b4c8a Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/developing the related feature is in development severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants