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

Function findFirstInvalidTxn

dgraph/cmd/debug/run.go:230–250  ·  view source on GitHub ↗
(db *badger.DB, lowTs, highTs uint64)

Source from the content-addressed store, hash-verified

228}
229
230func findFirstInvalidTxn(db *badger.DB, lowTs, highTs uint64) uint64 {
231 fmt.Println()
232 if highTs-lowTs < 1 {
233 fmt.Printf("Checking at lowTs: %d\n", lowTs)
234 if total := seekTotal(db, lowTs); total != 100 {
235 fmt.Printf("==> VIOLATION at ts: %d\n", lowTs)
236 return lowTs
237 }
238 fmt.Printf("No violation found at ts: %d\n", lowTs)
239 return 0
240 }
241
242 midTs := (lowTs + highTs) / 2
243 fmt.Printf("Checking. low=%d. high=%d. mid=%d\n", lowTs, highTs, midTs)
244 if total := seekTotal(db, midTs); total == 100 {
245 // If no failure, move to higher ts.
246 return findFirstInvalidTxn(db, midTs+1, highTs)
247 }
248 // Found an error.
249 return findFirstInvalidTxn(db, lowTs, midTs)
250}
251
252func showAllPostingsAt(db *badger.DB, readTs uint64) {
253 txn := db.NewTransactionAt(readTs, false)

Callers 1

jepsenFunction · 0.85

Calls 1

seekTotalFunction · 0.85

Tested by

no test coverage detected