From 7892547873c805ef4066f68ea1097d083a759725 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 3 Nov 2020 09:10:35 +0100 Subject: [PATCH] lib: Remove USE_BADGER experiment (#7089) This removes the switch for using a Badger database, because it has bugs that it seems there is no interest in fixing, and no actual bug tracker to track them in. It retains the actual implementation for the sole purpose of being able to do the conversion back to LevelDB if anyone is actually running with USE_BADGER. At some point in a couple of versions we can remove the implementation as well. --- lib/build/build.go | 1 - lib/db/backend/backend.go | 12 +----------- lib/db/db_test.go | 6 ------ lib/locations/locations.go | 5 ----- 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/lib/build/build.go b/lib/build/build.go index 5c8d7c336..69a509b21 100644 --- a/lib/build/build.go +++ b/lib/build/build.go @@ -43,7 +43,6 @@ var ( "STHASHING", "STNORESTART", "STNOUPGRADE", - "USE_BADGER", } ) diff --git a/lib/db/backend/backend.go b/lib/db/backend/backend.go index 2cdeaf498..4a29a79cc 100644 --- a/lib/db/backend/backend.go +++ b/lib/db/backend/backend.go @@ -131,24 +131,14 @@ const ( ) func Open(path string, tuning Tuning) (Backend, error) { - if os.Getenv("USE_BADGER") != "" { - l.Warnln("Using experimental badger db") - if err := maybeCopyDatabase(path, strings.Replace(path, locations.BadgerDir, locations.LevelDBDir, 1), OpenBadger, OpenLevelDBRO); err != nil { - return nil, err - } - return OpenBadger(path) - } - if err := maybeCopyDatabase(path, strings.Replace(path, locations.LevelDBDir, locations.BadgerDir, 1), OpenLevelDBAuto, OpenBadger); err != nil { return nil, err } + return OpenLevelDB(path, tuning) } func OpenMemory() Backend { - if os.Getenv("USE_BADGER") != "" { - return OpenBadgerMemory() - } return OpenLevelDBMemory() } diff --git a/lib/db/db_test.go b/lib/db/db_test.go index 2c32d422b..07c2ae7bc 100644 --- a/lib/db/db_test.go +++ b/lib/db/db_test.go @@ -10,7 +10,6 @@ import ( "bytes" "context" "fmt" - "os" "testing" "github.com/syncthing/syncthing/lib/db/backend" @@ -801,11 +800,6 @@ func TestFlushRecursion(t *testing.T) { // Verify that a commit hook can write to the transaction without // causing another flush and thus recursion. - // Badger doesn't work like this. - if os.Getenv("USE_BADGER") != "" { - t.Skip("Not supported on Badger") - } - db := NewLowlevel(backend.OpenMemory()) defer db.Close() diff --git a/lib/locations/locations.go b/lib/locations/locations.go index 702683f26..8e0e69ec8 100644 --- a/lib/locations/locations.go +++ b/lib/locations/locations.go @@ -53,11 +53,6 @@ const ( var baseDirs = make(map[BaseDirEnum]string, 3) func init() { - if os.Getenv("USE_BADGER") != "" { - // XXX: Replace the leveldb name with the badger name. - locationTemplates[Database] = strings.Replace(locationTemplates[Database], LevelDBDir, BadgerDir, 1) - } - userHome := userHomeDir() config := defaultConfigDir(userHome) baseDirs[UserHomeBaseDir] = userHome