sbtourist/Journal.IO — pull request #13 by krasserm (2012-06-03 13:48:11+00:00)
Title: Fix journal redo and recovery bug

Hi Sergio,

this pull request fixes two issues that I found when using a new Journal instance with existing data files.

- Redo didn't work because the data files weren't linked properly after loading.
- After fixing this linking error I found that the first entry in data files n > 1 cause a checksum error. This is because goToNextLocation(..., ..., boolean true) doesn't behave as recoveryCheck() expected i.e. it doesn't return a batch control record when switching to a new data file which was required by the former recoveryCheck() implementation. Instead it returns the first record after the batch control record which caused recoveryCheck() to compute a wrong checksum. This is now fixed by looping over the data files 'manually' and not via goToNextLocation(...). I initially tried to fix that in goToNextLocation but found that this breaks other existing functionality.

Cheers,
Martin