Search code examples
aemjcr

Is it possible to rollback to a timestamp in the jcr?


I'm wondering if there's something within the JCR that would allow you to take a timestamp snapshot of a JCR instance, so that you can roll back the whole workspace to a particular time.

The driver behind this is when you are doing code deployment, it would allow you to rollback to before deployment state, as using packages only allows you to roll forward.


Solution

  • Under the JCR is the Persistence Manager:

    Persistence Manager: The persistence manager handles storage of the node/property tree that makes up the structure of the repository. This includes the name and position of each node and property in the hierarchy as well as the actual values of the smaller properties (the data store takes care of storing the larger values, see below). The default persistence manager is TarPersistenceManager. By default, it stores its data at crx-quickstart/repository/workspaces/crx.default/.

    If you are using the default Tar persistence manager, it uses a concept of 'journals':

    The journal helps maintains data consistency and helps the system to recover quickly from crashes. In a clustered environment the journal plays the critical role of synchronizing content across cluster instances.

    Both together, allow you to roll back the persistent storage to a relative time ('1 hour ago', actual time ('3pm') or a transaction ID.

    See the documentation here on how to do this. Something that is important to note - you can only roll back to the last time TarOptimization was run (which is usually an operation run once overnight).