Hello community, here is the log from the commit of package booth for openSUSE:Factory checked in at 2014-07-26 09:42:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-07-22 06:57:52.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.booth.new/booth.changes 2014-07-26 09:42:24.000000000 +0200 @@ -1,0 +2,7 @@ +Fri Jul 25 11:23:27 UTC 2014 - dmuhameda...@suse.com + +- raft: be more permissive for elections for valid tickets +- build: fix doc dir for redhat based distros +- upstream version: 2ecb536 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ booth.spec ++++++ --- /var/tmp/diff_new_pack.ZRQTmK/_old 2014-07-26 09:42:25.000000000 +0200 +++ /var/tmp/diff_new_pack.ZRQTmK/_new 2014-07-26 09:42:25.000000000 +0200 @@ -16,6 +16,16 @@ # +%if 0%{?suse_version} +%global booth_docdir %{_defaultdocdir}/%{name} +%else +# newer fedora distros have _pkgdocdir, rely on that when +# available +%{!?_pkgdocdir: %global _pkgdocdir %%{_docdir}/%{name}-%{version}} +# Directory where we install documentation +%global booth_docdir %{_pkgdocdir} +%endif + Url: https://github.com/ClusterLabs/booth %if 0%{?suse_version} @@ -24,7 +34,7 @@ %define with_extra_warnings 0 %define with_debugging 0 %define without_fatal_warnings 1 -%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} +%if 0%{?fedora} || 0%{?centos} || 0%{?rhel} %define pkg_group System Environment/Daemons %else %define pkg_group Productivity/Clustering/HA @@ -41,40 +51,53 @@ Source: booth.tar.bz2 Source1: %name-rpmlintrc BuildRoot: %{_tmppath}/%{name}-%{version}-build -# 1.1.6-2 on SLES has latest ticket support -Requires: pacemaker-ticket-support >= 2.0 BuildRequires: asciidoc BuildRequires: autoconf BuildRequires: automake BuildRequires: glib2-devel +%if 0%{?fedora} || 0%{?centos} || 0%{?rhel} +BuildRequires: cluster-glue-libs-devel +BuildRequires: pacemaker-libs-devel +%else BuildRequires: libglue-devel BuildRequires: libpacemaker-devel +%endif BuildRequires: libxml2-devel BuildRequires: pkgconfig +%if 0%{?fedora} || 0%{?centos} || 0%{?rhel} +Requires: cluster-glue-libs >= 1.0.6 +Requires: pacemaker >= 1.1.8 +%else +Requires: pacemaker-ticket-support >= 2.0 +%endif %description -Booth manages the ticket which authorizes one of the cluster sites -located in geographical dispersed distances to run certain resources. -It is designed to be an add-on of Pacemaker, which extends Pacemaker to -support geographical dispersed clustering. +Booth manages the ticket which authorizes one of the cluster sites located in +geographically dispersed distances to run certain resources. It is designed to +be an add-on of Pacemaker, which extends Pacemaker to support geographically +dispersed clustering. Authors: -------- Jiaju Zhang <jjzh...@suse.de> + Philipp Marek <philipp.ma...@linbit.com> + Dejan Muhamedagic <de...@suse.de> %prep -%setup -n booth +%setup -q -n %{name} + %build ./autogen.sh %configure \ - --with-initddir=%{_initrddir} + --with-initddir=%{_initrddir} \ + --docdir=%{booth_docdir} make %install -make DESTDIR=$RPM_BUILD_ROOT install docdir=%{_defaultdocdir}/%{name} +make DESTDIR=$RPM_BUILD_ROOT install docdir=%{booth_docdir} mkdir -p %{buildroot}/%{_mandir}/man8/ gzip < docs/boothd.8 > %{buildroot}/%{_mandir}/man8/booth.8.gz @@ -111,7 +134,7 @@ fi %files -%defattr(-,root,root) +%defattr(-,root,root,-) %{_sbindir}/booth %{_sbindir}/boothd %{_mandir}/man8/booth.8.gz @@ -133,7 +156,7 @@ %package test Summary: Test scripts for Booth -Group: Productivity/Clustering/HA +Group: %{pkg_group} Requires: booth Requires: python ++++++ 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-07-17 16:32:16.000000000 +0200 +++ new/booth/.git_info 2014-07-25 13:23:19.000000000 +0200 @@ -1 +1 @@ -v0.1.7-285-g49c0f3d +v0.1.7-297-g2ecb536 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/booth.spec new/booth/booth.spec --- old/booth/booth.spec 2014-07-17 16:30:12.000000000 +0200 +++ new/booth/booth.spec 2014-07-25 12:57:28.000000000 +0200 @@ -1,3 +1,12 @@ +%if 0%{?suse_version} +%global booth_docdir %{_defaultdocdir}/%{name} +%else +# newer fedora distros have _pkgdocdir, rely on that when +# available +%{!?_pkgdocdir: %global _pkgdocdir %%{_docdir}/%{name}-%{version}} +# Directory where we install documentation +%global booth_docdir %{_pkgdocdir} +%endif %global test_path %{_datadir}/booth/tests @@ -54,7 +63,8 @@ %build ./autogen.sh %configure \ - --with-initddir=%{_initrddir} + --with-initddir=%{_initrddir} \ + --docdir=%{booth_docdir} make @@ -63,7 +73,7 @@ #make check %install -make DESTDIR=$RPM_BUILD_ROOT install docdir=%{_defaultdocdir}/%{name} +make DESTDIR=$RPM_BUILD_ROOT install docdir=%{booth_docdir} mkdir -p %{buildroot}/%{_mandir}/man8/ gzip < docs/boothd.8 > %{buildroot}/%{_mandir}/man8/booth.8.gz @@ -77,8 +87,8 @@ mkdir -p %{buildroot}/%{test_path} cp -a unit-tests/ script/unit-test.py test conf %{buildroot}/%{test_path}/ -chmod +x %{buildroot}/%{test_path}/booth_path -chmod +x %{buildroot}/%{test_path}/live_test.sh +chmod +x %{buildroot}/%{test_path}/test/booth_path +chmod +x %{buildroot}/%{test_path}/test/live_test.sh mkdir -p %{buildroot}/%{test_path}/src/ ln -s %{_sbindir}/boothd %{buildroot}/%{test_path}/src/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/config.h new/booth/src/config.h --- old/booth/src/config.h 2014-07-17 16:30:12.000000000 +0200 +++ new/booth/src/config.h 2014-07-25 12:57:28.000000000 +0200 @@ -145,7 +145,7 @@ /* bitmask of servers which sent acks */ uint64_t acks_received; - /* timestamp of the request, currently unused */ + /* timestamp of the request */ time_t req_sent_at; /* we need to wait for MY_INDEX from other servers, * hold the ticket processing for a while until they reply 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-07-17 16:30:12.000000000 +0200 +++ new/booth/src/inline-fn.h 2014-07-25 12:57:28.000000000 +0200 @@ -66,6 +66,11 @@ return (tk->leader && tk->leader != no_leader); } +inline static int is_resend(struct ticket_config *tk) +{ + return (get_secs(NULL) - tk->req_sent_at) >= tk->timeout; +} + static inline void init_header_bare(struct boothc_header *h) { assert(local && local->site_id); @@ -216,11 +221,17 @@ static inline time_t next_vote_starts_at(struct ticket_config *tk) { + time_t next_t; + /* If not owner, don't renew. */ if (tk->leader != local) return 0; - return tk->last_renewal + tk->renewal_freq; + next_t = tk->last_renewal + tk->renewal_freq; + if (tk->delay_commit && next_t > tk->delay_commit) + next_t = tk->delay_commit; + + return next_t; } @@ -243,7 +254,6 @@ tk->acks_expected = reply_type; tk->acks_received = local->bitmask; tk->req_sent_at = get_secs(NULL); - tk->ticket_updated = 0; } static inline void no_resends(struct ticket_config *tk) 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-07-17 16:30:12.000000000 +0200 +++ new/booth/src/raft.c 2014-07-25 12:57:28.000000000 +0200 @@ -143,7 +143,13 @@ tk->election_end = 0; tk->voted_for = NULL; + if (tk->delay_commit && all_sites_replied(tk)) { + tk->delay_commit = 0; + tk_log_debug("reset delay commit as all sites replied"); + } + ticket_broadcast(tk, OP_HEARTBEAT, OP_ACK, RLT_SUCCESS, 0); + tk->ticket_updated = 0; } @@ -352,8 +358,8 @@ tk_log_debug("leader %s wants to update our ticket", site_string(leader)); + become_follower(tk, msg); tk->leader = leader; - copy_ticket_from_msg(tk, msg); ticket_write(tk); /* run ticket_cron if the ticket expires */ @@ -407,6 +413,7 @@ ) { uint32_t term; + int req; term = ntohl(msg->ticket.term); @@ -434,8 +441,8 @@ if (tk->next_state == ST_INIT || tk->state == ST_INIT) return 0; - /* for heartbeats we make do with the majority */ - if (tk->last_request == OP_HEARTBEAT && + req = ntohl(msg->header.request); + if ((req == OP_UPDATE || req == OP_HEARTBEAT) && term == tk->current_term && leader == tk->leader) { @@ -642,15 +649,18 @@ int valid; struct boothc_ticket_msg omsg; cmd_result_t inappr_reason; + int reason; inappr_reason = test_reason(tk, sender, leader, msg); if (inappr_reason) return send_reject(sender, tk, inappr_reason, msg); valid = term_time_left(tk); + reason = ntohl(msg->header.reason); - /* allow the leader to start new elections on valid tickets */ - if (sender != tk->leader && valid) { + /* 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 " "(we have %s as ticket owner), ticket still valid for %ds", site_string(sender), site_string(tk->leader), valid); 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-07-17 16:30:12.000000000 +0200 +++ new/booth/src/ticket.c 2014-07-25 12:57:28.000000000 +0200 @@ -104,17 +104,32 @@ */ static int ticket_dangerous(struct ticket_config *tk) { + time_t now = get_secs(NULL); + /* we may be invoked often, don't spam the log unnecessarily + */ + static int no_log_delay_msg; + if (!tk->delay_commit) return 0; - if (tk->delay_commit <= get_secs(NULL) || - all_sites_replied(tk)) { - tk_log_info("ticket delay expired, committing to CIB"); + if (tk->delay_commit <= now || all_sites_replied(tk)) { + if (tk->leader == local) { + tk_log_info("%s, committing to CIB", + tk->delay_commit <= now ? + "ticket delay expired" : "all sites replied"); + } tk->delay_commit = 0; + no_log_delay_msg = 0; return 0; - } else { - tk_log_debug("delay ticket commit for %ds", - (int)(tk->delay_commit - get_secs(NULL))); + } + + tk_log_debug("delay ticket commit for %ds", + (int)(tk->delay_commit - now)); + if (!no_log_delay_msg) { + tk_log_info("delaying ticket commit to CIB for %ds " + "(or all sites are reached)", + (int)(tk->delay_commit - now)); + no_log_delay_msg = 1; } return 1; @@ -308,6 +323,7 @@ void reset_ticket(struct ticket_config *tk) { disown_ticket(tk); + no_resends(tk); tk->state = ST_INIT; tk->voted_for = NULL; } @@ -550,11 +566,12 @@ int leader_update_ticket(struct ticket_config *tk) { int rv = 0, rv2; - time_t now = get_secs(NULL); + time_t now; if (tk->ticket_updated >= 2) return 0; + now = get_secs(NULL); if (tk->ticket_updated < 1) { tk->ticket_updated = 1; tk->last_renewal = now; @@ -570,9 +587,6 @@ notify_client(tk, RLT_SUCCESS); break; case 1: - tk_log_info("delaying ticket commit to CIB for %ds " - "(or all sites are reached)", - (int)(tk->delay_commit - now)); notify_client(tk, RLT_CIB_PENDING); break; default: @@ -756,10 +770,14 @@ /* timeout or ticket renewal? */ if (tk->acks_expected) { handle_resends(tk); + if (majority_of_bits(tk, tk->acks_received)) { + leader_update_ticket(tk); + } } else { /* this is ticket renewal, run local test */ if (!test_external_prog(tk, 1)) { ticket_broadcast(tk, OP_HEARTBEAT, OP_ACK, RLT_SUCCESS, 0); + tk->ticket_updated = 0; } } break; @@ -883,16 +901,6 @@ /* got an ack! */ tk->acks_received |= sender->bitmask; - if (cmd == OP_HEARTBEAT) - tk_log_debug("got ACK from %s, %d/%d agree.", - site_string(sender), - count_bits(tk->acks_received), - booth_conf->site_count); - - if (tk->delay_commit && all_sites_replied(tk)) { - tk->delay_commit = 0; - } - if (all_replied(tk) || /* we just stepped down, need only one site to start * elections */ 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-07-17 16:30:12.000000000 +0200 +++ new/booth/test/live_test.sh 2014-07-25 12:57:28.000000000 +0200 @@ -42,6 +42,7 @@ cnf=$1 shift 1 +ERR_SETUP_FAILED=52 logf=test_booth.log iprules=/usr/share/booth/tests/test/booth_path : ${HA_LOGFACILITY:="syslog"} @@ -159,24 +160,30 @@ test "`runcmd $1 booth status | get_stat_fld booth_state`" = "started" } stop_booth() { - local h + local h rc for h in $sites; do stop_site $h + rc=$((rc|$?)) done >/dev/null 2>&1 for h in $arbitrators; do stop_arbitrator $h + rc=$((rc|$?)) done >/dev/null 2>&1 wait_timeout + return $rc } start_booth() { - local h + local h rc for h in $sites; do start_site $h + rc=$((rc|$?)) done >/dev/null 2>&1 for h in $arbitrators; do start_arbitrator $h + rc=$((rc|$?)) done >/dev/null 2>&1 wait_timeout + return $rc } restart_booth() { local h procs @@ -304,7 +311,7 @@ wait_timeout() { local t=2 [ "$T_timeout" -gt $t ] && t=$T_timeout - [ "$PKT_LOSS" ] && t=$((t+PKT_LOSS/6)) + [ "$PKT_LOSS" ] && t=$((t + 2*T_timeout + PKT_LOSS/6)) sleep $t } @@ -482,13 +489,14 @@ logmsg "running hb_report" hb_report -Q 2>&1 | grep -sq "illegal.option" || quick_opt="-Q" - hb_report $hb_report_opts -f "`date -d @$((start_ts-5))`" \ + hb_report $hb_report_opts $quick_opt -f "`date -d @$((start_ts-5))`" \ -t "`date -d @$((end_ts+60))`" \ -n "$sites $arbitrators" $name 2>&1 | logmsg } runtest() { local start_ts end_ts rc booth_status local start_time end_time + local usrmsg TEST=$1 start_time=`date` start_ts=`date +%s` @@ -496,12 +504,29 @@ can_run_test $1 || return 0 echo "starting booth test $1 ..." | logmsg setup_netem - test_$1 && check_$1 + test_$1 rc=$? + case $rc in + 0) + check_$1 + rc=$? + if [ $rc -eq 0 ]; then + usrmsg="SUCCESS" + else + usrmsg="check FAIL: $rc" + fi + ;; + $ERR_SETUP_FAILED) + usrmsg="setup FAIL" + ;; + *) + usrmsg="test FAIL: $rc" + ;; + esac end_time=`date` end_ts=`date +%s` reset_netem_env - echo "finished booth test $1 (exit code $rc)" | logmsg + echo "finished booth test $1 ($usrmsg)" | logmsg is_function recover_$1 && recover_$1 sleep 3 all_booth_status @@ -510,7 +535,7 @@ echo OK [ "$GET_REPORT" ] && run_report $start_ts $end_ts $TEST else - echo "FAIL (running hb_report ... $1.tar.bz2; see also $logf)" + echo "$usrmsg (running hb_report ... $1.tar.bz2; see also $logf)" [ $booth_status -ne 0 ] && echo "unexpected: some booth daemons not running" run_report $start_ts $end_ts $TEST @@ -558,17 +583,16 @@ # the tests # -# most tests start like this -grant2site_one() { - run_site 1 booth grant $tkt >/dev/null - wait_timeout +# most tests start by granting ticket +grant_ticket() { + run_site $1 booth grant $tkt >/dev/null } ## TEST: grant ## # just a grant test_grant() { - grant2site_one + grant_ticket 1 } check_grant() { check_consistency `get_site 1` @@ -578,7 +602,7 @@ # just a grant followed by three expire times test_longgrant() { - grant2site_one + grant_ticket 1 || return $ERR_SETUP_FAILED wait_exp wait_exp wait_exp @@ -593,10 +617,10 @@ test_grant_noarb() { local h for h in $arbitrators; do - stop_arbitrator $h + stop_arbitrator $h || return $ERR_SETUP_FAILED done >/dev/null 2>&1 sleep 1 - run_site 1 booth grant $tkt >/dev/null + grant_ticket 1 || return $ERR_SETUP_FAILED } check_grant_noarb() { check_consistency `get_site 1` @@ -615,7 +639,7 @@ # just a revoke test_revoke() { - grant2site_one + grant_ticket 1 || return $ERR_SETUP_FAILED revoke_ticket } check_revoke() { @@ -636,9 +660,9 @@ # grant with one site lost test_grant_site_lost() { - stop_site `get_site 2` + stop_site `get_site 2` || return $ERR_SETUP_FAILED wait_timeout - run_site 1 booth grant $tkt >/dev/null + grant_ticket 1 || return $ERR_SETUP_FAILED check_cib `get_site 1` || return 1 wait_exp } @@ -649,13 +673,34 @@ start_site `get_site 2` } +## TEST: grant_site_reappear ## + +# grant with one site lost then reappearing +test_grant_site_reappear() { + stop_site `get_site 2` || return $ERR_SETUP_FAILED + sleep 1 + grant_ticket 1 || return $ERR_SETUP_FAILED + check_cib `get_site 1` || return 1 + wait_timeout + start_site `get_site 2` || return $ERR_SETUP_FAILED + wait_timeout + wait_timeout +} +check_grant_site_reappear() { + check_consistency `get_site 1` && + is_cib_granted `get_site 1` +} +recover_grant_site_reappear() { + start_site `get_site 2` +} + ## TEST: simultaneous_start_even ## # simultaneous start of even number of members test_simultaneous_start_even() { local serv - run_site 2 booth grant $tkt >/dev/null - stop_booth + grant_ticket 2 || return $ERR_SETUP_FAILED + stop_booth || return $ERR_SETUP_FAILED wait_timeout for serv in $(echo $sites | sed "s/`get_site 1` //"); do start_site $serv & @@ -676,8 +721,8 @@ # slow start test_slow_start_granted() { - grant2site_one - stop_booth + grant_ticket 1 || return $ERR_SETUP_FAILED + stop_booth || return $ERR_SETUP_FAILED wait_timeout for serv in $sites; do start_site $serv @@ -696,8 +741,8 @@ # restart with ticket granted test_restart_granted() { - grant2site_one - restart_site `get_site 1` + grant_ticket 1 || return $ERR_SETUP_FAILED + restart_site `get_site 1` || return $ERR_SETUP_FAILED wait_timeout } check_restart_granted() { @@ -708,10 +753,10 @@ # restart with ticket granted (but cib empty) test_restart_granted_nocib() { - grant2site_one - stop_site_clean `get_site 1` || return 1 + grant_ticket 1 || return $ERR_SETUP_FAILED + stop_site_clean `get_site 1` || return $ERR_SETUP_FAILED wait_timeout - start_site `get_site 1` + start_site `get_site 1` || return $ERR_SETUP_FAILED wait_timeout wait_timeout wait_timeout @@ -724,10 +769,10 @@ # restart with ticket not granted test_restart_notgranted() { - grant2site_one - stop_site `get_site 2` + grant_ticket 1 || return $ERR_SETUP_FAILED + stop_site `get_site 2` || return $ERR_SETUP_FAILED sleep 1 - start_site `get_site 2` + start_site `get_site 2` || return $ERR_SETUP_FAILED wait_timeout } check_restart_notgranted() { @@ -738,9 +783,9 @@ # ticket failover test_failover() { - grant2site_one - stop_site_clean `get_site 1` || return 1 - booth_status `get_site 1` && return 1 + grant_ticket 1 || return $ERR_SETUP_FAILED + stop_site_clean `get_site 1` || return $ERR_SETUP_FAILED + booth_status `get_site 1` && return $ERR_SETUP_FAILED wait_exp wait_timeout wait_timeout @@ -757,7 +802,7 @@ # split brain (leader alone) test_split_leader() { - grant2site_one + grant_ticket 1 || return $ERR_SETUP_FAILED run_site 1 $iprules stop $port >/dev/null wait_exp wait_timeout @@ -778,7 +823,7 @@ # split brain (follower alone) test_split_follower() { - grant2site_one + grant_ticket 1 || return $ERR_SETUP_FAILED run_site 2 $iprules stop $port >/dev/null wait_exp wait_timeout @@ -793,7 +838,7 @@ # split brain (leader alone) test_split_edge() { - grant2site_one + grant_ticket 1 || return $ERR_SETUP_FAILED run_site 1 $iprules stop $port >/dev/null wait_exp run_site 1 $iprules start $port >/dev/null @@ -808,9 +853,9 @@ # external test prog failed test_external_prog_failed() { - grant2site_one + grant_ticket 1 || return $ERR_SETUP_FAILED break_external_prog 1 - show_pref 1 || return 1 + show_pref 1 || return $ERR_SETUP_FAILED wait_renewal wait_timeout } @@ -863,7 +908,8 @@ TESTS="$@" -: ${TESTS:="grant longgrant grant_noarb grant_elsewhere grant_site_lost revoke +: ${TESTS:="grant longgrant grant_noarb grant_elsewhere +grant_site_lost grant_site_reappear revoke simultaneous_start_even slow_start_granted restart_granted restart_granted_nocib restart_notgranted failover split_leader split_follower split_edge -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org