osaf/services/saf/immsv/immnd/ImmModel.cc | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
In commitModify() IMM_CREATE_LOCK flag is used to test to avoid adding
duplicated no-dangling references.
When an IMM_CREATE mutation is committed, the IMM_CREATE_LOCK flag is also
cleared in commitCreate().
If the CCB has IMM_MODIFY mutations that add references to object of committed
IMM_CREATE mutations, it will fail to add NO_DANGLING references to
sReverseRefsNoDanglingMMap in addNewNoDanglingRefs() due to cleared
IMM_CREATE_LOCK flag.
mMutations map is sorted by object DN so the order of mutations to be committed
depends on the object DNs.
This patch introduces new method to avoid adding duplicated references instead
of using IMM_CREATE_LOCK flag.
No-dangling references will only be added if they don't currently exist in the
map.
diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -5223,7 +5223,17 @@ ImmModel::addNewNoDanglingRefs(ObjectInf
omi = sObjectMap.find(*si);
// After all validation, object must exist
osafassert(omi != sObjectMap.end());
- if(omi->second->mObjFlags & IMM_CREATE_LOCK) {
+
+ // Searching for NO_DANGLING reference
+ ommi = sReverseRefsNoDanglingMMap.find(omi->second);
+ for(; ommi != sReverseRefsNoDanglingMMap.end(); ++ommi) {
+ if(ommi->first != omi->second || ommi->second == obj) {
+ break;
+ }
+ }
+
+ // The reference does not exist. It will be added to
sReverseRefsNoDanglingMMap
+ if(ommi == sReverseRefsNoDanglingMMap.end() || ommi->first !=
omi->second) {
sReverseRefsNoDanglingMMap.insert(std::pair<ObjectInfo *,
ObjectInfo *>(omi->second, obj));
}
}
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel