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

Function findFirstValidTxn

dgraph/cmd/debug/run.go:208–228  ·  view source on GitHub ↗
(db *badger.DB)

Source from the content-addressed store, hash-verified

206}
207
208func findFirstValidTxn(db *badger.DB) uint64 {
209 readTs := opt.readTs
210 var wrong uint64
211 for {
212 min, max := getMinMax(db, readTs-1)
213 if max <= min {
214 fmt.Printf("Can't find it. Max: %d\n", max)
215 return 0
216 }
217 readTs = max
218 if total := seekTotal(db, readTs); total != 100 {
219 fmt.Printf("===> VIOLATION at ts: %d\n", readTs)
220 showAllPostingsAt(db, readTs)
221 wrong = readTs
222 } else {
223 fmt.Printf("===> Found first correct version at %d\n", readTs)
224 showAllPostingsAt(db, readTs)
225 return wrong
226 }
227 }
228}
229
230func findFirstInvalidTxn(db *badger.DB, lowTs, highTs uint64) uint64 {
231 fmt.Println()

Callers 1

jepsenFunction · 0.85

Calls 3

getMinMaxFunction · 0.85
seekTotalFunction · 0.85
showAllPostingsAtFunction · 0.85

Tested by

no test coverage detected