-
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
VReplication: ignore generated columns in workflows #8129
Conversation
342dc21
to
f4b0dc2
Compare
…oMap as a precursor to adding Extra info for detecting generated columns Signed-off-by: Rohit Nayak <[email protected]>
…sts to test generated columns in source as well as target for reshard and materialize Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]> Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
d5862b9
to
d0714c7
Compare
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.
initial comments, not thorough review.
go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go
Outdated
Show resolved
Hide resolved
go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go
Outdated
Show resolved
Hide resolved
DataType string | ||
ColumnType string | ||
IsPK bool | ||
IsGenerated bool |
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.
this becomes very parallel to
vitess/go/vt/vttablet/onlineddl/vrepl/types.go
Lines 35 to 58 in 50365bb
const ( | |
UnknownColumnType ColumnType = iota | |
TimestampColumnType | |
DateTimeColumnType | |
EnumColumnType | |
MediumIntColumnType | |
JSONColumnType | |
FloatColumnType | |
BinaryColumnType | |
) | |
// Column represents a table column | |
type Column struct { | |
Name string | |
IsUnsigned bool | |
Charset string | |
Type ColumnType | |
EnumValues string | |
EnumToTextConversion bool | |
// add Octet length for binary type, fix bytes with suffix "00" get clipped in mysql binlog. | |
// https://github.com/github/gh-ost/issues/909 | |
BinaryOctetLength uint64 | |
} |
Signed-off-by: Rohit Nayak <[email protected]>
mysqld mysqlctl.MysqlDaemon | ||
pkInfoMap map[string][]*PrimaryKeyInfo | ||
mysqld mysqlctl.MysqlDaemon | ||
colInfoMap map[string][]*ColumnInfo |
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.
map[string][]*ColumnInfo
confuses me. Is the key a table-name? Let's consider making a new type
to simplify the syntax.
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 sometimes use type aliases for this.
type tableNameStr = string
colInfoMap := map[tableNameStr][]*ColumnInfo{}
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.
This is a great pattern. There are quite a few places where such maps are used it this will increase code clarity. I will fix it up when I touch this module next since likely it will affect quite a few lines of code and also tests might need to be updated.
Description
Currently generated columns are not supported during a resharding workflow. MySQL does not allow values to be provided for generated columns either for insert or update. Today, generated columns are treated as regular columns and hence they attempt to populate such columns.
This PR identifies these columns by looking at the
Extra
column ininformation_schema.columns
and drops them from insert/update statements on the target.Note: We continue to send these columns as part of the vstreamer events so the downstream consumers will see the actual values. We need to do this since vstreams might be consumed by CDC pipelines which should be expected to recompute the generated column data.
Checklist