Binary log format and log recovery

This covers a few changes:

1. Switches to a simple binary log format
2. Fixes a bug in log replay, where recovered values would be re-committed to the log
3. Fixes a bug in server startup, where term counters would be reset.