File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,6 @@ type DB struct {
132132 pageSize int
133133 opened bool
134134 rwtx * Tx
135- txs []* Tx
136135
137136 freelist fl.Interface
138137 freelistLoad sync.Once
@@ -794,9 +793,6 @@ func (db *DB) beginTx() (*Tx, error) {
794793 t := & Tx {}
795794 t .init (db )
796795
797- // Keep track of transaction until it closes.
798- db .txs = append (db .txs , t )
799- n := len (db .txs )
800796 if db .freelist != nil {
801797 db .freelist .AddReadonlyTXID (t .meta .Txid ())
802798 }
@@ -807,7 +803,7 @@ func (db *DB) beginTx() (*Tx, error) {
807803 // Update the transaction stats.
808804 db .statlock .Lock ()
809805 db .stats .TxN ++
810- db .stats .OpenTxN = n
806+ db .stats .OpenTxN ++
811807 db .statlock .Unlock ()
812808
813809 return t , nil
@@ -856,17 +852,6 @@ func (db *DB) removeTx(tx *Tx) {
856852 // Use the meta lock to restrict access to the DB object.
857853 db .metalock .Lock ()
858854
859- // Remove the transaction.
860- for i , t := range db .txs {
861- if t == tx {
862- last := len (db .txs ) - 1
863- db .txs [i ] = db .txs [last ]
864- db .txs [last ] = nil
865- db .txs = db .txs [:last ]
866- break
867- }
868- }
869- n := len (db .txs )
870855 if db .freelist != nil {
871856 db .freelist .RemoveReadonlyTXID (tx .meta .Txid ())
872857 }
@@ -876,7 +861,7 @@ func (db *DB) removeTx(tx *Tx) {
876861
877862 // Merge statistics.
878863 db .statlock .Lock ()
879- db .stats .OpenTxN = n
864+ db .stats .OpenTxN --
880865 db .stats .TxStats .add (& tx .stats )
881866 db .statlock .Unlock ()
882867}
You can’t perform that action at this time.
0 commit comments