From 276672c31017e02ca0e35561ccfc7e50c3701307 Mon Sep 17 00:00:00 2001 From: Ivan Paljak Date: Mon, 21 Jan 2019 11:10:32 +0100 Subject: [PATCH] Fix flaky ha feature benchmark Reviewers: msantl Reviewed By: msantl Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1820 --- tests/feature_benchmark/apollo_runs.yaml | 20 ++++++++++---------- tests/feature_benchmark/ha/raft.json | 6 +++--- tests/feature_benchmark/ha/runner.sh | 13 ++++++++++++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/tests/feature_benchmark/apollo_runs.yaml b/tests/feature_benchmark/apollo_runs.yaml index 38bbe02b6..6ae74482e 100644 --- a/tests/feature_benchmark/apollo_runs.yaml +++ b/tests/feature_benchmark/apollo_runs.yaml @@ -9,13 +9,13 @@ - ../../../build_release/tests/feature_benchmark/kafka/benchmark # benchmark binary enable_network: true - #- name: feature_benchmark__ha - # cd: ha - # commands: ./runner.sh - # infiles: - # - runner.sh # runner script - # - raft.json # raft configuration file - # - coordination.json # coordination configuration file - # - ../../../build_release/tests/feature_benchmark/ha/benchmark # benchmark binary - # - ../../../build_release/memgraph_ha # memgraph binary - # enable_network: true +- name: feature_benchmark__ha + cd: ha + commands: ./runner.sh + infiles: + - runner.sh # runner script + - raft.json # raft configuration file + - coordination.json # coordination configuration file + - ../../../build_release/tests/feature_benchmark/ha/benchmark # benchmark binary + - ../../../build_release/memgraph_ha # memgraph binary + enable_network: true diff --git a/tests/feature_benchmark/ha/raft.json b/tests/feature_benchmark/ha/raft.json index 464ee435b..840a9a815 100644 --- a/tests/feature_benchmark/ha/raft.json +++ b/tests/feature_benchmark/ha/raft.json @@ -1,6 +1,6 @@ { - "election_timeout_min": 100, - "election_timeout_max": 300, - "heartbeat_interval": 50, + "election_timeout_min": 350, + "election_timeout_max": 700, + "heartbeat_interval": 100, "replicate_timeout": 100 } diff --git a/tests/feature_benchmark/ha/runner.sh b/tests/feature_benchmark/ha/runner.sh index 1fe652edd..2e5eb0182 100755 --- a/tests/feature_benchmark/ha/runner.sh +++ b/tests/feature_benchmark/ha/runner.sh @@ -1,5 +1,15 @@ #!/bin/bash +## Helper functions + +function wait_for_server { + port=$1 + while ! nc -z -w 1 127.0.0.1 $port; do + sleep 0.1 + done + sleep 1 +} + function echo_info { printf "\033[1;36m~~ $1 ~~\033[0m\n"; } function echo_success { printf "\033[1;32m~~ $1 ~~\033[0m\n\n"; } function echo_failure { printf "\033[1;31m~~ $1 ~~\033[0m\n\n"; } @@ -33,10 +43,11 @@ do --port $((7686 + $server_id)) \ --durability_directory=dur$server_id & HA_PIDS[$server_id]=$! + wait_for_server $((7686 + $server_id)) done # Allow some time for leader election. -sleep 3 +sleep 10 # Start the memgraph process and wait for it to start. echo_info "Starting HA benchmark"