diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2015-09-04 13:07:06 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2015-09-04 13:07:06 -0600 |
commit | 4c92e3fa226b34f724eab2484c7e576a6556c1b9 (patch) | |
tree | 88a58139fe7a8b56ee3213af19c1594f44a64bf7 | |
parent | Merge sorted pgids rather than resorting everything (diff) | |
download | dedo-4c92e3fa226b34f724eab2484c7e576a6556c1b9.tar.gz dedo-4c92e3fa226b34f724eab2484c7e576a6556c1b9.tar.xz |
release read-write tx after close
This commit removes references to the last write transaction and
and its dirty pages after the transaction has been closed. This
bug did not affect the safety of the data, however, it would
cause dirty pages to linger in-memory until the next write
transaction began.
-rw-r--r-- | tx.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -236,7 +236,8 @@ func (tx *Tx) close() { var freelistPendingN = tx.db.freelist.pending_count() var freelistAlloc = tx.db.freelist.size() - // Remove writer lock. + // Remove transaction ref & writer lock. + tx.db.rwtx = nil tx.db.rwlock.Unlock() // Merge statistics. @@ -250,7 +251,12 @@ func (tx *Tx) close() { } else { tx.db.removeTx(tx) } + + // Clear all references. tx.db = nil + tx.meta = nil + tx.root = Bucket{tx: tx} + tx.pages = nil } // Copy writes the entire database to a writer. |