Vlog files becoming really big, GC returning "Value log GC attempt didn't result in any cleanup"

Hello, I have about 50-100 keys whose values constantly update, resulting in these few keys eventually taking up multiple GB’s of storage when around 10MB should be enough.

I have tried to add the following func as recommended by the README file:

func badgerGC() {
	ticker := time.NewTicker(5 * time.Minute)
	defer ticker.Stop()
	for range ticker.C {
		err := badgerDB.RunValueLogGC(0.5)
		if err == nil {
			goto again

I have also tried to set RunValueLogGC to other values within the range, such as 0.0, 0.1, 0.7, etc. But it always return: Value log GC attempt didn't result in any cleanup.

Any help would be much appreciated (:

Value log GC would only clean up files if there are multiple log files, and they can be cleaned given the threshold. The latest log file is never deleted or rewritten.

Anyway, this behavior should improve with the upcoming release. I’ve made changes in Badger, which result in better and smoother GC behavior.

1 Like

Alright thanks, would the upcoming release help resolve this automatically?

And is there anything I can do now?

Hi Manish,

Is this value log GC enhancement available in master branch ? If not, is it there in a branch that i can try out and see. ?


master contains everything Badger has.