ZKMetadataStore: Ignore the event for root node

Turns out Linux emits a `node created` event for the node a bit later.
Therefore, even if we add a listened after creating a root node,
we still may catch it in the listener
This commit is contained in:
Artem Bilan
2022-09-15 14:22:10 -04:00
parent 878f8cd3d9
commit f39ad6f558

View File

@@ -315,6 +315,10 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif
ChildData data = Type.NODE_DELETED.equals(type) ? oldData : newData;
String eventPath = data.getPath();
String eventKey = getKey(eventPath);
if (ZookeeperMetadataStore.this.root.equals(eventKey)) {
// Ignore the root node for metadata tree
return;
}
String value = IntegrationUtils.bytesToString(data.getData(), ZookeeperMetadataStore.this.encoding);
switch (type) {