lib/db, lib/syncthing: Don't repair DB on upgrade, but on error (fixes #6917) (#6971)

This commit is contained in:
Simon Frei
2020-09-10 10:54:41 +02:00
committed by GitHub
parent c5c23ed10f
commit 08bebbe59b
9 changed files with 111 additions and 61 deletions
+11 -5
View File
@@ -28,14 +28,16 @@ const (
// leveldbBackend implements Backend on top of a leveldb
type leveldbBackend struct {
ldb *leveldb.DB
closeWG *closeWaitGroup
ldb *leveldb.DB
closeWG *closeWaitGroup
location string
}
func newLeveldbBackend(ldb *leveldb.DB) *leveldbBackend {
func newLeveldbBackend(ldb *leveldb.DB, location string) *leveldbBackend {
return &leveldbBackend{
ldb: ldb,
closeWG: &closeWaitGroup{},
ldb: ldb,
closeWG: &closeWaitGroup{},
location: location,
}
}
@@ -116,6 +118,10 @@ func (b *leveldbBackend) Compact() error {
return wrapLeveldbErr(b.ldb.CompactRange(util.Range{}))
}
func (b *leveldbBackend) Location() string {
return b.location
}
// leveldbSnapshot implements backend.ReadTransaction
type leveldbSnapshot struct {
snap *leveldb.Snapshot