aidb
aidb copied to clipboard
Add implementation for clearing cache table
Added a function to delete all the data in the cache table. Trying to resolve issue #122.
By the way, do I need to add tests for this?
By the way, do I need to add tests for this?
Yes.
I modified an existing test to validate this since adding another test makes the existing test fail.
I modified the code style. Also changes the delete order to depend on foreign key references.
@ttt-77 Could you please review this PR again?
Looks good to me. @ddkang
@ddkang Could you please review this?
I refactored the function using the topological order of inference services.
@ttt-77 please check
@ttt-77 Could you please review this?
I've reconsidered the clearing logic. Now I'm planning to use the following procedure:
- Collect the output tables directly related to the selected services.
- Collect the output tables that need to be cleared considering the fk constraints and service constraints (if one of the output tables in a service needs to be cleared, all the tables belonging to the service have to be cleared as well). This will use the table_graph in the config, and I'll create a new map at the beginning to get all the services related to a table(I didn't find an existing map for this).
- Delete the cache tables. No fk refers to the cache table so this should not cause a problem.
- Delete the output tables in the reversed topological order of table_graph.
Are there any problems with this procedure? Or can it be simplified in some way?
Looks good.
@ttt-77 Could you please check this? The clearing steps are more complicated than I thought but I think all the steps are necessary.