forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FB8-87, FB8-119: Supporting dynamic scheduling in MTS (facebook#999) (f…
…acebook#999) Summary: Jira ticket: https://jira.percona.com/browse/FB8-87 Jira ticket: https://jira.percona.com/browse/FB8-119 Reference commit: facebook@5846968 Reference commit: facebook@d6217c9 Statically assigning shards to slave workers can cause imbalance if a few shards are hotter than others. We should be able to check the imbalance among slave workers and dynamically reassign shards. Pull Request resolved: facebook#999 Differential Revision: D14883857
- Loading branch information
Showing
26 changed files
with
496 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
include/rpl_restart_server.inc [server_number=2] | ||
[connection slave] | ||
set global mts_dynamic_rebalance=TRUE; | ||
set global replica_parallel_workers=2; | ||
set global debug="+d,skip_checkpoint_load_reset"; | ||
include/start_slave.inc | ||
select * from information_schema.slave_db_load; | ||
DB WORKER DB_LOAD | ||
[connection master] | ||
create table t1 (a int); | ||
insert into t1 values(1); | ||
insert into t1 values(1); | ||
insert into t1 values(1); | ||
insert into t1 values(1); | ||
insert into t1 values(1); | ||
include/sync_slave_sql_with_master.inc | ||
[connection slave] | ||
select * from information_schema.slave_db_load; | ||
DB WORKER DB_LOAD | ||
test 1 6 | ||
include/stop_slave.inc | ||
set global mts_dynamic_rebalance=0; | ||
set global debug="-d,skip_checkpoint_load_reset"; | ||
include/start_slave.inc | ||
[connection master] | ||
drop table t1; | ||
include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--replica_parallel_type='DATABASE' --replica_preserve_commit_order=OFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This test verifies the functionality of slave_db_load table. | ||
|
||
source include/have_debug.inc; | ||
source include/master-slave.inc; | ||
|
||
let rpl_server_number=2; | ||
source include/rpl_restart_server.inc; | ||
|
||
source include/rpl_connection_slave.inc; | ||
let $old_mts_dynamic_rebalance= `select @@global.mts_dynamic_rebalance`; | ||
let $old_replica_parallel_workers= `select @@global.replica_parallel_workers`; | ||
set global mts_dynamic_rebalance=TRUE; | ||
set global replica_parallel_workers=2; | ||
set global debug="+d,skip_checkpoint_load_reset"; | ||
source include/start_slave.inc; | ||
|
||
# Load should be empty | ||
select * from information_schema.slave_db_load; | ||
|
||
source include/rpl_connection_master.inc; | ||
create table t1 (a int); | ||
let $num_inserts=5; | ||
while ($num_inserts) | ||
{ | ||
insert into t1 values(1); | ||
dec $num_inserts; | ||
} | ||
|
||
source include/sync_slave_sql_with_master.inc; | ||
|
||
source include/rpl_connection_slave.inc; | ||
# Load of test should be 6 (1 create and 5 inserts) | ||
select * from information_schema.slave_db_load; | ||
|
||
# restore varaibles | ||
source include/stop_slave.inc; | ||
eval set global mts_dynamic_rebalance=$old_mts_dynamic_rebalance; | ||
--disable_query_log | ||
eval set global replica_parallel_workers=$old_replica_parallel_workers; | ||
--enable_query_log | ||
set global debug="-d,skip_checkpoint_load_reset"; | ||
source include/start_slave.inc; | ||
|
||
source include/rpl_connection_master.inc; | ||
drop table t1; | ||
|
||
source include/rpl_end.inc; |
21 changes: 21 additions & 0 deletions
21
mysql-test/suite/sys_vars/r/mts_dynamic_rebalance_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
set @save.mts_dynamic_rebalance= @@global.mts_dynamic_rebalance; | ||
select @@session.mts_dynamic_rebalance; | ||
ERROR HY000: Variable 'mts_dynamic_rebalance' is a GLOBAL variable | ||
select variable_name from performance_schema.global_variables where variable_name='$var'; | ||
variable_name | ||
select variable_name from performance_schema.session_variables where variable_name='$var'; | ||
variable_name | ||
set @@global.mts_dynamic_rebalance= false; | ||
select @@global.mts_dynamic_rebalance; | ||
@@global.mts_dynamic_rebalance | ||
0 | ||
set @@global.mts_dynamic_rebalance= 1.1; | ||
ERROR 42000: Incorrect argument type to variable 'mts_dynamic_rebalance' | ||
set @@global.mts_dynamic_rebalance= "foo"; | ||
ERROR 42000: Variable 'mts_dynamic_rebalance' can't be set to the value of 'foo' | ||
set @@global.mts_dynamic_rebalance= false; | ||
set @@global.mts_dynamic_rebalance= true; | ||
select @@global.mts_dynamic_rebalance as "truncated to the maximum"; | ||
truncated to the maximum | ||
1 | ||
set @@global.mts_dynamic_rebalance= @save.mts_dynamic_rebalance; |
23 changes: 23 additions & 0 deletions
23
mysql-test/suite/sys_vars/r/mts_imbalance_threshold_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set @save.mts_imbalance_threshold= @@global.mts_imbalance_threshold; | ||
select @@session.mts_imbalance_threshold; | ||
ERROR HY000: Variable 'mts_imbalance_threshold' is a GLOBAL variable | ||
select variable_name from performance_schema.global_variables where variable_name='$var'; | ||
variable_name | ||
select variable_name from performance_schema.session_variables where variable_name='$var'; | ||
variable_name | ||
set @@global.mts_imbalance_threshold= 0.0; | ||
select @@global.mts_imbalance_threshold; | ||
@@global.mts_imbalance_threshold | ||
0.000000 | ||
set @@global.mts_imbalance_threshold= test; | ||
ERROR 42000: Incorrect argument type to variable 'mts_imbalance_threshold' | ||
set @@global.mts_imbalance_threshold= "foo"; | ||
ERROR 42000: Incorrect argument type to variable 'mts_imbalance_threshold' | ||
set @@global.mts_imbalance_threshold= 0; | ||
set @@global.mts_imbalance_threshold= cast(-1 as unsigned int); | ||
Warnings: | ||
Warning 1292 Truncated incorrect mts_imbalance_threshold value: '1.8446744073709552e19' | ||
select @@global.mts_imbalance_threshold as "truncated to the maximum"; | ||
truncated to the maximum | ||
100.000000 | ||
set @@global.mts_imbalance_threshold= @save.mts_imbalance_threshold; |
Oops, something went wrong.