فهرست منبع

Merge pull request #10576 from jakesmith/hpcc-18626

HPCC-18626 Ensure value subscriber notification for replaced trees.

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 7 سال پیش
والد
کامیت
dffcdc713e
1فایلهای تغییر یافته به همراه15 افزوده شده و 7 حذف شده
  1. 15 7
      dali/base/dasds.cpp

+ 15 - 7
dali/base/dasds.cpp

@@ -1718,11 +1718,11 @@ public:
 
     void noteChange(PDState _local, PDState _state) { local = _local; state = _state; }
 
-    void addChildBranch(CBranchChange &child) { children.append(child); }
+    void addChildBranch(CBranchChange &child) { changedChildren.append(child); }
 
     const void *queryFindParam() const { return (const void *) &tree; }
 
-    CBranchChangeChildren children;
+    CBranchChangeChildren changedChildren;
     Linked<CRemoteTreeBase> tree;
     PDState local, state; // change info
 };
@@ -8410,7 +8410,7 @@ public:
             }
             else
             {
-                if (0 == changes.children.ordinality())
+                if (0 == changes.changedChildren.ordinality())
                 {
                     ForEachItemInRev(s, subs)
                     {
@@ -8431,9 +8431,13 @@ public:
                 }
                 else
                 {
-                    ForEachItemIn (c, changes.children)
+                    /* NB: scan the changes in reverse, so that new values proceed recorded delete changes
+                     * This ensures that a tree that has been deleted but replaced with a new tree will
+                     * cause a notification of the new value in favour of the delete.
+                     */
+                    ForEachItemInRev (c, changes.changedChildren)
                     {
-                        CBranchChange &childChange = changes.children.item(c);
+                        CBranchChange &childChange = changes.changedChildren.item(c);
                         PushPop pp(stack, *childChange.tree);
                         size32_t parentLength = xpath.length();
                         xpath.append(childChange.tree->queryName()).append('/');
@@ -8503,9 +8507,13 @@ public:
                 }
             }
         }
-        ForEachItemIn(c, changes.children)
+        /* NB: scan the changes in reverse, so that new values proceed recorded delete changes
+         * This ensures that a tree that has been deleted but replaced with a new tree will
+         * cause a notification of the new value in favour of the delete.
+         */
+        ForEachItemInRev(c, changes.changedChildren)
         {
-            CBranchChange &childChanges = changes.children.item(c);
+            CBranchChange &childChanges = changes.changedChildren.item(c);
             size32_t parentLength = xpath.length();
             xpath.append(childChanges.tree->queryName()).append('/');
             CSubscriberArray pruned;