Hi Hieu,

ACK from me.

Best Regards,
Thien

-----Original Message-----
From: Hieu Hong Hoang <hieu.h.ho...@dektech.com.au> 
Sent: Tuesday, May 10, 2022 1:34 PM
To: Thang Duc Nguyen <thang.d.ngu...@dektech.com.au>; Minh Hon Chau 
<minh.c...@dektech.com.au>; Thien Minh Huynh <thien.m.hu...@dektech.com.au>
Cc: opensaf-devel@lists.sourceforge.net; Hieu Hong Hoang 
<hieu.h.ho...@dektech.com.au>
Subject: [PATCH 1/1] imm: Remove dead admin owner [#3315]

While imm is synchronizing, the function to delete admin owner only changes the 
state of admin owner to dying instead of deleting it. If imm synchronizes 
successful, those admin owners will be removed. If the synchronization is 
aborted, those admin owner won't be deleted until next synchronization. 
Solution is to delete all dead admin owners after aborting a synchronization.
---
 src/imm/immnd/ImmModel.cc | 20 ++++++++++++++++++++  src/imm/immnd/ImmModel.h  
|  2 ++
 2 files changed, 22 insertions(+)

diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc index 
4ce43d848..2ff26c830 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -2341,6 +2341,9 @@ void ImmModel::sendSyncAbortAt(timespec& time) {  void 
ImmModel::getSyncAbortRsp() {
   sSyncAbortSentAt.tv_sec  = 0;
   sSyncAbortSentAt.tv_nsec = 0;
+  if (!immNotWritable()) {
+    removeDeadAdminOwners();
+  }
 }
 
 static bool is_sync_aborting() {
@@ -2828,6 +2831,7 @@ void ImmModel::abortSync() {
       LOG_ER("Impossible node state, will terminate");
       abort();
   }
+  removeDeadAdminOwners();
 }
 
 /**
@@ -20339,3 +20343,19 @@ void ImmModel::isolateThisNode(unsigned int thisNode, 
bool isAtCoord) {
      immnd_proc_imma_discard_connection()
    */
 }
+
+void ImmModel::removeDeadAdminOwners() {
+  TRACE_ENTER();
+  std::vector<AdminOwnerInfo*> dead_admin_owners;
+  auto it = sOwnerVector.begin();
+  while (it != sOwnerVector.end()) {
+    if ((*it)->mDying) {
+      LOG_WA("Removing admin owner %u %s which is in demise.",
+             (*it)->mId, (*it)->mAdminOwnerName.c_str());
+      osafassert(adminOwnerDelete((*it)->mId, true) == SA_AIS_OK);
+    } else {
+      it++;
+    }
+  }
+  TRACE_LEAVE();
+}
diff --git a/src/imm/immnd/ImmModel.h b/src/imm/immnd/ImmModel.h index 
44da47038..9940330f6 100644
--- a/src/imm/immnd/ImmModel.h
+++ b/src/imm/immnd/ImmModel.h
@@ -534,6 +534,8 @@ class ImmModel {
                                            SaUint32T attrType,
                                            SaImmAttrFlagsT attrFlags = 0,
                                            bool* hasLongDn = NULL);
+
+  void removeDeadAdminOwners();
 };
 
 #endif  // IMM_IMMND_IMMMODEL_H_
--
2.25.1



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

Reply via email to