Merge pull request #651 from github/test-throttle-file

localtests support throttle flag file
This commit is contained in:
Shlomi Noach 2018-10-16 11:42:37 +03:00 committed by GitHub
commit 0c37a6daee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,5 @@
set session time_zone='+00:00';
drop table if exists gh_ost_test; drop table if exists gh_ost_test;
create table gh_ost_test ( create table gh_ost_test (
id int auto_increment, id int auto_increment,
@ -7,6 +9,7 @@ create table gh_ost_test (
primary key(id) primary key(id)
) auto_increment=1; ) auto_increment=1;
set session time_zone='+00:00';
insert into gh_ost_test values (1, '0000-00-00 00:00:00', now(), 0); insert into gh_ost_test values (1, '0000-00-00 00:00:00', now(), 0);
drop event if exists gh_ost_test; drop event if exists gh_ost_test;
@ -19,5 +22,6 @@ create event gh_ost_test
enable enable
do do
begin begin
set session time_zone='+00:00';
update gh_ost_test set counter = counter + 1 where id = 1; update gh_ost_test set counter = counter + 1 where id = 1;
end ;; end ;;

View File

@ -14,11 +14,13 @@ ghost_binary=""
exec_command_file=/tmp/gh-ost-test.bash exec_command_file=/tmp/gh-ost-test.bash
orig_content_output_file=/tmp/gh-ost-test.orig.content.csv orig_content_output_file=/tmp/gh-ost-test.orig.content.csv
ghost_content_output_file=/tmp/gh-ost-test.ghost.content.csv ghost_content_output_file=/tmp/gh-ost-test.ghost.content.csv
throttle_flag_file=/tmp/gh-ost-test.ghost.throttle.flag
master_host= master_host=
master_port= master_port=
replica_host= replica_host=
replica_port= replica_port=
original_sql_mode=
OPTIND=1 OPTIND=1
while getopts "b:" OPTION while getopts "b:" OPTION
@ -45,6 +47,8 @@ verify_master_and_replica() {
echo "Cannot enable event_scheduler on master" echo "Cannot enable event_scheduler on master"
exit 1 exit 1
fi fi
original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)"
echo "sql_mode on master is ${original_sql_mode}"
if [ "$(gh-ost-test-mysql-replica -e "select 1" -ss)" != "1" ] ; then if [ "$(gh-ost-test-mysql-replica -e "select 1" -ss)" != "1" ] ; then
echo "Cannot verify gh-ost-test-mysql-replica" echo "Cannot verify gh-ost-test-mysql-replica"
@ -87,7 +91,6 @@ start_replication() {
test_single() { test_single() {
local test_name local test_name
test_name="$1" test_name="$1"
original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)"
if [ -f $tests_path/$test_name/ignore_versions ] ; then if [ -f $tests_path/$test_name/ignore_versions ] ; then
ignore_versions=$(cat $tests_path/$test_name/ignore_versions) ignore_versions=$(cat $tests_path/$test_name/ignore_versions)
@ -145,6 +148,7 @@ test_single() {
--initially-drop-old-table \ --initially-drop-old-table \
--initially-drop-ghost-table \ --initially-drop-ghost-table \
--throttle-query='select timestampdiff(second, min(last_update), now()) < 5 from _gh_ost_test_ghc' \ --throttle-query='select timestampdiff(second, min(last_update), now()) < 5 from _gh_ost_test_ghc' \
--throttle-flag-file=$throttle_flag_file \
--serve-socket-file=/tmp/gh-ost.test.sock \ --serve-socket-file=/tmp/gh-ost.test.sock \
--initially-drop-socket-file \ --initially-drop-socket-file \
--test-on-replica \ --test-on-replica \