Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ type DB struct {
pageSize int
opened bool
rwtx *Tx
txs []*Tx

freelist fl.Interface
freelistLoad sync.Once
Expand Down Expand Up @@ -801,9 +800,6 @@ func (db *DB) beginTx() (*Tx, error) {
t := &Tx{}
t.init(db)

// Keep track of transaction until it closes.
db.txs = append(db.txs, t)
n := len(db.txs)
if db.freelist != nil {
db.freelist.AddReadonlyTXID(t.meta.Txid())
}
Expand All @@ -814,7 +810,7 @@ func (db *DB) beginTx() (*Tx, error) {
// Update the transaction stats.
db.statlock.Lock()
db.stats.TxN++
db.stats.OpenTxN = n
db.stats.OpenTxN++
db.statlock.Unlock()

return t, nil
Expand Down Expand Up @@ -863,17 +859,6 @@ func (db *DB) removeTx(tx *Tx) {
// Use the meta lock to restrict access to the DB object.
db.metalock.Lock()

// Remove the transaction.
for i, t := range db.txs {
if t == tx {
last := len(db.txs) - 1
db.txs[i] = db.txs[last]
db.txs[last] = nil
db.txs = db.txs[:last]
break
}
}
n := len(db.txs)
if db.freelist != nil {
db.freelist.RemoveReadonlyTXID(tx.meta.Txid())
}
Expand All @@ -883,7 +868,7 @@ func (db *DB) removeTx(tx *Tx) {

// Merge statistics.
db.statlock.Lock()
db.stats.OpenTxN = n
db.stats.OpenTxN--
db.stats.TxStats.add(&tx.stats)
db.statlock.Unlock()
}
Expand Down