Version Store

Removal of older versions - Version Decluttering

Prevent your Sophora Version Store to grow indefinitely.

Over time, document versions can accumulate significantly. For example, each publish action creates a new version. Without intervention, this can eventually lead to millions of unnecessary versions. To address this, the Version Store schedules a cleanup job, triggered by a cron expression, to remove excess versions. This process is referred to as version decluttering. For details on available settings, see Configuring the Sophora Server.

A version is considered obsolete if one of the following conditions is met:

  • The number of versions per document is exceeded.
  • The maximum age of a version is exceeded.

In order to configure when these conditions are met, you can set different properties globally, on a node type level and per document:

Properties to set globally and per node type

  • sophora.versionstore.maxVersionsToKeep or sophora.versionstore.byNodeType.[label].maxVersionsToKeep
  • sophora.versionstore.maxVersionAgeInDays or sophora.versionstore.byNodeType.[label].maxVersionAgeInDays

Properties to set per document

  • sophora:maxVersionsToKeep: this overwrites the globally/per node type set maxVersionsToKeep
  • sophora:minVersionsToKeep: if this property is not set the default of 15 will be used

Interaction

  1. If the minimum as well as the maximum versions to keep are configured in a document, there may be less than the configured mininum number of versions if sophora:maxVersionsToKeep is set lower than sophora:minVersionsToKeep.
  2. If the global or node type level maxVersionsToKeep is greater than 15 and you have not configured sophora:minVersionsToKeep for a specific document, there may remain at least 15 versions of that document even if these are older than the configured maximum age.
  3. If sophora:minVersionsToKeep is configured for a document, it may take precedence over global or node type level sophora:maxVersionsToKeep.

Examples for the interactions:

Assuming there are 30 versions of a specific story document in total, each of them older than 1 day.

  • Interaction 1: the properties are defined as

sophora:minVersionsToKeep=20
sophora:maxVersionsToKeep=15
sophora.versionstore.byNodeType.story.maxVersionAgeInDays=1

--> With this configuration, after decluttering, there will be 15 versions left since sophora:maxVersionsToKeep is set on document level and is lower than sophora:minVersionsToKeep.

  • Interaction 2: the properties are defined as

sophora.versionstore.byNodeType.story.maxVersionAgeInDays=1
sophora.versionstore.byNodeType.story.maxVersionsToKeep=20.

--> With this configuration, after decluttering, there will be 15 versions left since minVersionsToKeep was not set to overwrite the default of 15 on this specific document.

  • Interaction 3: the properties are defined as

sophora:minVersionsToKeep=20
sophora.versionstore.byNodeType.story.maxVersionAgeInDays=1
sophora.versionstore.byNodeType.story.maxVersionsToKeep=10.

--> With this configuration, after decluttering, there will be 20 versions left since maxVersionsToKeep was not set on a document level for this specific story.

Last modified on 3/31/26

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

Icon