ModeShape/modeshape — pull request #473 by rhauch (2012-08-10 20:52:27+00:00)
Title: MODE-1581 Added support for backing up and restoring repositories

Introduced a new facility for backing up an entire repository to files on the file system. The backup process writes the JSON representation of each node's content (up to 100K JSON documents per compressed backup file) and writes out the binary content (one file per binary value, named with the value's SHA1). The process also listens for changes made to the repository during the time the backup process is running, and writes the JSON representations of each of the nodes changed during that time - this means that backups can be performed while the repository is still in use (although backing up a repository for migration should only be done on a repository that is not being used). The result should be a consistent backup of a repository's entire content.

It is also possible to restore a repository to the state represented in a backup. This destroys all existing repository content, adds all of the nodes and binary values in the backup, restarts the repository, and reindexes all content in the repository.

Note that there still may be issues with how we're getting accessing all of the keys in the Infinispan cache. This has been encapsulated in the InfinispanUtil class, and can be improved over time. (At this point, Infinispan only supports using distributed execution on clustered caches; see https://issues.jboss.org/browse/ISPN-2192 for an enhancement request to allow using distributed execution on all caches. Additionally, there are limitations for local caches, though InfinispanUtil attempts to work around these limitations).