From dd01ab6dc08ccf331799bdfc8f472ba156e1052e Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 9 Mar 2016 11:17:27 -0800 Subject: [PATCH] storage/backend: align fields used for atomic ops Fixes crashes on 32-bit tests. --- storage/backend/backend.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/storage/backend/backend.go b/storage/backend/backend.go index 097375d70..e81759056 100644 --- a/storage/backend/backend.go +++ b/storage/backend/backend.go @@ -62,16 +62,20 @@ type Snapshot interface { } type backend struct { + // size and commits are used with atomic operations so they must be + // 64-bit aligned, otherwise 32-bit tests will crash + + // size is the number of bytes in the backend + size int64 + // commits counts number of commits since start + commits int64 + mu sync.RWMutex db *bolt.DB batchInterval time.Duration batchLimit int batchTx *batchTx - size int64 - - // number of commits since start - commits int64 stopc chan struct{} donec chan struct{}