Ack. regards,
Anders Widell On 01/31/2018 07:02 AM, Gary Lee wrote:
Sometimes a set fails if the underlying key-value store is 'busy', particuarly when there are network topology changes occurring. We should retry a few times, before returning not writable. --- src/osaf/consensus/consensus.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/osaf/consensus/consensus.cc b/src/osaf/consensus/consensus.cc index c144a1bed..cc04f3518 100644 --- a/src/osaf/consensus/consensus.cc +++ b/src/osaf/consensus/consensus.cc @@ -162,7 +162,15 @@ bool Consensus::IsWritable() const { }SaAisErrorT rc;+ uint32_t retries = 0; + constexpr uint32_t kMaxTestRetry = 3; rc = KeyValue::Set(kTestKeyname, base::Conf::NodeName()); + while (rc != SA_AIS_OK && retries < kMaxTestRetry) { + ++retries; + std::this_thread::sleep_for(kSleepInterval); + rc = KeyValue::Set(kTestKeyname, base::Conf::NodeName()); + } + if (rc == SA_AIS_OK) { return true; } else {
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
