-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Detect and signal schema changes on vttablets #8005
Conversation
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
I think |
Elaborating on my previous comment: Creation: vitess/go/vt/vttablet/onlineddl/executor.go Line 2292 in 0ce71c7
Called by tablet state manager, Which runs these queries: vitess/go/vt/vttablet/onlineddl/schema.go Lines 345 to 359 in 0ce71c7
Which, in particular, include: vitess/go/vt/vttablet/onlineddl/schema.go Line 21 in 0ce71c7
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one bug found.
Fear mongering alert: I guess my reservation is that every X minutes (30
in this code) we're going to query information_schema for all tables in a schema, which can be tens of thousands of tables in some environments. I actually never tried querying I_S for that many tables, and I fear this might be a risky operation.
@@ -107,6 +107,7 @@ func init() { | |||
flag.Int64Var(¤tConfig.QueryCacheMemory, "queryserver-config-query-cache-memory", defaultConfig.QueryCacheMemory, "query server query cache size in bytes, maximum amount of memory to be used for caching. vttablet analyzes every incoming query and generate a query plan, these plans are being cached in a lru cache. This config controls the capacity of the lru cache.") | |||
flag.BoolVar(¤tConfig.QueryCacheLFU, "queryserver-config-query-cache-lfu", defaultConfig.QueryCacheLFU, "query server cache algorithm. when set to true, a new cache algorithm based on a TinyLFU admission policy will be used to improve cache behavior and prevent pollution from sparse queries") | |||
SecondsVar(¤tConfig.SchemaReloadIntervalSeconds, "queryserver-config-schema-reload-time", defaultConfig.SchemaReloadIntervalSeconds, "query server schema reload time, how often vttablet reloads schemas from underlying MySQL instance in seconds. vttablet keeps table schemas in its own memory and periodically refreshes it from MySQL. This config controls the reload time.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this code already exists. But it's unclear from the name queryserver-config-schema-reload-time
what the units are. I'd assume it was a Duration
, but it's in fact seconds. I guess too later to change the name,
… signal Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
This one of the reasons we are adding a flag for this feature. We don't think that it will be something everyone uses. The use case you mention sounds like a situation where you might not want to keep track of schema like this. |
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@@ -114,7 +114,7 @@ func StartServer(connParams, connAppDebugParams mysql.ConnParams, dbName string) | |||
config.HotRowProtection.Mode = tabletenv.Enable | |||
config.TrackSchemaVersions = true | |||
config.GracePeriods.ShutdownSeconds = 2 | |||
config.SchemaReloadIntervalSeconds = tabletenv.Seconds(3) | |||
config.SchemaReloadIntervalSeconds = tabletenv.Seconds(2.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious why 2.1
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 seconds check related to no schema change was added by @vmg to avoid query cache test to fail. To make the test faster made it to 2.1
, i wanted to make it 2.0000001
but that would be too ambitious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think 2.1
might also be too ambitious. Might introduce flakyness?
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Detect schema changes on the tablet.
With this PR, a vttablet that finds itself as a
master
, will periodically check if schema has changed on the underlying mysqld. If any schema changes are found, the changed table names will be sent to any listening vtgates using the pre existing health check mechanism.If this feature is enabled, a database will be created on the underlying MySQL instance named
_vt
, where meta-information about the schema will be stored.Related to #7994