浏览代码

cmd/syncthing: Don't compact database at startup

This happens automatically in the background anyway, and it can take a
long time on low powered devices at an inconvenient time. We just want
to get up and running as quickly as possible.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3000
Jakob Borg 9 年之前
父节点
当前提交
ccfcdf7f48
共有 2 个文件被更改,包括 0 次插入11 次删除
  1. 0 7
      cmd/syncthing/main.go
  2. 0 4
      lib/db/leveldb_dbinstance.go

+ 0 - 7
cmd/syncthing/main.go

@@ -662,13 +662,6 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
 		}
 	}
 
-	// Pack and optimize the database
-	if err := ldb.Compact(); err != nil {
-		// I don't think this is fatal, but who knows. If it is, we'll surely
-		// get an error when trying to write to the db later.
-		l.Infoln("Compacting database:", err)
-	}
-
 	m := model.NewModel(cfg, myID, myDeviceName(cfg), "syncthing", Version, ldb, protectedFiles)
 	cfg.Subscribe(m)
 

+ 0 - 4
lib/db/leveldb_dbinstance.go

@@ -91,10 +91,6 @@ func newDBInstance(db *leveldb.DB) *Instance {
 	return i
 }
 
-func (db *Instance) Compact() error {
-	return db.CompactRange(util.Range{})
-}
-
 func (db *Instance) genericReplace(folder, device []byte, fs []protocol.FileInfo, localSize, globalSize *sizeTracker, deleteFn deletionHandler) int64 {
 	sort.Sort(fileList(fs)) // sort list on name, same as in the database