lib/db: Remove updated invalid files from need bucket (fixes #5007) (#5008)

This commit is contained in:
Simon Frei
2018-06-18 08:23:40 +02:00
committed by Jakob Borg
parent 8ff7ceeddc
commit c2784d76e4
4 changed files with 93 additions and 4 deletions

View File

@@ -97,14 +97,18 @@ func (t readWriteTransaction) updateGlobal(gk, folder, device []byte, file proto
return false
}
name := []byte(file.Name)
if removedAt != 0 && insertedAt != 0 {
if bytes.Equal(device, protocol.LocalDeviceID[:]) && file.Version.Equal(fl.Versions[0].Version) {
l.Debugf("local need delete; folder=%q, name=%q", folder, name)
t.Delete(t.db.needKey(folder, name))
}
l.Debugf(`new global for "%v" after update: %v`, file.Name, fl)
t.Put(gk, mustMarshal(&fl))
return true
}
name := []byte(file.Name)
// Remove the old global from the global size counter
var oldGlobalFV FileVersion
if removedAt == 0 {