summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Henkel <tobias.henkel@bmw.de>2018-11-30 23:26:19 +0100
committerTobias Henkel <tobias.henkel@bmw.de>2018-11-30 23:26:19 +0100
commit3e675082baa8884a27e4eb2d934df33edea89228 (patch)
tree7207e38a7e3f241db374a7d20990254dc8e96965
parent85968314bd472c13695d5d178d4b8a2db968c6e6 (diff)
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
Notes
Notes (review): Code-Review+2: James E. Blair <corvus@inaugust.com> Code-Review+2: Paul Belanger <pabelanger@redhat.com> Workflow+1: Paul Belanger <pabelanger@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sat, 01 Dec 2018 04:14:46 +0000 Reviewed-on: https://review.openstack.org/621305 Project: openstack-infra/nodepool Branch: refs/heads/master
-rwxr-xr-xnodepool/zk.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nodepool/zk.py b/nodepool/zk.py
index 4347b41..ca02502 100755
--- a/nodepool/zk.py
+++ b/nodepool/zk.py
@@ -2113,6 +2113,10 @@ class ZooKeeper(object):
2113 node_id = path.rsplit('/', 1)[1] 2113 node_id = path.rsplit('/', 1)[1]
2114 2114
2115 if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED): 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 # Perform an in-place update of the already cached node if possible 2120 # Perform an in-place update of the already cached node if possible
2117 d = self._bytesToDict(event.event_data.data) 2121 d = self._bytesToDict(event.event_data.data)
2118 old_node = self._cached_nodes.get(node_id) 2122 old_node = self._cached_nodes.get(node_id)
@@ -2176,6 +2180,10 @@ class ZooKeeper(object):
2176 request_id = path.rsplit('/', 1)[1] 2180 request_id = path.rsplit('/', 1)[1]
2177 2181
2178 if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED): 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 # Perform an in-place update of the cached request if possible 2187 # Perform an in-place update of the cached request if possible
2180 d = self._bytesToDict(event.event_data.data) 2188 d = self._bytesToDict(event.event_data.data)
2181 old_request = self._cached_node_requests.get(request_id) 2189 old_request = self._cached_node_requests.get(request_id)