How do I recover from "Invalid log entry in replay" when transaction log is being replayed during server start?
Error Condition
A Virtuoso transaction log file may fail to replay, with an error of the form:
11:42:57 Invalid log entry in replay. Delete transaction log virtuoso.trx or truncate at point of error. Valid data may exist after this record. A log record begins with bytes 193 188 5 188 0. Error at offset 13205546 11:42:57 Searching for the next valid header signature starting at 13205547 11:42:57 No valid looking header found. 11:42:57 Server exiting
Resolution of this error varies with the kind of Virtuoso server you're running.
Recovery Methods
Single-Server Deployments of both Open Source and Commercial Edition
WARNING: Do not use this recovery method on Cluster Deployments of Commercial Edition.This can be recovered by truncating to the transaction log to the reported error offset.
Users on Unix-like OS can use the built-in dd
command; Windows users must first install WinDD or cygwin to get the same functionality.
Given the error above, the recovery steps on a Unix-like OS would look like those below.
- Rename the bad
trx
file.
mv virtuoso.trx old.trx
- Use the
dd
to create a truncated copy of the file. Thecount
value should match that shown forError at offset value
.
dd if=old.trx of=new.trx bs=1 count=13205546
Output will look like this.
13205546+0 records in 13205546+0 records out
- Now move the truncated file into place.
mv new.trx virtuoso.trx
- Then restart Virtuoso with the truncated transaction log.
virtuoso-iodbc-t -f
Stopping and restarting Virtuoso as normal should now succeed.