Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-11335

Soft delete for PostgreSQL, SQL Server and Oracle

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.7.1
    • Component/s: Core VCS
    • Upgrade notes:
      Hide

      To enable soft-delete, add to the repository configuration:

      <softDelete enabled="true" />

      There is a scheduled job do periodic cleanups every 15 min. The following system properties can be defined to change maximums and delays:

      • org.nuxeo.vcs.softdelete.cleanup.max: Property for the maximum number of documents to delete in one call. Zero means all the documents. Default is 1000.
      • org.nuxeo.vcs.softdelete.cleanup.age: The minimum delay (in seconds) since when a document must have been soft-deleted before it can be hard-deleted. Zero means no delay. Default is 300 (5 min).
      Show
      To enable soft-delete, add to the repository configuration: <softDelete enabled="true" /> There is a scheduled job do periodic cleanups every 15 min. The following system properties can be defined to change maximums and delays: org.nuxeo.vcs.softdelete.cleanup.max: Property for the maximum number of documents to delete in one call. Zero means all the documents. Default is 1000. org.nuxeo.vcs.softdelete.cleanup.age: The minimum delay (in seconds) since when a document must have been soft-deleted before it can be hard-deleted. Zero means no delay. Default is 300 (5 min).

      Description

      Deleting documents by issuing a SQL DELETE on their hierarchy row may cause two kinds of problems in some situations:

      1. some databases (Oracle with RAC for instance) have problems processing a large number of DELETE with ON DELETE CASCADE that apply recursively on the hierarchy table, in particular because this causes a large number of changes to the undo and redo logs,
      2. in a multithreaded scenario where a first thread does a DELETE on a document and therefore its hierarchy row, and a second threads tries to update the same document and that update causes a new row for a secondary table to be INSERT-ed, the row's FOREIGN KEY pointing to the deleted (in the first thread) hierarchy row will cause a constraint error.

      To solve this, we introduce soft deletes. In this mode, deleting a document does not immediately cause a DELETE but just marks the row as deleted (hierarchy.isdeleted = true). Later on, cleaning of the soft-deleted rows can be performed. To avoid seeing soft-deleted rows, all queries to the hierarchy table add an additional clause checking that the row is not soft-deleted (hierarchy.isdeleted IS NULL).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: