-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Core
-
Backlog priority:650
-
Sprint:nxFG 9.1.2, nxFG 9.1.3, nxFG 9.1.5
-
Story Points:2
How it should work
When deleting a Document, the async listener OrphanVersionRemoverListener will run and according to VersionRemovalPolicy this listener may remove the orphan versions if they are not filtered by a contributed OrphanVersionRemovalFilter.
Why it fails for recursive delete
For recursive deletes (i.e. folder delete with children) only the first level of deletion is handled at application level, the subtree recursion is handled at SQL level using a ON DELETE CASCADE trigger.
Because versions don't have a parentId (unfiled), they are not deleted by the trigger.
Problems
Handling configurable logic at SQL level is not possible.
On the other hand, managing the recursion at Java level is far more costly.
Quick solution
A quick solution is to provide a cleanup stored procedure and use a scheduler to run it periodically.
Target solution
If we want to keep the same configurability, we may need to do all the recursive delete at java level (NXP-21460). Doing that may also help us fixing NXP-14075.
Implemented solution
The solution chosen to solve this issue is to add a scheduled cleanup mechanism. The cleanup mechanism does periodic commits, every 1000 documents by default. This value can be changed using the Configuration Property org.nuxeo.orphanVersionsCleanup.commitSize.
In hotfixes version for Nuxeo 8.10 and Nuxeo 7.10, it's not enabled by default, and must be enabled by an explicit contribution:
<extension target="org.nuxeo.ecm.core.scheduler.SchedulerService" point="schedule"> <schedule id="orphanVersionsCleanup"> <!-- cleanup every day at 1:30 AM --> <cronExpression>0 30 1 * * ?</cronExpression> <event>orphanVersionsCleanup</event> </schedule> </extension>
- depends on
-
NXP-9311 Extend VersionRemovalPolicy system
- Resolved
- is duplicated by
-
NXP-14686 AbstractSession removeChildren may fail randomly to remove versions
- Open
-
NXP-17393 Permanently deleting a folder does not delete versions of documents under it
- Resolved
- is related to
-
NXP-21543 When deleting a folderish document, only the children documents' live version is deleted, not the archived versions
- Resolved
-
NXP-21460 Optimize orphan version removal
- Open
-
NXP-31659 Delete orphan workflows and tasks
- Resolved
- is required by
-
NXP-24819 Don't do orphan versions cleanup by default
- Resolved
-
NXP-27139 Scalable orphan version cleanup
- Resolved