orchestrator-core icon indicating copy to clipboard operation
orchestrator-core copied to clipboard

[Bug] inuseby relations not updated in domain model cache

Open Mark90 opened this issue 1 year ago • 0 comments

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, A is inuseby X
  • In the cached model of X, A is inuseby X

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, A is inuseby X and Y
  • In the cached model of Y, A is inuseby X and Y
  • In the cached model of X, A is inuseby X

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_by relations, recursively. In this case it is the cache of the first depends_on layer which needs to be rebuilt
  • Don't cache inusebyids/relations at all, query them on demand and add them in the dict read from cache
  • ...

Mark90 avatar May 16 '24 10:05 Mark90