Journaling and crazy journaling test

Implemented journaling. It happens in a background thread (configurable
interval), and on startup (if there are any journal entries). No locking
or weird stuff, and the journaling test passes (if run separately); run
together, the suite fails.