MCPcopy
hub / github.com/dgraph-io/dgraph / getMinMax

Function getMinMax

dgraph/cmd/debug/run.go:316–336  ·  view source on GitHub ↗
(db *badger.DB, readTs uint64)

Source from the content-addressed store, hash-verified

314}
315
316func getMinMax(db *badger.DB, readTs uint64) (uint64, uint64) {
317 var min, max uint64 = math.MaxUint64, 0
318 txn := db.NewTransactionAt(readTs, false)
319 defer txn.Discard()
320
321 iopt := badger.DefaultIteratorOptions
322 iopt.AllVersions = true
323 itr := txn.NewIterator(iopt)
324 defer itr.Close()
325
326 for itr.Rewind(); itr.Valid(); itr.Next() {
327 item := itr.Item()
328 if min > item.Version() {
329 min = item.Version()
330 }
331 if max < item.Version() {
332 max = item.Version()
333 }
334 }
335 return min, max
336}
337
338func jepsen(db *badger.DB) {
339 min, max := getMinMax(db, opt.readTs)

Callers 2

findFirstValidTxnFunction · 0.85
jepsenFunction · 0.85

Calls 5

NewIteratorMethod · 0.80
ValidMethod · 0.80
ItemMethod · 0.80
CloseMethod · 0.65
NextMethod · 0.45

Tested by

no test coverage detected