-
Notifications
You must be signed in to change notification settings - Fork 232
Description
We have had a problem with deleting older accounts in our platform where there are a lot of records associated with the entity we are deleting. So lots of cascading deletes.
It appears the operation is failing due to the above command (at least in some cases):
-OOM command not allowed when used memory > 'maxmemory'.
The error is triggered by us calling:
business.delete() .. where we are deleting a business with lots of associated records.
If I watch redis stats I can see the allocated size grow quickly and then run out of memory and then the cache goes back to empty and the ORM delete operation fails.
We are only using a 512MB cache but don't want to overallocate for rare cases like this. This one delete operation is using the entire cache and wants more.
I tried adding nocache() to the delete call with no affect.
It appears django handles the cascading delete in the ORM rather than the database so it appears we are loading all these models to be deleted and they are being cached.
Is it possible to turn off caching for the delete operation? Makes sense anyway these objects are being deleted.