-
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
Use a left join to make sure that tables with tablespace=innodb_system are included in the schema #12672
Conversation
…m are not skipped when loading the schema (fixes vitessio#12669) Signed-off-by: Oleksiy Kovyrin <[email protected]>
cbc629e
to
6c3a7ee
Compare
Not sure how to (or if I should) write a test for this, but tested it locally as follows:
|
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.
Makes sense to me -- we want all tables, even if they don't have an associated dedicated tablespace (I would guess this is also an issue when using general tablespaces, as that's what the system_tablespace
is). Thank you for this, @kovyrin ! ❤️
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.
We could add a minimal test by e.g. creating the product table here in the system_tablespace
: https://github.com/vitessio/vitess/blob/main/go/test/endtoend/vreplication/config_test.go#L37
@kovyrin make sense? Please let me know if you need any help.
@harshit-gangal maybe you have a better idea though? Schema Tracker tests may be better, e.g. here: https://github.com/vitessio/vitess/blob/main/go/test/endtoend/vtgate/schematracker/sharded/schema.sql
@kovyrin with this patch:
diff --git a/go/test/endtoend/vreplication/vstream_test.go b/go/test/endtoend/vreplication/vstream_test.go
index 1098632d87..2b3eaf4bbd 100644
--- a/go/test/endtoend/vreplication/vstream_test.go
+++ b/go/test/endtoend/vreplication/vstream_test.go
@@ -190,7 +190,7 @@ const vschemaUnsharded = `
}
`
const schemaSharded = `
-create table customer(cid int, name varbinary(128), primary key(cid)) CHARSET=utf8mb4;
+create table customer(cid int, name varbinary(128), primary key(cid)) TABLESPACE innodb_system CHARSET=utf8mb4;
`
const vschemaSharded = `
{
This fails on main:
$ go test -timeout 10m -v -failfast -run TestVStreamStopOnReshardTrue vitess.io/vitess/go/test/endtoend/vreplication
So that could serve as the test for your PR.
Having a very hard time running any of the existing tests locally. It reliably fails to start mysql both in vreplication end to end tests and in vtgate/schematracker :-( One example:
Another one:
|
Signed-off-by: Oleksiy Kovyrin <[email protected]>
Modified the customer schema to use the system tablespace. This should cover the change on 8.0 (breaks on main). |
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.
how do we get size for those tables?
@harshit-gangal Good question! We'd need to do more (although I'd argue that recognizing the table w/o a known size is still an improvement over not being aware of it at all). This is one possibility:
This makes the query more complicated and heavier, so it's likely to be problematic for those with many thousands of tables. As a practical matter, it may be better to accept NULL or "unknown" size in these rare cases. If a non-integral result is the problem, we could use this instead:
|
…ce=innodb_system are included in the schema (#12672) (#12734) * Use a left join to make sure that tables with tablespace=innodb_system are not skipped when loading the schema (fixes #12669) Signed-off-by: Oleksiy Kovyrin <[email protected]> * Set tablespace on a test table to see if it breaks vstreamer Signed-off-by: Oleksiy Kovyrin <[email protected]> --------- Signed-off-by: Oleksiy Kovyrin <[email protected]> Co-authored-by: Oleksiy Kovyrin <[email protected]>
…ce=innodb_system are included in the schema (#12672) (#12735) * Use a left join to make sure that tables with tablespace=innodb_system are not skipped when loading the schema (fixes #12669) Signed-off-by: Oleksiy Kovyrin <[email protected]> * Set tablespace on a test table to see if it breaks vstreamer Signed-off-by: Oleksiy Kovyrin <[email protected]> --------- Signed-off-by: Oleksiy Kovyrin <[email protected]> Co-authored-by: Oleksiy Kovyrin <[email protected]>
Description
To make sure the behaviour of the schema engine is the same for 5.7 and 8.0 in terms of handling of tables that have innodb tablespace set to innodb_system (those are not included in
information_schema.innodb_tablespaces
). This should make sure that vstreamer works as expected when some of the tables in a keyspace have been created withtablespace innodb_system
option (because of https://bugs.mysql.com/bug.php?id=110383 or some other reason).This issue exists in 14.x and the fix needs backporting AFAIU.
Related Issue(s)
Fixes #12669
Checklist