Merge branch 'master' into test-datetime-timestamp
This commit is contained in:
commit
f5d5cc8d8c
@ -49,12 +49,12 @@ It's your job to:
|
||||
|
||||
Simple:
|
||||
```shell
|
||||
$ gh-osc --host=myhost.com --conf=/etc/gh-ost.cnf --database=test --table=sample_table --alter="engine=innodb" --chunk-size=2000 --max-load=Threads_connected=20 --initially-drop-ghost-table --initially-drop-old-table --test-on-replica --verbose --execute
|
||||
$ gh-ost --host=myhost.com --conf=/etc/gh-ost.cnf --database=test --table=sample_table --alter="engine=innodb" --chunk-size=2000 --max-load=Threads_connected=20 --initially-drop-ghost-table --initially-drop-old-table --test-on-replica --verbose --execute
|
||||
```
|
||||
|
||||
Elaborate:
|
||||
```shell
|
||||
$ gh-osc --host=myhost.com --conf=/etc/gh-ost.cnf --database=test --table=sample_table --alter="engine=innodb" --chunk-size=2000 --max-load=Threads_connected=20 --switch-to-rbr --initially-drop-ghost-table --initially-drop-old-table --test-on-replica --postpone-cut-over-flag-file=/tmp/ghost-postpone.flag --exact-rowcount --concurrent-rowcount --allow-nullable-unique-key --verbose --execute
|
||||
$ gh-ost --host=myhost.com --conf=/etc/gh-ost.cnf --database=test --table=sample_table --alter="engine=innodb" --chunk-size=2000 --max-load=Threads_connected=20 --switch-to-rbr --initially-drop-ghost-table --initially-drop-old-table --test-on-replica --postpone-cut-over-flag-file=/tmp/ghost-postpone.flag --exact-rowcount --concurrent-rowcount --allow-nullable-unique-key --verbose --execute
|
||||
```
|
||||
- Count exact number of rows (makes ETA estimation very good). This goes at the expense of paying the time for issuing a `SELECT COUNT(*)` on your table. We use this lovingly.
|
||||
- Automatically switch to `RBR` if replica is configured as `SBR`. See also: [migrating with SBR](migrating-with-sbr.md)
|
||||
|
@ -344,7 +344,7 @@ func BuildDMLInsertQuery(databaseName, tableName string, tableColumns, sharedCol
|
||||
databaseName = EscapeName(databaseName)
|
||||
tableName = EscapeName(tableName)
|
||||
|
||||
for _, column := range mappedSharedColumns.Columns() {
|
||||
for _, column := range sharedColumns.Columns() {
|
||||
tableOrdinal := tableColumns.Ordinals[column.Name]
|
||||
arg := column.convertArg(args[tableOrdinal])
|
||||
sharedArgs = append(sharedArgs, arg)
|
||||
@ -392,10 +392,9 @@ func BuildDMLUpdateQuery(databaseName, tableName string, tableColumns, sharedCol
|
||||
databaseName = EscapeName(databaseName)
|
||||
tableName = EscapeName(tableName)
|
||||
|
||||
for i, column := range sharedColumns.Columns() {
|
||||
mappedColumn := mappedSharedColumns.Columns()[i]
|
||||
for _, column := range sharedColumns.Columns() {
|
||||
tableOrdinal := tableColumns.Ordinals[column.Name]
|
||||
arg := mappedColumn.convertArg(valueArgs[tableOrdinal])
|
||||
arg := column.convertArg(valueArgs[tableOrdinal])
|
||||
sharedArgs = append(sharedArgs, arg)
|
||||
}
|
||||
|
||||
|
28
localtests/alter-charset-all-dml/create.sql
Normal file
28
localtests/alter-charset-all-dml/create.sql
Normal file
@ -0,0 +1,28 @@
|
||||
drop table if exists gh_ost_test;
|
||||
create table gh_ost_test (
|
||||
id int auto_increment,
|
||||
t1 varchar(128) charset latin1 collate latin1_swedish_ci,
|
||||
t2 varchar(128) charset latin1 collate latin1_swedish_ci,
|
||||
tutf8 varchar(128) charset utf8,
|
||||
tutf8mb4 varchar(128) charset utf8mb4,
|
||||
random_value varchar(128) charset ascii,
|
||||
primary key(id)
|
||||
) auto_increment=1;
|
||||
|
||||
drop event if exists gh_ost_test;
|
||||
delimiter ;;
|
||||
create event gh_ost_test
|
||||
on schedule every 1 second
|
||||
starts current_timestamp
|
||||
ends current_timestamp + interval 60 second
|
||||
on completion not preserve
|
||||
enable
|
||||
do
|
||||
begin
|
||||
insert into gh_ost_test values (null, md5(rand()), md5(rand()), md5(rand()), md5(rand()), md5(rand()));
|
||||
insert into gh_ost_test values (null, 'átesting', 'átesting', 'átesting', 'átesting', md5(rand()));
|
||||
insert into gh_ost_test values (null, 'átesting_del', 'átesting', 'átesting', 'átesting', md5(rand()));
|
||||
insert into gh_ost_test values (null, 'testátest', 'testátest', 'testátest', '🍻😀', md5(rand()));
|
||||
update gh_ost_test set t1='átesting2' where t1='átesting' order by id desc limit 1;
|
||||
delete from gh_ost_test where t1='átesting_del' order by id desc limit 1;
|
||||
end ;;
|
1
localtests/alter-charset-all-dml/extra_args
Normal file
1
localtests/alter-charset-all-dml/extra_args
Normal file
@ -0,0 +1 @@
|
||||
--alter='MODIFY `t1` varchar(128) CHARACTER SET utf8mb4 NOT NULL, MODIFY `t2` varchar(128) CHARACTER SET latin2 NOT NULL, MODIFY `tutf8` varchar(128) CHARACTER SET latin1 NOT NULL'
|
24
localtests/alter-charset/create.sql
Normal file
24
localtests/alter-charset/create.sql
Normal file
@ -0,0 +1,24 @@
|
||||
drop table if exists gh_ost_test;
|
||||
create table gh_ost_test (
|
||||
id int auto_increment,
|
||||
t1 varchar(128) charset latin1 collate latin1_swedish_ci,
|
||||
t2 varchar(128) charset latin1 collate latin1_swedish_ci,
|
||||
tutf8 varchar(128) charset utf8,
|
||||
tutf8mb4 varchar(128) charset utf8mb4,
|
||||
primary key(id)
|
||||
) auto_increment=1;
|
||||
|
||||
drop event if exists gh_ost_test;
|
||||
delimiter ;;
|
||||
create event gh_ost_test
|
||||
on schedule every 1 second
|
||||
starts current_timestamp
|
||||
ends current_timestamp + interval 60 second
|
||||
on completion not preserve
|
||||
enable
|
||||
do
|
||||
begin
|
||||
insert into gh_ost_test values (null, md5(rand()), md5(rand()), md5(rand()), md5(rand()));
|
||||
insert into gh_ost_test values (null, 'átesting', 'átesting', 'átesting', 'átesting');
|
||||
insert into gh_ost_test values (null, 'testátest', 'testátest', 'testátest', '🍻😀');
|
||||
end ;;
|
1
localtests/alter-charset/extra_args
Normal file
1
localtests/alter-charset/extra_args
Normal file
@ -0,0 +1 @@
|
||||
--alter='MODIFY `t1` varchar(128) CHARACTER SET utf8mb4 NOT NULL, MODIFY `t2` varchar(128) CHARACTER SET latin2 NOT NULL, MODIFY `tutf8` varchar(128) CHARACTER SET latin1 NOT NULL'
|
22
localtests/rename-inserts-only/create.sql
Normal file
22
localtests/rename-inserts-only/create.sql
Normal file
@ -0,0 +1,22 @@
|
||||
drop table if exists gh_ost_test;
|
||||
create table gh_ost_test (
|
||||
id int auto_increment,
|
||||
c1 int not null,
|
||||
c2 int not null,
|
||||
primary key (id)
|
||||
) auto_increment=1;
|
||||
|
||||
drop event if exists gh_ost_test;
|
||||
delimiter ;;
|
||||
create event gh_ost_test
|
||||
on schedule every 1 second
|
||||
starts current_timestamp
|
||||
ends current_timestamp + interval 60 second
|
||||
on completion not preserve
|
||||
enable
|
||||
do
|
||||
begin
|
||||
insert into gh_ost_test values (null, 11, 23);
|
||||
insert into gh_ost_test values (null, 13, 23);
|
||||
insert into gh_ost_test values (null, floor(rand()*pow(2,32)), floor(rand()*pow(2,32)));
|
||||
end ;;
|
1
localtests/rename-inserts-only/extra_args
Normal file
1
localtests/rename-inserts-only/extra_args
Normal file
@ -0,0 +1 @@
|
||||
--alter="change column c2 c3 int not null" --approve-renamed-columns
|
24
localtests/unsigned-rename/create.sql
Normal file
24
localtests/unsigned-rename/create.sql
Normal file
@ -0,0 +1,24 @@
|
||||
drop table if exists gh_ost_test;
|
||||
create table gh_ost_test (
|
||||
id int auto_increment,
|
||||
i int not null,
|
||||
bi bigint not null,
|
||||
iu int unsigned not null,
|
||||
biu bigint unsigned not null,
|
||||
primary key(id)
|
||||
) auto_increment=1;
|
||||
|
||||
drop event if exists gh_ost_test;
|
||||
delimiter ;;
|
||||
create event gh_ost_test
|
||||
on schedule every 1 second
|
||||
starts current_timestamp
|
||||
ends current_timestamp + interval 60 second
|
||||
on completion not preserve
|
||||
enable
|
||||
do
|
||||
begin
|
||||
insert into gh_ost_test values (null, -2147483647, -9223372036854775807, 4294967295, 18446744073709551615);
|
||||
set @last_insert_id := cast(last_insert_id() as signed);
|
||||
update gh_ost_test set i=-2147483647+@last_insert_id, bi=-9223372036854775807+@last_insert_id, iu=4294967295-@last_insert_id, biu=18446744073709551615-@last_insert_id where id < @last_insert_id order by id desc limit 1;
|
||||
end ;;
|
1
localtests/unsigned-rename/extra_args
Normal file
1
localtests/unsigned-rename/extra_args
Normal file
@ -0,0 +1 @@
|
||||
--alter="change column iu iu_renamed int unsigned not null" --approve-renamed-columns
|
1
localtests/unsigned-rename/ghost_columns
Normal file
1
localtests/unsigned-rename/ghost_columns
Normal file
@ -0,0 +1 @@
|
||||
id, i, bi, iu_renamed, biu
|
1
localtests/unsigned-rename/orig_columns
Normal file
1
localtests/unsigned-rename/orig_columns
Normal file
@ -0,0 +1 @@
|
||||
id, i, bi, iu, biu
|
24
localtests/unsigned-reorder/create.sql
Normal file
24
localtests/unsigned-reorder/create.sql
Normal file
@ -0,0 +1,24 @@
|
||||
drop table if exists gh_ost_test;
|
||||
create table gh_ost_test (
|
||||
id int auto_increment,
|
||||
i int not null,
|
||||
bi bigint not null,
|
||||
iu int unsigned not null,
|
||||
biu bigint unsigned not null,
|
||||
primary key(id)
|
||||
) auto_increment=1;
|
||||
|
||||
drop event if exists gh_ost_test;
|
||||
delimiter ;;
|
||||
create event gh_ost_test
|
||||
on schedule every 1 second
|
||||
starts current_timestamp
|
||||
ends current_timestamp + interval 60 second
|
||||
on completion not preserve
|
||||
enable
|
||||
do
|
||||
begin
|
||||
insert into gh_ost_test values (null, -2147483647, -9223372036854775807, 4294967295, 18446744073709551615);
|
||||
set @last_insert_id := cast(last_insert_id() as signed);
|
||||
update gh_ost_test set i=-2147483647+@last_insert_id, bi=-9223372036854775807+@last_insert_id, iu=4294967295-@last_insert_id, biu=18446744073709551615-@last_insert_id where id < @last_insert_id order by id desc limit 1;
|
||||
end ;;
|
1
localtests/unsigned-reorder/extra_args
Normal file
1
localtests/unsigned-reorder/extra_args
Normal file
@ -0,0 +1 @@
|
||||
--alter="change column iu iu int unsigned not null after id" --approve-renamed-columns
|
1
localtests/unsigned-reorder/ghost_columns
Normal file
1
localtests/unsigned-reorder/ghost_columns
Normal file
@ -0,0 +1 @@
|
||||
id, i, bi, iu, biu
|
1
localtests/unsigned-reorder/orig_columns
Normal file
1
localtests/unsigned-reorder/orig_columns
Normal file
@ -0,0 +1 @@
|
||||
id, i, bi, iu, biu
|
Loading…
Reference in New Issue
Block a user