AEM4BEGINNER blog is for Beginners who are interested in learning Adobe Experience Manager (AEM) aka Adobe CQ5 from basics. The Information provided in this blog is for learning and testing purposes only. Here, I have posted the information which I know or gathered from different sources.
In a standard installation, AEM creates a new version of a page or node whenever you activate a page (after updating the content). You can also create additional versions on request using the Versioning tab of the sidekick. All these versions are stored in the repository and can be restored if required.
These versions are never purged, so the repository size will grow over time and therefore need to be managed.
AEM is shipped with various mechanisms to help you manage your repository: the Version Manager This can be configured to purge old versions when new versions are created. the Purge Versions tool This is used as part of monitoring and maintaining your repository. It allows you to intervene to remove old versions of a node, or a hierarchy of nodes, according to these parameters:
The maximum number of versions to be kept in the repository. When this number is exceeded, the oldest version is removed.
The maximum age of any version kept in the repository. When the age of a version exceeds this value, it is purged from the repository.
Version Manager In addition to explicit purging by means of the purge tool, the Version Manager can be configured to purge old versions when new versions are created.
To configure the Version Manager, create a configuration for: PID com.day.cq.wcm.core.impl.VersionManagerImpl
Purge Versions Tool The Purge Versions tool is intended for purging the versions of a node or a hierarchy of nodes in your repository. Its primary purpose is to help you reduce the size of your repository by removing old versions of your nodes. http://localhost:4502/etc/versioning/purge.html
Analyzing the Console The Dry Run and Purge processes list all the nodes that have been processed. During the process, a node can have one of the following states:
ignore (not versionable): the node does not support versioning and is ignored during the process.
ignore (no version): the node does not have any version and is ignored during the process.
retained: the node is not purged.
purged: the node is purged.
Moreover, the console provides useful information about the versions:
V 1.0: the version number.
V 1.0.1*: the star indicates that the version is the current one.
Thu Mar 15 2012 08:37:32 GMT+0100: the date of the version.
In the above screenshot example:
The Shirts versions are purged because their version age is greater than 2 days.
The Tonga Fashions! versions are purged because their number of versions is greater than 5.
Set the start path of the content to be purged (e.g. /content/geometrixx-outdoors). a. If you want to only purge the node defined by your path, unselect Recursively.
b. If you want to purge the node defined by your path and its descendants select Recursively.
Set the maximum number of versions (for each node) that you want to keep. Leave empty to not use this setting.
Set the maximum version age in days (for each node) that you want to keep. Leave empty to not use this setting.
Click Dry Run to preview what the purge process would do.
Click Purge to launch the process.
Caution: Purged nodes can not be reverted without restoring the repository. You should take care of your configuration, so we recommend you to always perform a dry run before purging.
The Purge Version tool is intended for purging the versions of a node or a hierarchy of nodes in your repository. Its primary purpose is to help you reduce the size of your repository by removing old versions of your nodes.
Problem: Over time the Version store /jcr:system/jcr:versionStorage can grow to a considerable size. You see that when: lots of tar files in (CQ5.3): /crx-quickstart/repository/version/copy /crx-quickstart/repository/shared/version large lucene index on: /crx-quickstart/repository/repository/index
This is also helpful when you are upgrading from CQ5.2X to the latest version (As version purging was not enabled in the previous version)
Solution: There are a couple of solution to this, You could enable automatic version purging. See more information here You can also remove the version using the code mention below.
// get version history VersionHistory vh = (VersionHistory) node.getParent().getParent(); // VersionHistory vh = mgr.getVersionHistory(path); String id = vh.getIdentifier();
// get the names of the versions List<String> names = new LinkedList<String>(); VersionIterator vit = vh.getAllVersions(); while (vit.hasNext()) { Version v = vit.nextVersion(); if (!v.getName().equals("jcr:rootVersion")) { names.add(v.getName()); } }
// remove all versions for (String name: names) { vh.removeVersion(name); } } session.logout();