We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest v4
1.20.3
Yes
16gb ram, i5 intel, mac os
package main import ( "fmt" "log" "math/rand" "strconv" "time" "github.com/dgraph-io/badger/v4" ) var db *badger.DB const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" func generateRandomString(length int) string { b := make([]byte, length) for i := range b { b[i] = charset[rand.Intn(len(charset))] } return string(b) } func main() { opts := badger.DefaultOptions("badger") opts.ValueLogFileSize = 1 << 20 var err error db, err = badger.Open(opts) if err != nil { log.Fatal(err) } defer db.Close() fmt.Println("Start inserting 5 million items.") for i := 0; i < 5_000_000; i++ { err := db.Update(func(txn *badger.Txn) error { key := strconv.Itoa(i) value := []byte(generateRandomString(300)) e := badger.NewEntry([]byte(key), value).WithTTL(30 * time.Second) err := txn.SetEntry(e) if err != nil { return err } return nil }) if err != nil { log.Fatal("Error while inserting:", err) } } fmt.Println("Successfully inserted 5 million items.") startGarbageCollection() } func startGarbageCollection() { ticker := time.NewTicker(10 * time.Second) defer ticker.Stop() for range ticker.C { again: err := db.RunValueLogGC(0.01) fmt.Println(err) if err == nil { goto again } } }
Since the keys are expiring in 30 seconds, I thought that the files in badger/ would get removed.
However, heres what I see:
No response
The text was updated successfully, but these errors were encountered:
may be related to #1995. Thanks for filling an issue with code to reproduce. I will try to find some time to look into it.
Sorry, something went wrong.
Maybe the compaction is not triggered. Similar to https://discuss.dgraph.io/t/gc-may-not-work-in-some-cases/17197
Hi Friends. Any updates on this? Ty
No branches or pull requests
What version of Badger are you using?
Latest v4
What version of Go are you using?
1.20.3
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, CPU, OS)?
16gb ram, i5 intel, mac os
What steps will reproduce the bug?
Expected behavior and actual result.
Since the keys are expiring in 30 seconds, I thought that the files in badger/ would get removed.
However, heres what I see:
Additional information
No response
The text was updated successfully, but these errors were encountered: