Skip to content

Commit

Permalink
Vitess online ddl: modifyint column from textual to non-textual, igno…
Browse files Browse the repository at this point in the history
…re character set conversion on target (#10116)

Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Apr 20, 2022
1 parent 19bceba commit 2e272fe
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
modify column t int not null default '0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
drop table if exists onlineddl_test;
create table onlineddl_test (
id int auto_increment,
t varchar(128) charset utf8 collate utf8_general_ci,
primary key(id)
) auto_increment=1;

drop event if exists onlineddl_test;
delimiter ;;
create event onlineddl_test
on schedule every 1 second
starts current_timestamp
ends current_timestamp + interval 60 second
on completion not preserve
enable
do
begin
insert into onlineddl_test values (null, 11);
insert into onlineddl_test values (null, '13');
insert into onlineddl_test values (null, '17');
end ;;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
modify column t int not null default '0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
drop table if exists onlineddl_test;
create table onlineddl_test (
id int auto_increment,
t varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
primary key(id)
) auto_increment=1;

drop event if exists onlineddl_test;
delimiter ;;
create event onlineddl_test
on schedule every 1 second
starts current_timestamp
ends current_timestamp + interval 60 second
on completion not preserve
enable
do
begin
insert into onlineddl_test values (null, 11);
insert into onlineddl_test values (null, '13');
insert into onlineddl_test values (null, '17');
end ;;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(5.5|5.6)
3 changes: 2 additions & 1 deletion go/vt/vttablet/onlineddl/vrepl.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ func (v *VRepl) generateFilterQuery(ctx context.Context) error {
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "Character set %s not supported for column %s", sourceCol.Charset, sourceCol.Name)
}
toEncoding, ok := mysql.CharacterSetEncoding[targetCol.Charset]
if !ok {
// Let's see if target col is at all textual
if targetCol.Type == vrepl.StringColumnType && !ok {
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "Character set %s not supported for column %s", targetCol.Charset, targetCol.Name)
}
if fromEncoding == nil && toEncoding == nil {
Expand Down

0 comments on commit 2e272fe

Please sign in to comment.