osaf/services/saf/immsv/immnd/ImmModel.cc    |  19 +++++++++++++++++++
 osaf/services/saf/immsv/immnd/ImmSearchOp.cc |   7 +++++--
 osaf/services/saf/immsv/immnd/ImmSearchOp.hh |   1 +
 osaf/services/saf/immsv/immnd/immnd_evt.c    |  12 +++++++++++-
 osaf/services/saf/immsv/immnd/immnd_init.h   |   2 ++
 5 files changed, 38 insertions(+), 3 deletions(-)


If OI returns ERR_NO_MEMORY or ERR_NO_RESOURCES, the iteration will not move to 
the next object.
Application can then try SearchNext() again to read the object.
This is implemented by postponing popping out the object from mResultList
until receiving response from OI.

If there's an OI response time out, the search node will be finalized.
Application will get ERR_BAD_HANDLE in the next attempt at calling SearchNext().

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
@@ -1681,6 +1681,18 @@ immModel_nextResult(IMMND_CB *cb, void* 
                 if(implDest) { *implDest = 0; }
                 if(implTimeout) { *implTimeout = 0; }
             }
+            /* If it doesn't involve any OI, we can pop out the object.
+               There are 3 cases:
+               1. There are no pure rt attributes
+               2. There are pure rt attributes to fetch but OI detached 
(*implNodeId==0)
+               3. nextResult() is called by immnd_evt_proc_oi_att_pull_rpl()
+                  to get the updated values for pure rt attributes.
+                  In this case, rtAttrsToFetch==NULL
+             */
+            if (!rtAttrsToFetch || /* Case 3 */
+                    !(*implNodeId)) { /* Case 1 & 2 */
+                op->popLastResult();
+            }
         }
     }
 
@@ -1736,6 +1748,13 @@ immModel_fetchLastResult(void* searchOp,
 }
 
 void
+immModel_popLastResult(void *searchOp)
+{
+    ImmSearchOp* op = (ImmSearchOp *) searchOp;
+    op->popLastResult();
+}
+
+void
 immModel_clearLastResult(void* searchOp)
 {
     ImmSearchOp* op = (ImmSearchOp *) searchOp;
diff --git a/osaf/services/saf/immsv/immnd/ImmSearchOp.cc 
b/osaf/services/saf/immsv/immnd/ImmSearchOp.cc
--- a/osaf/services/saf/immsv/immnd/ImmSearchOp.cc
+++ b/osaf/services/saf/immsv/immnd/ImmSearchOp.cc
@@ -183,8 +183,11 @@ ImmSearchOp::nextResult(IMMSV_OM_RSP_SEA
             attrl->next = p->attrValuesList;
             p->attrValuesList = attrl;
         }
-        
-        mResultList.pop_front();
+        /* To decide whether to pop out the object or not,
+         * we need to know mNodeId of implInfo.
+         * Since ImplementerInfo is opaque to ImmSearchOp,
+         * we have to do the check in the upper level, at 
immModel_nextResult(). */
+        // mResultList.pop_front();
         err = SA_AIS_OK;
     } else {
         mLastResult=NULL;
diff --git a/osaf/services/saf/immsv/immnd/ImmSearchOp.hh 
b/osaf/services/saf/immsv/immnd/ImmSearchOp.hh
--- a/osaf/services/saf/immsv/immnd/ImmSearchOp.hh
+++ b/osaf/services/saf/immsv/immnd/ImmSearchOp.hh
@@ -87,6 +87,7 @@ public:
     bool          isNonExtendedNameSet() {return mNonExtendedName;}
     time_t        getLastSearchTime() { return mLastSearch; }
     void          updateSearchTime() { osaf_clock_gettime_sec(CLOCK_MONOTONIC, 
&mLastSearch); }
+    void          popLastResult() { mResultList.pop_front(); }
     void*         syncOsi;
     void*         attrNameList;
     void*         classInfo;
diff --git a/osaf/services/saf/immsv/immnd/immnd_evt.c 
b/osaf/services/saf/immsv/immnd/immnd_evt.c
--- a/osaf/services/saf/immsv/immnd/immnd_evt.c
+++ b/osaf/services/saf/immsv/immnd/immnd_evt.c
@@ -1054,6 +1054,11 @@ void search_req_continue(IMMND_CB *cb, I
        }
 
        if (sn) {
+               /* Don't move to the next iteration in searchOp
+                * if OI resturns ERR_NO_MEMORY or ERR_NO_RESOURCES */
+               if (err != SA_AIS_ERR_NO_MEMORY && err != 
SA_AIS_ERR_NO_RESOURCES) {
+                       immModel_popLastResult(sn->searchOp);
+               }
                immModel_fetchLastResult(sn->searchOp, &rsp);
                immModel_clearLastResult(sn->searchOp);
                isAccessor = immModel_isSearchOpAccessor(sn->searchOp);
@@ -1185,7 +1190,12 @@ void search_req_continue(IMMND_CB *cb, I
                LOG_WA("Could not send reply to agent for search-next 
continuaton");
        }
 
-       if(isAccessor) {
+       if(isAccessor || /* Accessor case */
+                       (err != SA_AIS_OK && err != SA_AIS_ERR_NO_MEMORY && err 
!= SA_AIS_ERR_NO_RESOURCES)) { /* Search case */
+               if (!isAccessor) {
+                       /* Finalize search node when it's not ERR_NO_MEMORY or 
ERR_NO_RESOURCES */
+                       TRACE("Finalizing search node, err = %u", err);
+               }
                if(sn && cl_node) {
                        IMMND_OM_SEARCH_NODE **prev = &(cl_node->searchOpList);
                        IMMND_OM_SEARCH_NODE *n = cl_node->searchOpList;
diff --git a/osaf/services/saf/immsv/immnd/immnd_init.h 
b/osaf/services/saf/immsv/immnd/immnd_init.h
--- a/osaf/services/saf/immsv/immnd/immnd_init.h
+++ b/osaf/services/saf/immsv/immnd/immnd_init.h
@@ -221,6 +221,8 @@ extern "C" {
 
        void immModel_fetchLastResult(void *searchOp, IMMSV_OM_RSP_SEARCH_NEXT 
**rsp);
 
+       void immModel_popLastResult(void *searchOp);
+
        SaBoolT immModel_isSearchOpAccessor(void* searchOp);
 
        SaBoolT immModel_isSearchOpNonExtendedNameSet(void* searchOp);

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to