MCPcopy
hub / github.com/dgraph-io/badger / NewTransaction

Method NewTransaction

txn.go:759–761  ·  view source on GitHub ↗

NewTransaction creates a new transaction. Badger supports concurrent execution of transactions, providing serializable snapshot isolation, avoiding write skews. Badger achieves this by tracking the keys read and at Commit time, ensuring that these read keys weren't concurrently modified by another t

(update bool)

Source from the content-addressed store, hash-verified

757// defer txn.Discard()
758// // Call various APIs.
759func (db *DB) NewTransaction(update bool) *Txn {
760 return db.newTransaction(update, false)
761}
762
763func (db *DB) newTransaction(update, isManaged bool) *Txn {
764 if db.opt.ReadOnly && update {

Callers 15

ViewMethod · 0.95
UpdateMethod · 0.95
buildHistogramMethod · 0.95
produceKVsMethod · 0.80
iterateAndMergeMethod · 0.80
txnSetFunction · 0.80
txnDeleteFunction · 0.80
TestConcurrentWriteFunction · 0.80
TestGetFunction · 0.80
TestTxnTooBigFunction · 0.80

Calls 1

newTransactionMethod · 0.95

Tested by 15

txnSetFunction · 0.64
txnDeleteFunction · 0.64
TestConcurrentWriteFunction · 0.64
TestGetFunction · 0.64
TestTxnTooBigFunction · 0.64
BenchmarkDbGrowthFunction · 0.64
TestGetMoreFunction · 0.64
TestExistsMoreFunction · 0.64
TestIterate2BasicFunction · 0.64
TestIterateDeletedFunction · 0.64