From 9cec891c2502c3d67013ea9014d93f7fe37c555e Mon Sep 17 00:00:00 2001
From: Mark Felder <feld@feld.me>
Date: Thu, 25 Aug 2022 22:32:31 +0000
Subject: [PATCH] Fix garbage collection

We were opening the database and telling it to keep infinite copies by not defining a value.
---
 plugin/plugins/badger2ds/badger2ds.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugin/plugins/badger2ds/badger2ds.go b/plugin/plugins/badger2ds/badger2ds.go
index 73db6a7d04a7..b25f126868e8 100644
--- a/plugin/plugins/badger2ds/badger2ds.go
+++ b/plugin/plugins/badger2ds/badger2ds.go
@@ -179,6 +179,7 @@ func (c *datastoreConfig) Create(path string) (repo.Datastore, error) {
 	defopts.ZSTDCompressionLevel = c.zstdCompressionLevel
 	defopts.BlockCacheSize = c.blockCacheSize
 	defopts.ValueLogFileSize = c.vlogFileSize
+	defopts.NumVersionsToKeep = 1
 
 	return badger2ds.NewDatastore(p, &defopts)
 }