Commit 903d4a77 authored by Kevin Atkinson's avatar Kevin Atkinson

Ensure diskUsage is correctly aligned for atomic operations.

parent 12c0c1d2
......@@ -103,6 +103,11 @@ func init() {
// write operations to the same key. See the explanation in
// Put().
type Datastore struct {
// atmoic operations should always be used with diskUsage.
// Must be first in struct to ensure correct alignment
// (see https://golang.org/pkg/sync/atomic/#pkg-note-BUG)
diskUsage int64
path string
shardStr string
......@@ -111,9 +116,6 @@ type Datastore struct {
// sychronize all writes and directory changes for added safety
sync bool
// atmoic operations should always be used with diskUsage
diskUsage int64
// these values should only be used during internalization or
// inside the checkpoint loop
dirty bool
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment