removeTx removes a transaction from the database.
(tx *Tx)
| 873 | |
| 874 | // removeTx removes a transaction from the database. |
| 875 | func (db *DB) removeTx(tx *Tx) { |
| 876 | // Release the read lock on the mmap. |
| 877 | db.mmaplock.RUnlock() |
| 878 | |
| 879 | // Use the meta lock to restrict access to the DB object. |
| 880 | db.metalock.Lock() |
| 881 | |
| 882 | if db.freelist != nil { |
| 883 | db.freelist.RemoveReadonlyTXID(tx.meta.Txid()) |
| 884 | } |
| 885 | |
| 886 | // Unlock the meta pages. |
| 887 | db.metalock.Unlock() |
| 888 | |
| 889 | // Merge statistics. |
| 890 | if db.stats != nil { |
| 891 | db.statlock.Lock() |
| 892 | db.stats.OpenTxN-- |
| 893 | db.stats.TxStats.add(&tx.stats) |
| 894 | db.statlock.Unlock() |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | // Update executes a function within the context of a read-write managed transaction. |
| 899 | // If no error is returned from the function then the transaction is committed. |
no test coverage detected