Skip to content

Commit

Permalink
HPCC-18627 Fix issue with subscription notify and changes at '/'
Browse files Browse the repository at this point in the history
Root level changes were not triggering subscription notifications

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
  • Loading branch information
jakesmith committed Oct 27, 2017
1 parent b6a0769 commit b6f0a3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 8 additions & 3 deletions dali/base/dasds.cpp
Expand Up @@ -689,6 +689,11 @@ class CSubscriberContainer : public CSubscriberContainerBase
const MemoryAttr &ma = subscriber->queryData();
MemoryBuffer mb(ma.length(), ma.get());
mb.read(xpath);
if (xpath.length() && ('/' != xpath.get()[xpath.length()-1]))
{
StringBuffer _xpath(xpath);
xpath.set(_xpath.append('/'));
}
mb.read(sub);
if (mb.remaining()) // remaining
mb.read(sendValue);
Expand Down Expand Up @@ -8313,7 +8318,7 @@ class CSubscriberNotifyScanner : public CInterface
{
if ('\0' == *head)
return subCommitExact; // absolute match
else if (!wild && '/' != *head) // e.g. change=/a/bc, subscriber=/a/b
else if (!wild && '/' != *(head-1)) // e.g. change=/a/bc, subscriber=/a/b
return subCommitNone;
return subCommitBelow; // e.g. change=/a/b/c, subscriber=/a/b
}
Expand Down Expand Up @@ -8431,7 +8436,7 @@ class CSubscriberNotifyScanner : public CInterface
CBranchChange &childChange = changes.children.item(c);
PushPop pp(stack, *childChange.tree);
size32_t parentLength = xpath.length();
xpath.append('/').append(childChange.tree->queryName());
xpath.append(childChange.tree->queryName()).append('/');
CSubscriberArray _pruned;
scanAll(state, childChange, stack, _pruned);
ForEachItemIn(i, _pruned) subs.append(*LINK(&_pruned.item(i)));
Expand Down Expand Up @@ -8502,7 +8507,7 @@ class CSubscriberNotifyScanner : public CInterface
{
CBranchChange &childChanges = changes.children.item(c);
size32_t parentLength = xpath.length();
xpath.append('/').append(childChanges.tree->queryName());
xpath.append(childChanges.tree->queryName()).append('/');
CSubscriberArray pruned;
scan(childChanges, stack, pruned);
ForEachItemIn(i, pruned) subs.append(*LINK(&pruned.item(i)));
Expand Down
3 changes: 1 addition & 2 deletions dali/base/dasds.ipp
Expand Up @@ -206,10 +206,9 @@ public:
unsigned i = 1;
for (;;)
{
str.append(item(i).queryName());
str.append(item(i).queryName()).append('/');
if (++i >= ordinality())
break;
str.append('/');
}
}
return str;
Expand Down

0 comments on commit b6f0a3c

Please sign in to comment.