Incorrect version purge parameters erase all versions of a page in AEM
When configuring version purge in Adobe Experience Manager (AEM), three parameters interact:
maxAgeDays- Maximum age (in days) of a version to keep; -1 indicates no age limitminNumberVersions- Minimum versions of a page to always retainmaxNumberVersions- Maximum versions of a page to retain
Incorrectly configured parameters can erase all historical versions of a page, leaving only the current version. This article outlines the correct configurations across different use cases to help you prevent unintended purging.
Description description
Environment
Adobe Experience Manager (AEM)
Issue
Misconfigured version purge OSGi parameters can lead to the deletion of all page versions.
Sample Scenario:
You want to retain 10 versions regardless of age and set the parameters as follows:
maxAgeDays= -1minNumberVersions= 0maxNumberVersions= 10
However, this configuration results in all versions being purged.
Cause
- If the age limit (
maxAgeDays) is set to -1, purging is not performed based on the age of the version. In such cases,minNumberVersionsandmaxNumberVersionsparameters determine which versions to retain. - If
minNumberVersionsis set to 0 (or less than 1), it indicates that all versions can be purged. ThemaxNumberVersionsparameter becomes irrelevant because no age limit is set. - As best practice, always set
minNumberVersionsto greater than 1, regardless of age, unless you explicitly want to purge all versions.
Note: The current version is always retained.
Resolution resolution
To retain 10 versions regardless of age, use the following configuration:
maxAgeDays= -1minNumberVersions= 10maxNumberVersions= 0
In this case, maxNumberVersions is ignored because retention is governed by minNumberVersions.
Refer to version manager in our AEM User Guide for instructions on updating version purge parameters.
Use Cases
Here are a few use cases to review before configuring these parameters to avoid purging all versions of a page.
minNumberVersions is set to 0 (or less than 1), indicating that all versions should be purged.The
maxNumberVersions parameter becomes irrelevant when no age limit is set).minNumberVersions parameter is not specified, all versions are purged because none are within the 10-day limit.If there are 5 versions less than 10 days, 10 versions older than 10 days, and
minNumberVersions=0, five versions are retained.maxNumberVersions in this case either.Even if there were 5 versions less than 10 days, all versions would be purged.
maxNumberVersions parameter becomes irrelevant when no age limit is set.The
maxNumberVersions parameter becomes irrelevant when there are no versions less than or equal to 10 days.If there are 5 versions less than 10 days, 10 versions older than 10 days, and
minNumberVersions=0, only the 5 versions lesser than 10 days are retained.maxNumberVersions parameter is irrelevant in this case.If there are 5 versions less than 10 days, 10 versions older than 10 days, and
minNumberVersions= 0, then 5 versions are retained.minNumberVersionsis set to 5.If there are 25 versions older than 10 days, only the last 5 versions are retained because both min and max are set to 5.
minNumberVersions is set to 5 and maxNumberVersions is set to 10. Here, both min and max parameters are important.