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.
commit f6997b2f50b61b9eb7e298e18b72b458fda3c3c8
Author: Gary Lee gary.lee@dektech.com.au
Date: Fri Nov 16 01:40:38 2018 +0000
commit 705aa3eb629973031e9380d1ca5a53df0c82deed
Author: Gary Lee gary.lee@dektech.com.au
Date: Fri Nov 16 01:40:38 2018 +0000
Diff: