Hello community, here is the log from the commit of package booth for openSUSE:Factory checked in at 2014-08-15 09:55:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/booth (Old) and /work/SRC/openSUSE:Factory/.booth.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "booth" Changes: -------- --- /work/SRC/openSUSE:Factory/booth/booth.changes 2014-08-05 21:11:22.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.booth.new/booth.changes 2014-08-15 09:56:16.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Aug 14 15:59:48 UTC 2014 - dmuhamedagic@suse.com + +- ticket: drop expired tickets in elections too (gh#17) +- upstream version: 5c48dbb + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ booth.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/.git_info new/booth/.git_info --- old/booth/.git_info 2014-08-04 16:30:42.000000000 +0200 +++ new/booth/.git_info 2014-08-14 17:59:35.000000000 +0200 @@ -1 +1 @@ -v0.1.7-299-g58a2b61 +v0.1.7-315-g5c48dbb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/inline-fn.h new/booth/src/inline-fn.h --- old/booth/src/inline-fn.h 2014-08-04 15:56:20.000000000 +0200 +++ new/booth/src/inline-fn.h 2014-08-14 12:30:55.000000000 +0200 @@ -37,7 +37,7 @@ inline static uint32_t get_node_id(struct booth_site *node) { - return node ? node->site_id : NO_ONE; + return node ? node->site_id : 0; } @@ -118,7 +118,8 @@ memcpy(msg->ticket.id, tk->name, sizeof(msg->ticket.id)); msg->ticket.leader = htonl(get_node_id( - (tk->leader && tk->leader != no_leader) ? tk->leader : tk->voted_for)); + (tk->leader && tk->leader != no_leader) ? tk->leader : + (tk->voted_for ? tk->voted_for : no_leader))); msg->ticket.term = htonl(tk->current_term); msg->ticket.term_valid_for = htonl(term_time_left(tk)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/main.c new/booth/src/main.c --- old/booth/src/main.c 2014-08-04 15:56:20.000000000 +0200 +++ new/booth/src/main.c 2014-08-14 12:30:55.000000000 +0200 @@ -667,7 +667,11 @@ } if (site->type == ARBITRATOR) { - log_error("Site \"%s\" is an arbitrator, cannot grant/revoke ticket there.", cl.site); + if (site == local) { + log_error("We're just an arbitrator, cannot grant/revoke tickets here."); + } else { + log_error("%s is just an arbitrator, cannot grant/revoke tickets there.", cl.site); + } goto out_close; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/raft.c new/booth/src/raft.c --- old/booth/src/raft.c 2014-08-04 15:56:20.000000000 +0200 +++ new/booth/src/raft.c 2014-08-14 12:30:55.000000000 +0200 @@ -660,10 +660,11 @@ /* valid tickets are not allowed only if the sender thinks * the ticket got lost */ - if (sender != tk->leader && valid && reason == OR_TKT_LOST) { - tk_log_warn("election from %s rejected " + if (sender != tk->leader && valid && reason != OR_STEPDOWN) { + tk_log_warn("election from %s with reason %s rejected " "(we have %s as ticket owner), ticket still valid for %ds", - site_string(sender), site_string(tk->leader), valid); + site_string(sender), state_to_string(reason), + site_string(tk->leader), valid); return send_reject(sender, tk, RLT_TERM_STILL_VALID, msg); } @@ -730,7 +731,6 @@ tk->current_term++; } - tk->term_expires = 0; tk->election_end = now + tk->timeout; tk->in_election = 1; @@ -745,7 +745,6 @@ record_vote(tk, local, new_leader); tk->voted_for = new_leader; - tk->leader = no_leader; tk->state = ST_CANDIDATE; /* some callers may want just to repeat on timeout */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/ticket.c new/booth/src/ticket.c --- old/booth/src/ticket.c 2014-08-04 15:56:20.000000000 +0200 +++ new/booth/src/ticket.c 2014-08-14 12:30:55.000000000 +0200 @@ -282,7 +282,7 @@ strftime(timeout_str, sizeof(timeout_str), "%F %T", localtime(&ts)); } else - strcpy(timeout_str, "N/A"); + strcpy(timeout_str, "INF"); if (tk->leader == local && tk->delay_commit > get_secs(NULL)) { ts = wall_ts(tk->delay_commit); @@ -818,9 +818,8 @@ /* Has an owner, has an expiry date, and expiry date in the past? * Losing the ticket must happen in _every_ state. */ now = get_secs(NULL); - if (!tk->in_election && + if (is_owned(tk) && tk->term_expires && - is_owned(tk) && now >= tk->term_expires) { ticket_lost(tk); goto out; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/test/live_test.sh new/booth/test/live_test.sh --- old/booth/test/live_test.sh 2014-08-04 15:56:20.000000000 +0200 +++ new/booth/test/live_test.sh 2014-08-14 12:30:55.000000000 +0200 @@ -41,9 +41,12 @@ [ $# -eq 0 ] && usage 0 cnf=$1 +run_cnf="/etc/booth/booth.conf" + shift 1 ERR_SETUP_FAILED=52 logf=test_booth.log +SSH_OPTS="-o StrictHostKeyChecking=no" iprules=/usr/share/booth/tests/test/booth_path : ${HA_LOGFACILITY:="syslog"} @@ -53,10 +56,10 @@ } logmsg() { - if [ "$WE_SERVER" ]; then + if [ "$WE_SERVER" -o "$_JUST_NETEM" ]; then logger -t "BOOTHTEST" -p $HA_LOGFACILITY.info -- $@ else - ssh `get_site 1` logger -t "BOOTHTEST" -p $HA_LOGFACILITY.info -- $@ + ssh $SSH_OPTS `get_site 1` logger -t "BOOTHTEST" -p $HA_LOGFACILITY.info -- $@ fi } @@ -71,14 +74,30 @@ } # tc netem, simulate packet loss, wan, etc +netem_parent() { + local p + p=`tc qdisc show dev $1 | grep netem | head -1 | awk '{print $3}'` + if [ -n "$p" ]; then + echo $p + else + echo 1:1 + fi +} +tc_prio() { + ext_prog_log tc qdisc add dev $1 handle 1: root prio + ext_prog_log tc filter add dev $1 parent 1: prio 1 u32 \ + match ip dport $port 0xffff \ + match ip protocol 17 0xff \ + flowid 1:1 +} netem_delay() { - ext_prog_log tc qdisc add dev $1 root netem delay $2ms $(($2/10))ms + ext_prog_log tc qdisc add dev $1 parent `netem_parent $1` netem delay $2ms $(($2/10))ms } netem_loss() { - ext_prog_log tc qdisc add dev $1 root netem loss $2% + ext_prog_log tc qdisc add dev $1 parent `netem_parent $1` netem loss $2% } netem_reset() { - ext_prog_log tc qdisc del dev $1 root netem + ext_prog_log tc qdisc del dev $1 root } local_netem_env() { local fun=$1 arg=$2 @@ -97,18 +116,15 @@ fi done if [ -n "$netif" ]; then + # before first netem qdisc insert the prio qdisc and filter + tc qdisc show dev $netif | grep -qs netem || + tc_prio $netif $fun $netif $arg else logmsg "cannot find netif for $my_addr, netem not set" fi } -if [ "$1" = "__netem__" ]; then - shift 1 - local_netem_env $@ - exit -fi - is_function() { test z"`command -v $1`" = z"$1" } @@ -119,7 +135,7 @@ if ip a l | fgrep -wq $h; then $@ else - ssh $h $@ + ssh $SSH_OPTS $h $@ fi rc=$? if [ $rc -ne 0 ]; then @@ -206,7 +222,7 @@ sync_conf() { local h rc=0 for h in $sites $arbitrators; do - rsync -q $cnf $h:/etc/booth/booth.conf + rsync -q $cnf $h:$run_cnf rc=$((rc|$?)) done return $rc @@ -246,7 +262,7 @@ f=$1 shift 1 for h in $sites $arbitrators; do - $f $@ | ssh $h + $f $@ | ssh $SSH_OPTS $h rc=$((rc|$?)) [ $rc -ne 0 ] && break done @@ -311,14 +327,13 @@ wait_timeout() { local t=2 [ "$T_timeout" -gt $t ] && t=$T_timeout - [ "$PKT_LOSS" ] && t=$((t + 2*T_timeout + PKT_LOSS/6)) sleep $t } set_netem_env() { local modfun args modfun=`echo $1 | sed 's/:.*//'` - args=`echo $1 | sed 's/[^:]*://;s/:/ /g'` + args=`echo $1 | sed 's/[^:]*//;s/:/ /g'` if ! is_function NETEM_ENV_$modfun; then echo "NETEM_ENV_$modfun: doesn't exist" exit 1 @@ -327,10 +342,13 @@ } reset_netem_env() { [ -z "$NETEM_ENV" ] && return - forall $0 $cnf __netem__ netem_reset + [ -n "$__NETEM_RESET" ] && return + __NETEM_RESET=1 + forall $0 $run_cnf __netem__ netem_reset } setup_netem() { [ -z "$NETEM_ENV" ] && return + __NETEM_RESET= for env in $NETEM_ENV; do set_netem_env $env done @@ -409,7 +427,7 @@ grantee=`echo "$ticket_line" | sed 's/.*leader: //;s/,.*//'` echo $grantee [ "$grantee" = "none" ] && return - ! runcmd $grantee booth list | grep -q "$tkt.*pending" + ! echo "$ticket_line" | grep -q "$tkt.*pending" } booth_list_fld() { cut -d, -f $1 | sed 's/[^:]*://' @@ -508,6 +526,8 @@ rc=$? case $rc in 0) + # wait a bit more if we're losing packets + [ -n "$PKT_LOSS" ] && wait_timeout check_$1 rc=$? if [ $rc -eq 0 ]; then @@ -525,9 +545,9 @@ esac end_time=`date` end_ts=`date +%s` - reset_netem_env echo "finished booth test $1 ($usrmsg)" | logmsg is_function recover_$1 && recover_$1 + reset_netem_env sleep 3 all_booth_status booth_status=$? @@ -543,42 +563,6 @@ revoke_ticket } -[ -f "$cnf" ] || { - ls $cnf - usage 1 -} - -sites=`get_servers site < $cnf` -arbitrators=`get_servers arbitrator < $cnf` -port=`get_port < $cnf` -: ${port:=9929} -site_cnt=`echo $sites | wc -w` -arbitrator_cnt=`echo $arbitrators | wc -w` -tkt=`get_tkt < $cnf` -eval `get_tkt_settings` - -[ -z "$sites" ] && { - echo no sites in $cnf - usage 1 -} - -[ -z "$T_expire" ] && { - echo set $tkt expire time in $cnf - usage 1 -} - -if [ -z "$T_renewal_freq" ]; then - T_renewal_freq=$((T_expire/2)) -fi - -exec 2>$logf -BASH_XTRACEFD=2 -PS4='+ `date +"%T"`: ' -set -x - -WE_SERVER="" -is_we_server && WE_SERVER=1 - # # the tests # @@ -806,6 +790,7 @@ run_site 1 $iprules stop $port >/dev/null wait_exp wait_timeout + wait_timeout check_cib any || return 1 run_site 1 $iprules start $port >/dev/null wait_timeout @@ -876,21 +861,64 @@ # packet loss at one site 30% NETEM_ENV_single_loss() { - run_site 1 $0 $cnf __netem__ netem_loss ${1:-30} + run_site 1 $0 $run_cnf __netem__ netem_loss ${1:-30} PKT_LOSS=${1:-30} } # packet loss everywhere 30% NETEM_ENV_loss() { - forall $0 $cnf __netem__ netem_loss ${1:-30} + forall $0 $run_cnf __netem__ netem_loss ${1:-30} PKT_LOSS=${1:-30} } # network delay 100ms NETEM_ENV_net_delay() { - forall $0 $cnf __netem__ netem_delay ${1:-100} + forall $0 $run_cnf __netem__ netem_delay ${1:-100} +} + +[ -f "$cnf" ] || { + echo "ERROR: configuration file $cnf doesn't exist" + usage 1 } +sites=`get_servers site < $cnf` +arbitrators=`get_servers arbitrator < $cnf` +port=`get_port < $cnf` +: ${port:=9929} +site_cnt=`echo $sites | wc -w` +arbitrator_cnt=`echo $arbitrators | wc -w` +tkt=`get_tkt < $cnf` +eval `get_tkt_settings` + +if [ "$1" = "__netem__" ]; then + shift 1 + _JUST_NETEM=1 + local_netem_env $@ + exit +fi + +[ -z "$sites" ] && { + echo no sites in $cnf + usage 1 +} + +[ -z "$T_expire" ] && { + echo set $tkt expire time in $cnf + usage 1 +} + +if [ -z "$T_renewal_freq" ]; then + T_renewal_freq=$((T_expire/2)) +fi + +exec 2>$logf +BASH_XTRACEFD=2 +PS4='+ `date +"%T"`: ' +set -x + +WE_SERVER="" +is_we_server && WE_SERVER=1 + PREFNAME=__pref_booth_live_test sync_conf || exit -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org