permify icon indicating copy to clipboard operation
permify copied to clipboard

Delete tenant should delete data

Open PhilippHandle opened this issue 1 year ago • 6 comments

Is your feature request related to a problem? Please describe. I wanted to reset the tenant. if i delete the tenant the relations etc stayed behind

Describe the solution you'd like on tenant deletion, the rest of the data, linked to the tenant, should be deleted

Describe alternatives you've considered deleting related data "manualy"

PhilippHandle avatar May 01 '24 15:05 PhilippHandle

I think it's taken care by garbage collection task.

inabhi9 avatar May 02 '24 12:05 inabhi9

Yeah but it's slow. I wanted to use permify for my game. If i restart the game, i would have to wait for the gc to run and this is very unconvinient.

PhilippHandle avatar May 02 '24 12:05 PhilippHandle

Ah, I see your use case! But it would be tricky to do it for them as they didn't use foreign key to optimize performance. Your best bet is to add some random prefix/suffix to tenant name.

inabhi9 avatar May 02 '24 13:05 inabhi9

Yeah I think its the easiest way. delete the old tenant and create a new one and let the gc cleanup afterwords.

PhilippHandle avatar May 02 '24 13:05 PhilippHandle

Ok i tried and it doesn't work. gc runs every 5min to test. I only habe one tenant and the tables schema_definitions, relation_tuplets, bundles get never cleaned up.

image

PhilippHandle avatar May 04 '24 12:05 PhilippHandle

I just checked the code and it seems GC doesn't clean-up for deleted tenant but rather cleans-up based on last transaction id (like deleting records having expired tx id less than the last tx id).

So I guess not an easy workaround!

inabhi9 avatar May 07 '24 15:05 inabhi9

resolved: PR-1517

ucatbas avatar Aug 27 '24 12:08 ucatbas