diff --git a/memdb.go b/memdb.go index ffd7085..e775fb8 100644 --- a/memdb.go +++ b/memdb.go @@ -77,7 +77,7 @@ func (db *MemDB) Txn(write bool) *Txn { txn := &Txn{ db: db, write: write, - rootTxn: db.getRoot().Txn(), + rootTxn: db.getRoot().Txn(write), } return txn } diff --git a/txn.go b/txn.go index dc9dbe0..792360a 100644 --- a/txn.go +++ b/txn.go @@ -70,7 +70,7 @@ func (txn *Txn) readableIndex(table, index string) *adaptive.Txn[any] { // Create a read transaction path := indexPath(table, index) raw, _ := txn.rootTxn.Get(path) - indexTxn := raw.(*adaptive.RadixTree[any]).Txn() + indexTxn := raw.(*adaptive.RadixTree[any]).Txn(false) return indexTxn } @@ -91,7 +91,7 @@ func (txn *Txn) writableIndex(table, index string) *adaptive.Txn[any] { // Start a new transaction path := indexPath(table, index) raw, _ := txn.rootTxn.Get(path) - indexTxn := raw.(*adaptive.RadixTree[any]).Txn() + indexTxn := raw.(*adaptive.RadixTree[any]).Txn(true) // If we are the primary DB, enable mutation tracking. Snapshots should // not notify, otherwise we will trigger watches on the primary DB when