diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2015-02-02 08:27:34 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2015-02-02 08:27:34 -0700 |
commit | ac1149a3f50e5b74f5c7129f26039af0f14807bb (patch) | |
tree | 77171972193974206272a59b89140ef048c3a7f1 /bucket.go | |
parent | Merge pull request #294 from benbjohnson/assert (diff) | |
download | dedo-ac1149a3f50e5b74f5c7129f26039af0f14807bb.tar.gz dedo-ac1149a3f50e5b74f5c7129f26039af0f14807bb.tar.xz |
Persist sequence-only changes.
This commit fixes a bug where only calling NextSequence() on a Bucket does not cause the Bucket to be
peristed. The simple fix is to simply materialize the root node so that the bucket is flushed out
during commit.
Thanks to Matthew Dawson (@MJDSys) for reporting.
https://github.com/boltdb/bolt/issues/296
Diffstat (limited to 'bucket.go')
-rw-r--r-- | bucket.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -332,6 +332,12 @@ func (b *Bucket) NextSequence() (uint64, error) { return 0, ErrTxNotWritable } + // Materialize the root node if it hasn't been already so that the + // bucket will be saved during commit. + if b.rootNode == nil { + _ = b.node(b.root, nil) + } + // Increment and return the sequence. b.bucket.sequence++ return b.bucket.sequence, nil |