Problem with delete big folder

cancel
Showing results for 
Search instead for 
Did you mean: 
jmal
Member II

Problem with delete big folder

Jump to solution

Hi,

I'm using Alfresco Enterprise 5.2.3, and I want delete folder with 50.000 - 200.000 documents inside. 

I tried delete by public rest API:

alfresco/api/-default-/public/alfresco/versions/1/nodes/30fa7bab-5c3a-46dc-ac32-51eac80008f6?permanent=false

And this is endless query. After few hours in server logs I saw Java heap space error. 

Then I wrote custom webscript which call deleteNode method from NodeService, effect was the same.

And my question is, how can I delete that folder without any errors and exception, and in a finite time?

1 Solution

Accepted Solutions
afaust
Master

Re: Problem with delete big folder

Jump to solution

You have to realise that a massive operation like that won't ever be fast. You are also not helping things by specifying permanent=false, which means all the deleted documents will actually be copied into archive / trash can, doubling the amount of operations to be performed (each deleted node will require at least 3 SQL delete,1 insert and 1 update statements - maybe more - , and when you allow archiving to take place you effectively require at least another 4 SQL insert statements). Also, since Alfresco supports event-based processing, for every document that is being deleted it will check if there has been any configured event processing (rule / behaviour) and may execute that defined logic. Of course during the whole operation, Alfresco has to collect / hold a lot of runtime data in-memory, which can lead to memory issues if your server has insufficient resources assigned to it.

It is never a good idea to try and delete (or modify) more than a few hundred elements in a single operation. Your deletion should be implemented as an incremental operation instead of trying to delete the whole folder in one go...

View solution in original post

2 Replies
afaust
Master

Re: Problem with delete big folder

Jump to solution

You have to realise that a massive operation like that won't ever be fast. You are also not helping things by specifying permanent=false, which means all the deleted documents will actually be copied into archive / trash can, doubling the amount of operations to be performed (each deleted node will require at least 3 SQL delete,1 insert and 1 update statements - maybe more - , and when you allow archiving to take place you effectively require at least another 4 SQL insert statements). Also, since Alfresco supports event-based processing, for every document that is being deleted it will check if there has been any configured event processing (rule / behaviour) and may execute that defined logic. Of course during the whole operation, Alfresco has to collect / hold a lot of runtime data in-memory, which can lead to memory issues if your server has insufficient resources assigned to it.

It is never a good idea to try and delete (or modify) more than a few hundred elements in a single operation. Your deletion should be implemented as an incremental operation instead of trying to delete the whole folder in one go...

francesco_forna
Partner

Re: Problem with delete big folder

Jump to solution

Hi,

you can reckon to use the MassiveDelete tool:

https://github.com/fsforna/MassiveDelete