lib/db: Use different defaults for larger databases (fixes #5966) (#5967)

This introduces a better set of defaults for large databases. I've
experimentally determined that it results in much better throughput in a
couple of scenarios with large databases, but I can't give any
guarantees the values are always optimal. They're probably no worse than
the defaults though.
This commit is contained in:
Jakob Borg
2019-08-20 09:41:41 +02:00
committed by Simon Frei
parent e910acdc17
commit 90b70c7a16
7 changed files with 174 additions and 18 deletions

View File

@@ -491,7 +491,7 @@ func checkUpgrade() upgrade.Release {
func performUpgrade(release upgrade.Release) {
// Use leveldb database locks to protect against concurrent upgrades
_, err := syncthing.OpenGoleveldb(locations.Get(locations.Database))
_, err := syncthing.OpenGoleveldb(locations.Get(locations.Database), config.TuningAuto)
if err == nil {
err = upgrade.To(release)
if err != nil {
@@ -583,7 +583,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
}
dbFile := locations.Get(locations.Database)
ldb, err := syncthing.OpenGoleveldb(dbFile)
ldb, err := syncthing.OpenGoleveldb(dbFile, cfg.Options().DatabaseTuning)
if err != nil {
l.Warnln("Error opening database:", err)
os.Exit(1)