Value of admo name in the after image may not be correct in some cases,
but value of admo name in the before image (in sObjectMap) is always up to date.

We should keep the admo name value of the before image when committing 
modification.
---
 src/imm/immnd/ImmModel.cc | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index 2a53ed4..509923b 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -5938,17 +5938,6 @@ bool ImmModel::commitModify(const std::string& dn, 
ObjectInfo* afterImage) {
   ObjectInfo* beforeImage = oi->second;
   ClassInfo* classInfo = beforeImage->mClassInfo;
   osafassert(classInfo);
-  if (beforeImage->mAdminOwnerAttrVal->empty()) {
-    /* Empty Admin Owner can imply (hard) release during apply/commit.
-       This can happen if client invokes apply and then disconnects
-       without waiting for reply. Typically because of timeout on
-       the syncronous ccbApply. This can happen for large CCBs
-       and/or with a sluggish PBE. The releaseOn finalize will
-       have auto-released the adminOwner on the before-image but
-       not on the after image of modify. Corrected here.
-     */
-    afterImage->mAdminOwnerAttrVal->setValueC_str(NULL);
-  }
 
   /* The set of references in the before-image minus the set of references
      in the after-image constitutes the set of references *removed* by
@@ -5989,20 +5978,23 @@ bool ImmModel::commitModify(const std::string& dn, 
ObjectInfo* afterImage) {
        oavi != beforeImage->mAttrValueMap.end(); ++oavi) {
     AttrMap::iterator i4 = classInfo->mAttrMap.find(oavi->first);
     osafassert(i4 != classInfo->mAttrMap.end());
-    if (i4->second->mFlags & SA_IMM_ATTR_CONFIG) {
+    if ((i4->second->mFlags & SA_IMM_ATTR_CONFIG)
+        /* Keep the value of AdminOwnerName */
+        && oavi->first != std::string(SA_IMM_ATTR_ADMIN_OWNER_NAME)) {
       delete oavi->second;
     }
   }
 
   for (oavi = afterImage->mAttrValueMap.begin();
        oavi != afterImage->mAttrValueMap.end(); ++oavi) {
+    /* Don't update value of AdminOwnerName from the after image */
+    if (oavi->first == std::string(SA_IMM_ATTR_ADMIN_OWNER_NAME)) {
+      continue;
+    }
     AttrMap::iterator i4 = classInfo->mAttrMap.find(oavi->first);
     osafassert(i4 != classInfo->mAttrMap.end());
     osafassert(i4->second->mFlags & SA_IMM_ATTR_CONFIG);
     beforeImage->mAttrValueMap[oavi->first] = oavi->second;
-    if (oavi->first == std::string(SA_IMM_ATTR_ADMIN_OWNER_NAME)) {
-      beforeImage->mAdminOwnerAttrVal = oavi->second;
-    }
   }
   afterImage->mAttrValueMap.clear();
   delete afterImage;
-- 
2.7.4


------------------------------------------------------------------------------
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

Reply via email to