Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/curator/pull/202#discussion_r105545433
--- Diff:
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
---
@@ -694,14 +695,23 @@ private void applyNewData(String fullPath, int
resultCode, Stat stat, byte[] byt
{
offerOperation(new EventOperation(this, new
PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_ADDED, data)));
}
- else if ( previousData.getStat().getVersion() !=
stat.getVersion() )
+ else if ( hasChanged(stat, previousData, data) )
{
offerOperation(new EventOperation(this, new
PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_UPDATED, data)));
}
updateInitialSet(ZKPaths.getNodeFromPath(fullPath), data);
}
}
+ private boolean hasChanged(Stat stat, ChildData previousData,
ChildData newData)
+ {
+ if ( cacheData )
+ {
+ return !Arrays.equals(previousData.getData(),
newData.getData());
--- End diff --
If the node is created with the same data, we will also miss the changes.
What's the semantic here for CHILD_UPDATED event? Does it means data in this
node was changed? If it's being recreated with the same data, should we fire it
or not?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---