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 limit
  • minNumberVersions - Minimum versions of a page to always retain
  • maxNumberVersions - 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= -1
minNumberVersions= 0
maxNumberVersions= 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, minNumberVersions and maxNumberVersions parameters determine which versions to retain.
  • If minNumberVersions is set to 0 (or less than 1), it indicates that all versions can be purged. The maxNumberVersions parameter becomes irrelevant because no age limit is set.
  • As best practice, always set minNumberVersions to 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= -1
minNumberVersions= 10
maxNumberVersions= 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.

maxAgeDays
minNumberVersions
maxNumberVersions
Result
-1
0
10
Even if there are 10 versions older than 1 day, this configuration purges all versions. This is because- 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).
10
0
10
If all versions are older than 10 days and the 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.
10
0
0
If all versions are older than 10, all versions are purged because there is no minimum number of versions to be retained. And there is no maxNumberVersions in this case either.

Even if there were 5 versions less than 10 days, all versions would be purged.
-1
-1
10
This setting purgesall versions because there is no minimum number of versions to be retained. The maxNumberVersions parameter becomes irrelevant when no age limit is set.
10
-1
10
If all versions are older than 10 days, all versions are purged because there is no minimum number of versions to be retained.

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.
10
-1
0
If all versions are older than 10 days, all versions are purged because there is no minimum number of versions to be retained. The 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.
10
5
5
If all 5 versions are older than 10 days, all 5 versions are retained because 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.
10
5
10
If there are 5 versions within 10 days and 10 versions older than 10 days (total 15 versions), the last 10 versions are retained because minNumberVersions is set to 5 and maxNumberVersions is set to 10. Here, both min and max parameters are important.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f