diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2016-01-11 14:47:01 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2016-01-11 14:47:01 -0700 |
commit | 694a82a9595845d376dd19ff5c24cab78801204b (patch) | |
tree | 19c30005f6e3c46c78eb582e9f28f8af81d24d10 /tx.go | |
parent | Merge pull request #479 from azazeal/master (diff) | |
parent | do not grow dbsize agressively (diff) | |
download | dedo-694a82a9595845d376dd19ff5c24cab78801204b.tar.gz dedo-694a82a9595845d376dd19ff5c24cab78801204b.tar.xz |
Merge branch 'grow' of https://github.com/xiang90/bolt into xiang90-grow
Diffstat (limited to 'tx.go')
-rw-r--r-- | tx.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -168,6 +168,8 @@ func (tx *Tx) Commit() error { // Free the old root bucket. tx.meta.root.root = tx.root.root + opgid := tx.meta.pgid + // 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). tx.db.freelist.free(tx.meta.txid, tx.db.page(tx.meta.freelist)) @@ -182,6 +184,10 @@ func (tx *Tx) Commit() error { } tx.meta.freelist = p.id + if tx.meta.pgid > opgid { + tx.db.growSize(int(tx.meta.pgid+1) * tx.db.pageSize) + } + // Write dirty pages to disk. startTime = time.Now() if err := tx.write(); err != nil { |