Fix config cache cleanup with extra config paths

A cat job returns all required config files for ALL tenants a project is
part of. Since the config cache cleanup was only considering extra
config paths from its own tenant project config (tpc) we could have
ended up with stale extra config files in the cache depending on which
tenant triggered the cat job and performed the cleanup.

We can simplify the cache cleanup and solve the described issue by
clearing the whole project-branch cache before populating it with the
updated content from the cat job.

Change-Id: I0f82f7e25958fb4fa5abeb800a791eb57636eb50
This commit is contained in:
Simon Westphahl
2021-08-19 08:33:55 +02:00
committed by James E. Blair
parent 60f846aa7a
commit d23717896b
7 changed files with 94 additions and 17 deletions

View File

@@ -134,6 +134,10 @@ class FilesCache(ZooKeeperSimpleBase, MutableMapping):
children = []
return len(children)
def clear(self):
with contextlib.suppress(NoNodeError):
self.kazoo_client.delete(self.root_path, recursive=True)
class UnparsedConfigCache(ZooKeeperSimpleBase):
"""Zookeeper cache for unparsed config files."""