Open PiotrSiejda opened 1 year ago
Hi @PiotrSiejda, thanks for the issue!
The cache is later on is not reachable so it is either way disregarded on consecutive runs.
Can you clarify if you run into an error/issue on consecutive runs? If not, what would be the desired behavior?
No I have never run into error because of this. The only problem is that if if you have a lot of flow_runs, you would like to delete old ones to keep the db smaller. The problem here is that not everything is deleted cleanly so the db slowly grows in size. In my opinion in this situation all the records related to the flow_run
should be removed.
First check
Bug summary
Sending delete to the flow_run (or task_run) nicelly cascades along all the tables except for task_run_state_cache. Most likely the reason for that is that in: https://github.com/PrefectHQ/prefect/blob/main/src/prefect/orion/database/orm_models.py in class ORMTaskRunStateCache There is line:
task_run_state_id = sa.Column(UUID(), nullable=False)
Which most likely should have been:task_run_state_id = sa.Column(UUID(), nullable=False, ondelete='cascade')
The cache is later on is not reachable so it is either way disregarded on
consecutive
runs.This is related to: https://github.com/PrefectHQ/prefect/issues/8239
Reproduction
look into the db. Everything is emptied except for task_run_state_cache
Error
Table task_run_state_cache is not emptied.
Versions
Additional context
No response