If a takeover_request is created just before the active controller
calls 'watch takeover_request', then it's possible that the
active rded instance is not informed of the request.

When 'watch takeover_request' is called, check if there's already
a takeover_request in 'NEW' state and return immediately.
---
 src/osaf/consensus/plugins/etcd3.plugin | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/osaf/consensus/plugins/etcd3.plugin 
b/src/osaf/consensus/plugins/etcd3.plugin
index d926885..4e09ef6 100644
--- a/src/osaf/consensus/plugins/etcd3.plugin
+++ b/src/osaf/consensus/plugins/etcd3.plugin
@@ -337,13 +337,22 @@ watch() {
   orig_value=$(get "$watch_key")
   result=$?
 
-  if [ "$result" -le "1" ]; then
+  if [ "$result" -le 1 ]; then
+      if [ "$result" -eq 0 ] && [ "$watch_key" == "$takeover_request" ]; then
+        state=$(echo $orig_value | awk '{print $4}')
+        if [ "$state" == "NEW" ]; then
+          # takeover_request already exists; maybe it was written created
+          # while this node was being promoted
+          echo $orig_value
+          return 0
+        fi
+      fi
     while true
     do
       sleep $heartbeat_interval
       current_value=$(get "$watch_key")
       result=$?
-      if [ "$result" -gt "1" ]; then
+      if [ "$result" -gt 1 ]; then
         # etcd down?
         if [ "$watch_key" == "$takeover_request" ]; then
           hostname=`cat $node_name_file`
-- 
2.7.4



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to