boltdb/bolt — pull request #113 by benbjohnson (2014-04-02 23:02:37+00:00)
Title: Add meta page checksums.

## Overview

This pull request adds checksums to the meta pages on every write. When the database loads, it verifies the checksums on the meta pages and returns an error if either one is corrupt.

In the future, it should fallback to the previous meta page but for right now it just hard fails. This is at least preferable to opening the database and getting a random error or further corruption.

## Caveats

The checksum error can be missed if the page size on the first meta page is corrupted. This commit is not meant to be perfect but mostly to just get the checksum in since it's a file format change. Luckily, it ignores "zero" checksums so it's backwards compatible.

---

Fixes #25.