Deleting a document involves several steps before the full document is actually deleted from the database and disk. These steps are described below.
Putting the Document in the Trash
For most standard document types in the Nuxeo Platform, the user interface action of deleting a document (Delete button) just puts it in the trash (visible in the Manage > Trash tab). Once in the trash, the document may be either undeleted (Restore button), or removed (Permanent delete button).
Putting a document in the trash is done by changing is life cycle state to deleted, by following the delete transition of the document's life cycle. If no such life cycle exists for the document, then it won't be put in the trash at all but will be immediately permanently deleted using the steps below.
When the trash is purged, all its documents are permanently deleted.
Besides the standard user interface, a document is put in the trash when using WebDAV, Nuxeo Drive, or using the TrashService.trashDocuments) API.
Permanently Deleting the Document
A permanent delete is done by most Nuxeo APIs, typically CoreSession.removeDocument or the higher-level APIs that use it like the CMIS bindings or the Automation Document.Delete operation.
Soft-Delete
If soft-delete is enabled (this is not the case by default), then the document is marked as deleted in the database (using a simple boolean flag) but no rows are actually removed. A search will not be able to find any document marked deleted in this way. From the application's point of view, the document is already fully deleted.
A scheduled periodic process will then hard-delete the documents marked as deleted at a later time, for asynchronous cleanup in fixed-sized batches.
Soft-delete can be enabled to relieve the database of expected heavy loads if many documents are deleted at the same time.
When Nuxeo has to hard-delete lots of documents, many rows in many tables, themselves related by foreign key constraints, have to be removed. On some databases this can use many resources (like undo segments for Oracle) and take a lot of time, so soft-delete is designed to spread these costly operations over time.
To activate soft-delete, you should change the repository configuration to add <softDelete enabled="true" />
. See Configuration Templates for more about updating the default-repository-config.xml.nxftl
file.
Please consult NXP-11335 for more details about soft-delete and the configuration of the periodic cleanup.
Hard-Delete
If soft-delete is not enabled, or when the periodic cleanup process for soft-delete happens, the document's data is actually physically deleted from the database by using DELETE
statements (hard-delete).
- Deleting Content (User documentation)
- Managing Deleted Documents (User documentation)
- Garbage-Collecting Orphaned Binaries (Admin documentation)