Version Cleaner module

Magnolia 6.3 may not fully support all incubator modules yet. Please get in touch with Magnolia support for more information.

The Version Cleaner module is an incubator module. It provides commands to remove old or duplicated versions from your version store. Which versions are selected for removal can be configured through voters.

Usage

The module provides a set of commands for removing selected versions from the version history.

Which versions are selected for deletion are configurable through voters. You can define complex conditions to identify if a version should be deleted.

Cleanup Commands

The cleanup commands can be found in the version cleaner catalog: /module/versioncleaner/commands/cleanup.

Command Description

cleanVersions

Remove unneeded versions according to its configuration.

cleanAllVersions

Remove all versions found except root and leaf versions.

Unlike cleanVersions, cleanAllVersions does not require possibly complicated configuration.

cleanNodeVersions

Clean versions from a workspace and path.

cleanVersions and cleanAllVersions work directly on the JCR version workspace. They clean versions from all workspaces with versions.

cleanNodeVersions however cleans versions from a specific workspace and optional path. Unlike cleanVersions and cleanAllVersions, cleanNodeVersions will not resume its cleaning run after reaching its visitLimit; it doesn’t save its progress while cleaning versions. cleanNodeVersions does not archive versions before deleting them.

The cleanVersions and cleanAllVersions commands can be configured with the following parameters when invoked:

Parameter Description

noop

true or false (the default)

Does a "dry run", going through the selected versions but without deleting or modifying them.

archive

true or false (the default)

If true, will save an export of each version to be deleted to the specified archiveDir.

Using this option may generate many files. Be sure you have sufficient space to store the archive versions.

archiveDir

Directory for storing archived versions and cleaning run history.

Defaults to: ${magnolia.cleanup.dir} if specified or ${magnolia.repositories.home} if not.

Magnolia must have read and write permissions for the directory.

visitLimit

The maximum number of version nodes that will be checked during a run.

Defaults to 1000 if not specified.

If set to a number less than 0, all version nodes will be checked.
These parameters can also be set as properties in the command configuration, at /module/versioncleaner/commands/cleanup/cleanVersions or /module/versioncleaner/commands/cleanup/cleanAllVersions.

Diagnostic Commands

The diagnostic commands can be found in the version cleaner catalog /module/versioncleaner/commands/diagnostic.

Command Description

findBadVersions

Locate corrupted versions in the version workspace.

A version is corrupt if it:

  • has no root version

  • has multiple root versions

  • the root version identified by name differs from the root version returned by the JCR API

Configuring Cleanup

The versions selected for removal by the cleanVersions, cleanAllVersions and cleanNodeVersions commands are controlled by Voters. The voters determine if a versions should be deleted (the result of the voting is true) or retained (the result of the voting is false).

You can combine the results of different voters with logical operations (and, or, xor…​).

Each command can be configured with the pruneVersions property:

configuring cleanup

Version Voters

You can use the following voters to identify versions to be deleted or retained:

EligibleVersionVoter

EligibleVersionVoter returns true if the version is not a root version (the first version of a node) or a leaf version (the last version of a node).

Class: info.magnolia.services.cleanup.commands.voters.EligibleVersionVoter

NoModificationVoter

NoModificationVoter returns true if the version has the same modification date as the previous version or false if the modification dates are different.

Class: info.magnolia.services.cleanup.commands.voters.NoModificationVoter

OldVersionVoter

OldVersionVoter returns true if the version is older than the maxAge threshold or false otherwise.

Class: info.magnolia.services.cleanup.commands.voters.OldVersionVoter

Table 1. Properties
Property Description

maxAge

optional

The age threshold in milliseconds.

Defaults to 90 days (i.e. 7776000000)

UnneededVersionVoter

UnneededVersionVoter returns true if there are at least versionsThreshold newer versions and false otherwise. Use UnneededVersionVoter to limit the total number of versions retained.

Class: info.magnolia.services.cleanup.commands.voters.UnneededVersionVoter

Table 2. Properties
Property Description

versionsThreshold

optional

The number of versions to be retained.

Defaults to 5.

For more information, see Version Cleaner module.

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Performance tuning guide docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules