Forráskód Böngészése

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.
Jakob Borg 5 éve
szülő
commit
7892547873
4 módosított fájl, 1 hozzáadás és 23 törlés
  1. 0 1
      lib/build/build.go
  2. 1 11
      lib/db/backend/backend.go
  3. 0 6
      lib/db/db_test.go
  4. 0 5
      lib/locations/locations.go

+ 0 - 1
lib/build/build.go

@@ -43,7 +43,6 @@ var (
 		"STHASHING",
 		"STNORESTART",
 		"STNOUPGRADE",
-		"USE_BADGER",
 	}
 )
 

+ 1 - 11
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()
 }
 

+ 0 - 6
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()
 

+ 0 - 5
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