FlowKit icon indicating copy to clipboard operation
FlowKit copied to clipboard

Don't drop cache table when removing table references

Open jc-harrison opened this issue 2 years ago • 1 comments

When invalidating the cache entry for a flowmachine query, before dropping the cache entry we first invalidate any Table references pointing to the cache table:

https://github.com/Flowminder/FlowKit/blob/cac6d07692c635d28d9bc65a63f248db55cef687/flowmachine/flowmachine/core/query.py#L804

I wonder whether we should set drop=False here? Because otherwise, invalidating the cache for the table reference will actually drop the query's cache table, earlier than intended (the cache table should be dropped later - here - in the same transaction as the cache record is deleted).

As things stand, if something went wrong between invalidating the table reference and invalidating the cached query itself, I think it would be possible for a cache record to remain after the cache table has been removed.

jc-harrison avatar Mar 03 '23 13:03 jc-harrison

I think you're right by the way and we should be setting drop to False here.

greenape avatar May 31 '23 11:05 greenape