Menu

#2954 osaf: takeover request without lease

5.19.01
fixed
Gary Lee
None
defect
unknown
-
major
False
2019-01-09
2018-11-05
Gary Lee
No

Sometimes a takeover request is created without a timeout (lease), if the initial attempt fails.

Possible fix:

diff --git a/src/osaf/consensus/consensus.cc b/src/osaf/consensus/consensus.cc
index 1136c37..1713d09 100644
--- a/src/osaf/consensus/consensus.cc
+++ b/src/osaf/consensus/consensus.cc
@@ -338,7 +338,7 @@ SaAisErrorT Consensus::CreateTakeoverRequest(const std::string& current_owner,
while (rc == SA_AIS_ERR_FAILED_OPERATION && retries < kMaxRetry) {
++retries;
std::this_thread::sleep_for(kSleepInterval);
- rc = KeyValue::Create(kTakeoverRequestKeyname, takeover_request);
+ rc = KeyValue::Create(kTakeoverRequestKeyname, takeover_request, takeover_valid_time);
}

if (rc == SA_AIS_ERR_EXIST) {

Also, when it is set (eg. with the result) the timeout no longer works. Acknowledge to Canh for noticing this.

Related

Wiki: ChangeLog-5.19.01

Discussion

  • Gary Lee

    Gary Lee - 2018-11-07
    • status: unassigned --> accepted
    • assigned_to: Gary Lee
     
  • Gary Lee

    Gary Lee - 2018-11-13
    • status: accepted --> review
     
  • Gary Lee

    Gary Lee - 2018-11-16

    commit f6997b2f50b61b9eb7e298e18b72b458fda3c3c8
    Author: Gary Lee gary.lee@dektech.com.au
    Date: Fri Nov 16 01:40:38 2018 +0000

    osaf: update etcd2 and sample plugins [#2954]
    
    add timeout parameter to set and set_if_prev
    

    commit 705aa3eb629973031e9380d1ca5a53df0c82deed
    Author: Gary Lee gary.lee@dektech.com.au
    Date: Fri Nov 16 01:40:38 2018 +0000

    osaf: ensure takeover_requests have a lease [#2954]
    
    In CreateTakeoverRequest(), if the initial attempt fails,
    then the takeover_request is created without a lease.
    
    Furthermore, when the takeover_request result is set,
    it is being set without a lease, and the takeover_request
    is not automatically removed.
    
    Add <timeout> parameter to KeyValue::Set, and remove
    default value for the <timeout> parameter to KeyValue::Create to
    ensure a timeout is always set.
    
     
  • Gary Lee

    Gary Lee - 2018-11-16
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -16,4 +16,4 @@
    
        if (rc == SA_AIS_ERR_EXIST) {
    
    -Also, when it is set (eg. with the result on etcd3) the timeout no longer works.
    +Also, when it is set (eg. with the result) the timeout no longer works. Acknowledge to Canh for noticing this.
    
     
  • Gary Lee

    Gary Lee - 2018-11-16
    • status: review --> fixed
     

Log in to post a comment.