Browse Source

Don't update caches with empty zNodes

We found out that we leak some empty znodes that were just ignored by
nodepool before the caching changes. Now that we know that these exist
ignore them as well so we don't get spammed by exceptions.

Change-Id: I00a0ad2c7f645a2d03bd1674bf5d050c38b1dd50
Tobias Henkel 4 months ago
parent
commit
3e675082ba
No account linked to committer's email address
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      nodepool/zk.py

+ 8
- 0
nodepool/zk.py View File

@@ -2113,6 +2113,10 @@ class ZooKeeper(object):
2113 2113
         node_id = path.rsplit('/', 1)[1]
2114 2114
 
2115 2115
         if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED):
2116
+            # Nodes with empty data are invalid so skip add or update these.
2117
+            if not event.event_data.data:
2118
+                return
2119
+
2116 2120
             # Perform an in-place update of the already cached node if possible
2117 2121
             d = self._bytesToDict(event.event_data.data)
2118 2122
             old_node = self._cached_nodes.get(node_id)
@@ -2176,6 +2180,10 @@ class ZooKeeper(object):
2176 2180
         request_id = path.rsplit('/', 1)[1]
2177 2181
 
2178 2182
         if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED):
2183
+            # Requests with empty data are invalid so skip add or update these.
2184
+            if not event.event_data.data:
2185
+                return
2186
+
2179 2187
             # Perform an in-place update of the cached request if possible
2180 2188
             d = self._bytesToDict(event.event_data.data)
2181 2189
             old_request = self._cached_node_requests.get(request_id)

Loading…
Cancel
Save