boltdb/bolt — pull request #92 by benbjohnson (2014-03-25 14:53:43+00:00)
Title: Fix DB.Copy() meta lock and partial write checks.

Previously, DB.Copy() did not have the appropriate locks for meta pages or error checking for partial writes.

This pull request adds the following:

1. Uses `metalock` around the copying of the meta pages.

2. Uses `io.CopyN()` to ensure error reporting on partial writes.

Fixes #84.

---

@tv42:

How does this implementation look to you? I looked at the `SectionReader` but thought `CopyN()` would be simpler.

Also, I kept the separate file descriptor since I didn't want to worry about thread safety between the writer transaction and the copy transaction. This just seemed cleaner.