Search code examples
xodus

Xodus: How to open earlier states of the db


As I understand, the Xodus database appends transactions to its Log files, and full .xd files don't change anymore, so the Log files kind of become a record of the transaction history. Is there a way to read out past transactions and/or to open the database in an earlier state?


Solution

  • Right, full .xd files don't change anymore and get read-only attribute unless this is not turned off.

    You can open database on the latest valid snapshot only. At runtime, you can open a read-only transaction and use it as long as you wish. It will hold correspoding database snapshot, database GC will be stopped until the transaction is aborted.

    In future versions, there woould appear an API for opening a read-only transaction by an address of a snapshot in the Log. It will be an unsafe operation, since the snapshot can be incomplete due to database GC. So it would require manual control over the GC.