Configuring version purge parameters to avoid erasing all versions in AEM
The OSGi parameters that must be configured for version purging in ÃÛ¶¹ÊÓƵ Experience Manager (AEM) are Maximum number of versions, Minimum Number of versions, and Maximum version age. This article discusses the correct configurations of these parameters across different use cases to help you avoid erasing all versions of a page.
Description description
Environment
ÃÛ¶¹ÊÓƵ Experience Manager (AEM)
Issue/Symptoms
Setting version purge OSGi parameters incorrectly erases all versions of a page.
For instance, you wanted to retain 10 versions regardless of age and set the parameters as below:
maxAgeDays= -1
minNumberVersions= 0
maxNumberVersions= 10
However, this erased all versions instead of retaining the 10 as specified.
Resolution resolution
The correct parameter configuration to retain 10 versions should have been as follows:
maxAgeDays= -1
minNumberVersions= 10
maxNumberVersions= 0
(maxNumberVersions
is irrelevant here if you want 10 versions irrespective of age).
Cause
When the age limit (maxAgeDays
) is set, the minNumberVersions
and maxNumberVersions
parameters are crucial to limit the lower/upper bound.
If the age is set to 0 or -1 and no minNumberVersions
is set, all versions are removed. Therefore, if you wish to retain any number of versions, ensure that minNumberVersions
is always set to greater than 1, regardless of age.
Note: The current version is always retained.
Use Cases
Here are a few use cases to review before configuring your OSGi parameters to avoid purging all versions of a page.
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).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.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.minNumberVersions
is 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.