Nuxeo Server

Deleting Documents

Updated: September 22, 2017 Page Information Edit on GitHub

Deleting a document involves several steps before the full document is actually deleted from the database and disk. These steps are described below.

Functional Overview

Deleting Documents

Only users with "Edit" or "Manage everything" permissions can delete documents from a space.

To delete one or several documents, select them from the Content tab of the workspace, click on Delete and confirm. The documents are moved to the Trash tab of the workspace (available to users with management rights only) and do not appear in the workspace's content list anymore. Their lifecycle state is now "deleted".

You can also delete documents using right-click on the document's icon from the Content tab of the workspace.

Managing Deleted Documents

Users with "Manage everything" permissions can access the workspace's Trash and perform one of the following actions:

  • Restore documents by selecting them and clicking the Restore button. Documents are moved back to the Content tab of the workspace and available to users. They get the "project" lifecycle state, even if their lifecycle state before deletion was "approved".
  • Erase documents by selecting them and clicking the Permanent delete button. Documents are permanently erased from the application. They cannot be restored. The relations to the deleted documents are deleted.
  • Empty the trash by clicking the corresponding button. All deleted documents are permanently erased from the application. They cannot be restored. The relations to the deleted documents are deleted.

Technical Overview

Putting the Document in the Trash

Putting a document in the trash is done by changing is lifecycle state to deleted, by following the delete transition of the document's lifecycle. If no such lifecycle 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.

Using Soft-Delete

Soft-delete is available for VCS only.

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 SQL statements (or equivalent calls for non-VCS storages).


Other Related Documentation
3 days ago manonlumeau NXDOC-1323: Update BDE doc
2 years ago Solen Guitter 12
2 years ago Manon Lumeau 11
2 years ago Manon Lumeau 10
3 years ago Solen Guitter 8
3 years ago Solen Guitter 9
3 years ago Solen Guitter 7 | Update related pages, move Garbage-Collecting Orphaned Binaries in ADMINDOC, formatting
3 years ago Julien Carsique 6
3 years ago Alain Escaffre 5
3 years ago Florent Guillaume 4 | soft-delete details
3 years ago Solen Guitter 3
3 years ago Florent Guillaume 2
3 years ago Florent Guillaume 1
History: Created by Florent Guillaume