Transactional Store Crash Recovery

Abstract: Transactional Store Crash Recovery

  My machine crashed, can I recover the data from a transactional store?

Crash recovery is automatic. The system should automatically recover (when it is reopened) from all failures except media failures. You can prevent the automatic recovery by wiring the DataStore.ResponsEvent.

A media failure in the database file itself (*.jds) could be recovered if:
  1. There is a backup copy of the .jds file.
  2. All the log files that were created since the .jds file was backed up are archived.
The DataStore.ResponseEvent sends out notifications when it is about to drop logfiles that are not needed for active transactions or for system crash recovery. This means the DataStore.ResponseEvent can be wired up such that old log files are archived off. In this case you are implementing a log archive manager for a DataStore.

Since JDataStore is a low administration embeddable database, it is mostly focussed on automatic recovery of the more common failures like:
  • abnormal application termination
  • operating system crash
  • power failure.
Recovery from damaged media can be accomplished, but requires more administration.

If a DataStore is not transactional or some log files are lost, you can:
  1. Open the DataStore in readOnly mode (this allows even a transactional store to be opened even though its log files are missing.
  2. Use the DataStoreConnection.copyStreams() method to copy the contents to a new DataStore. copyStreams() has an option to ignore errors encountered reading the source DataStore.
DataStore Explorer will help you in performing both of these tasks.

You can dump the contents of a txlog by calling DataStoreConnection.dumpTxLog(). Its mostly for auditing purposes. It was actually added to debug - it is the whole history with user names and time stamps.