aidb icon indicating copy to clipboard operation
aidb copied to clipboard

Add implementation for clearing cache table

Open hjk1030 opened this issue 1 year ago • 13 comments

Added a function to delete all the data in the cache table. Trying to resolve issue #122.

hjk1030 avatar Apr 29 '24 14:04 hjk1030

By the way, do I need to add tests for this?

hjk1030 avatar Apr 29 '24 14:04 hjk1030

By the way, do I need to add tests for this?

Yes.

ttt-77 avatar Apr 29 '24 14:04 ttt-77

I modified an existing test to validate this since adding another test makes the existing test fail.

hjk1030 avatar May 01 '24 15:05 hjk1030

I modified the code style. Also changes the delete order to depend on foreign key references.

hjk1030 avatar May 02 '24 08:05 hjk1030

@ttt-77 Could you please review this PR again?

hjk1030 avatar May 06 '24 05:05 hjk1030

Looks good to me. @ddkang

ttt-77 avatar May 08 '24 00:05 ttt-77

@ddkang Could you please review this?

hjk1030 avatar May 10 '24 00:05 hjk1030

I refactored the function using the topological order of inference services.

hjk1030 avatar May 14 '24 15:05 hjk1030

@ttt-77 please check

ddkang avatar May 15 '24 04:05 ddkang

@ttt-77 Could you please review this?

hjk1030 avatar May 15 '24 17:05 hjk1030

I've reconsidered the clearing logic. Now I'm planning to use the following procedure:

  1. Collect the output tables directly related to the selected services.
  2. 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).
  3. Delete the cache tables. No fk refers to the cache table so this should not cause a problem.
  4. 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?

hjk1030 avatar May 18 '24 02:05 hjk1030

Looks good.

ttt-77 avatar May 18 '24 03:05 ttt-77

@ttt-77 Could you please check this? The clearing steps are more complicated than I thought but I think all the steps are necessary.

hjk1030 avatar May 19 '24 16:05 hjk1030