Server | Version 4

Deleted Documents and Trash

Learn how Sophora handles the removal of documents.

After a document has been marked for deletion, there are two phases during which it is still available in Sophora:

  • Trash: Whenever a user deletes a document, the document is not removed immediately. It is moved to the trash and marked as deleted.
  • Delete Archive: A document can be removed from the trash manually or automatically. Depending on the server configuration, it is still available in the archival storage. In that case, the document appears in the delete archive and is marked as permanently deleted.

Deleting documents from the trash

Documents that are marked as deleted can be removed from the trash automatically after a configured period of time. This task is performed by the Deleted Documents Worker. It can be configured in the in the sophora.properties file. The names of the corresponding parameters start with sophora.deleteDocuments.

If the archival storage of the server is enabled, you can configure the worker to move documents from the main repository to the archive repository together with their versions. Otherwise, the worker will irrevocably delete documents from the trash.

The Deleted Documents Worker does not delete documents from the archive repository or from the live workspace.

Example configurations

1. Example: Documents are archived before they are removed from the main repository

sophora.archive.enabled = true
 
sophora.deleteDocuments.enabledOnStartup = true
sophora.deleteDocuments.archive = true
sophora.deleteDocuments.minimumAgeDays = 180

2. Example: Documents are not archived before they are removed from the main repository

sophora.deleteDocuments.enabledOnStartup = true
sophora.deleteDocuments.archive = false

3. Example: The following settings are used to completely disable the archive on the server and automatically remove documents from trash after one day. The Deleted Documents Worker will be triggered every 5 minutes.

sophora.archive.enabled=false
sophora.archive.activeOnStartup=false
 
sophora.deleteDocuments.enabledOnStartup=true
sophora.deleteDocuments.archive=false
sophora.deleteDocuments.blockSize=100
sophora.deleteDocuments.minimumAgeDays=1
sophora.deleteDocuments.cronTriggerExpression=0 0/5 * * * ?

This configuration can be useful for Sophora Staging Servers to delete documents when they are not used any more (offline, deleted). See Notes on different server modes later on this page.

Deleting documents from the archive

Documents in the archive are processed by the Archive Worker. It is explained in more detail on the Archival Storage page. The Archive Worker deletes old versions of documents from the archive if they are older than the number of days that is specified by the sophora.archive.deleteOldVersionsAfterDays parameter in the sophora.properties file.

The Archive Worker treats all documents equally, regardless of whether they have been marked as permanently deleted or not. There is currently no option to remove documents only from the delete archive.

Deleting documents from the live workspace

The live workspace contains the last live state of every published document. All documents that are moved to the trash or set offline in the default workspace will be automatically deleted from the live workspace by the Live Workspace Deleted Worker.

Notes on different server modes

It depends on the sever mode how the deletion of documents is handled.

Sophora Replication Servers: The Deleted Documents Worker does not run on Sophora Replication Servers. After a document has been deleted permanently on the Primary Server, the deletion will be replicated to the Replication Server. More information about replication can be found on the page Replication and Synchronization.

Sophora Staging Servers: Whenever a document is set offline on the Sophora Primary Server, this will be handled as a deletion by the Sophora Staging Server. The Deleted Documents Worker runs on the Staging Server to perform this task.

It is not replicated between servers that a documents is moved to the archive or removed from the archive. So, the Archive Worker runs independently on each server, irrespective of the server mode, to manage archived versions of documents.

To learn more about the server modes, read the article Sophora Server Modes and Connected Sophora Servers.

Last modified on 5/25/21

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon