Browse Source

HPCC-11497 Fix spurious notify on parent changes

If a parent path of a subscriber was commited to, the subscribers
were spuriously notified.

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 11 years ago
parent
commit
815fc1c6f2
1 changed files with 8 additions and 7 deletions
  1. 8 7
      dali/base/dasds.cpp

+ 8 - 7
dali/base/dasds.cpp

@@ -759,14 +759,14 @@ public:
     bool querySub() const { return sub; }
     bool querySendValue() const { return sendValue; }
     unsigned queryDepth() const { return depth; }
-    bool qualify(CPTStack &stack)
+    bool qualify(CPTStack &stack, bool matchIfPartial)
     {
         ForEachItemIn(q, qualifierStack)
         {
             if (stack.ordinality() <= q+1)
             {
                 // No more stack available (e.g. because deleted below this point)
-                return true;
+                return matchIfPartial; // NB: return true if matchIfPartial=true (meaning head of subscriber path matched commit stack)
             }
             PTree &item = stack.item(q+1); // stack +1, top is root unqualified.
             CQualifiers *qualifiers = qualifierStack.item(q);
@@ -859,7 +859,7 @@ public:
         ForEachItemIn(s, *list)
         {
             CSubscriberContainer &subscriber = list->item(s);
-            if (subscriber.qualify(stack))
+            if (subscriber.qualify(stack, false))
             {
                 if (!results) results = new CSubscriberContainerList(xpath);
                 subscriber.Link();
@@ -8398,7 +8398,7 @@ public:
                     CSubscriberContainer &subscriber = subs.item(s);
                     if (!subscriber.isUnsubscribed())
                     {
-                        if (subscriber.qualify(stack))
+                        if (subscriber.qualify(stack, true))
                         {
                             if (0 == notifyData.length())
                                 buildNotifyData(notifyData, state, &stack, NULL);
@@ -8419,7 +8419,7 @@ public:
                         CSubscriberContainer &subscriber = subs.item(s);
                         if (!subscriber.isUnsubscribed())
                         {
-                            if (subscriber.qualify(stack))
+                            if (subscriber.qualify(stack, true))
                             {
                                 if (0 == notifyData.length())
                                     buildNotifyData(notifyData, state, &stack, NULL);
@@ -8468,8 +8468,9 @@ public:
         else if (sub) // xpath matched some subscribers, and/or below some, need to check for sub subscribers
         {
             bool ret = false;
+            // avoid notifying on PDS_Structure only, which signifies changes deeper down only
             MemoryBuffer notifyData;
-            if (changes.state && changes.local)
+            if (changes.state && changes.local && (changes.local != PDS_Structure))
             {
                 int lastSendValue = -1;
                 ForEachItemInRev(s, subs)
@@ -8477,7 +8478,7 @@ public:
                     CSubscriberContainer &subscriber = subs.item(s);
                     if (!subscriber.isUnsubscribed())
                     {
-                        if (subscriber.qualify(stack))
+                        if (subscriber.qualify(stack, false))
                         {
                             if (subscriber.querySendValue())
                             {