orchestrator-core
orchestrator-core copied to clipboard
[Bug] inuseby relations not updated in domain model cache
Problem
The domain model cache contains inuseby relations that mirror the relations in the database. The problem is that these are not automatically updated for all subscriptions.
Example:
Subscription X is created with productblock A --> this updates DB + cache for X
- In the database,
Ais inusebyX - In the cached model of
X,Ais inusebyX
So far so good.
Now, subscription Y is created (or modified) to refer to productblock A --> this updates DB + cache for Y
- In the database,
Ais inusebyXandY - In the cached model of
Y,Ais inusebyXandY - In the cached model of
X,Ais inusebyX
The last line shows the error.
Impact
The "Service configuration" tab in the orchestrator-UI which gets its product block information from cache (through graphql) will show outdated information.
It is resolved by running a validation workflow on X to update it in the cache, but as of now that does not happen automatically.
Possible solutions
- Somehow invalidate cache + trigger validation of all related subscriptions after a create/modify. This could potentially be a lot of subscriptions, and I'm not sure if it has any other side effects
- As discussed in meeting 22/05: we're already rebuilding the cache of all
in_use_byrelations, recursively. In this case it is the cache of the firstdepends_onlayer which needs to be rebuilt
- As discussed in meeting 22/05: we're already rebuilding the cache of all
- Don't cache inusebyids/relations at all, query them on demand and add them in the dict read from cache
- ...