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

Function TestTxnTooBig

db_test.go:315–344  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

313}
314
315func TestTxnTooBig(t *testing.T) {
316 runBadgerTest(t, nil, func(t *testing.T, db *DB) {
317 data := func(i int) []byte {
318 return []byte(fmt.Sprintf("%b", i))
319 }
320 // n := 500000
321 n := 1000
322 txn := db.NewTransaction(true)
323 for i := 0; i < n; {
324 if err := txn.SetEntry(NewEntry(data(i), data(i))); err != nil {
325 require.NoError(t, txn.Commit())
326 txn = db.NewTransaction(true)
327 } else {
328 i++
329 }
330 }
331 require.NoError(t, txn.Commit())
332
333 txn = db.NewTransaction(true)
334 for i := 0; i < n; {
335 if err := txn.Delete(data(i)); err != nil {
336 require.NoError(t, txn.Commit())
337 txn = db.NewTransaction(true)
338 } else {
339 i++
340 }
341 }
342 require.NoError(t, txn.Commit())
343 })
344}
345
346func TestForceCompactL0(t *testing.T) {
347 dir, err := ioutil.TempDir("", "badger-test")

Callers

nothing calls this directly

Calls 6

runBadgerTestFunction · 0.85
NewEntryFunction · 0.85
NewTransactionMethod · 0.80
CommitMethod · 0.80
SetEntryMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…