Skip to content

Commit

Permalink
write read txn flag
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelightning committed Jun 17, 2024
1 parent 16c30f5 commit 1f0808a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion memdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
Expand Down

0 comments on commit 1f0808a

Please sign in to comment.