Christoph Kiehl wrote:
AFAIK you should as well backup your index files. We've got a fairly large workspace with about 3,5GB of data. If we just backup the rdbms data and rebuilt the index based on that data it takes some hours. This is unacceptable if you need to recover a production system. Our current solution is to shutdown the repository for a short time start the rdbms backup and copy the index files. When index file copying is finished we startup the repository again, while the rdbms backup is still running (we use oracle which allows you write operations which don't affect the backup data). If you know about a better solution without shutting down the repository in between I would like to hear about it.

If you extend the jackrabbit query handler (o.a.j.core.query.lucene.SearchIndex) you get access to the IndexReader of the index. The returned index reader gives you a snapshot view of the index and will never change even when other sessions continue to write changes to the index. Using the index reader you can then create a new index that is written to the backup location. something along the lines:

IndexReader reader = getIndexReader();
IndexWriter writer = new IndexWriter(
     new File("backup-location"), getTextAnalyzer(), true);
writer.addIndexes(new IndexReader[]{reader});
writer.close();
reader.close();

regards
 marcel

Reply via email to