diff options
| author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-31 08:52:13 -0600 |
|---|---|---|
| committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-31 08:52:19 -0600 |
| commit | 440b89418f5907099cf06764ad7f2b83cf12fbcf (patch) | |
| tree | 6b0b06f7fc1ca4c4799ebb480961ed297bf9667b /tx.go | |
| parent | Merge pull request #98 from benbjohnson/fsck (diff) | |
| download | dedo-440b89418f5907099cf06764ad7f2b83cf12fbcf.tar.gz dedo-440b89418f5907099cf06764ad7f2b83cf12fbcf.tar.xz | |
Write freelist after each commit.
Well, this is embarassing. Somehow the freelist was never getting written after each commit.
This commit fixes that and fixes a small reporting issue with "bolt pages".
Diffstat (limited to 'tx.go')
| -rw-r--r-- | tx.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -199,6 +199,16 @@ func (t *Tx) Commit() error { t.db.freelist.free(t.id(), t.page(t.meta.buckets)) t.meta.buckets = p.id + // Free the freelist and allocate new pages for it. This will overestimate + // the size of the freelist but not underestimate the size (which would be bad). + t.db.freelist.free(t.id(), t.page(t.meta.freelist)) + p, err = t.allocate((t.db.freelist.size() / t.db.pageSize) + 1) + if err != nil { + return err + } + t.db.freelist.write(p) + t.meta.freelist = p.id + // Write dirty pages to disk. if err := t.write(); err != nil { return err |
