lib/db: Don't get blocklists on drop and missing continue (ref #6457) (#6502)

This commit is contained in:
Simon Frei 2020-04-07 13:13:18 +02:00 committed by GitHub
parent 07ce3572a0
commit df318ed370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -406,6 +406,7 @@ func (db *Lowlevel) checkGlobals(folder []byte, meta *metadataTracker) error {
if err := t.Delete(dbi.Key()); err != nil { if err := t.Delete(dbi.Key()); err != nil {
return err return err
} }
continue
} }
// Check the global version list for consistency. An issue in previous // Check the global version list for consistency. An issue in previous
@ -430,7 +431,7 @@ func (db *Lowlevel) checkGlobals(folder []byte, meta *metadataTracker) error {
newVL.Versions = append(newVL.Versions, version) newVL.Versions = append(newVL.Versions, version)
if i == 0 { if i == 0 {
if fi, ok, err := t.getFileByKey(dk); err != nil { if fi, ok, err := t.getFileTrunc(dk, true); err != nil {
return err return err
} else if ok { } else if ok {
meta.addFile(protocol.GlobalDeviceID, fi) meta.addFile(protocol.GlobalDeviceID, fi)

View File

@ -488,7 +488,7 @@ func (t readWriteTransaction) updateGlobal(gk, keyBuf, folder, device []byte, fi
name := []byte(file.Name) name := []byte(file.Name)
var global protocol.FileInfo var global FileIntf
if insertedAt == 0 { if insertedAt == 0 {
// Inserted a new newest version // Inserted a new newest version
global = file global = file
@ -497,7 +497,7 @@ func (t readWriteTransaction) updateGlobal(gk, keyBuf, folder, device []byte, fi
if err != nil { if err != nil {
return nil, false, err return nil, false, err
} }
new, ok, err := t.getFileByKey(keyBuf) new, ok, err := t.getFileTrunc(keyBuf, true)
if err != nil || !ok { if err != nil || !ok {
return keyBuf, false, err return keyBuf, false, err
} }
@ -530,7 +530,7 @@ func (t readWriteTransaction) updateGlobal(gk, keyBuf, folder, device []byte, fi
if err != nil { if err != nil {
return nil, false, err return nil, false, err
} }
oldFile, ok, err := t.getFileByKey(keyBuf) oldFile, ok, err := t.getFileTrunc(keyBuf, true)
if err != nil { if err != nil {
return nil, false, err return nil, false, err
} }
@ -554,7 +554,7 @@ func (t readWriteTransaction) updateGlobal(gk, keyBuf, folder, device []byte, fi
// updateLocalNeed checks whether the given file is still needed on the local // updateLocalNeed checks whether the given file is still needed on the local
// device according to the version list and global FileInfo given and updates // device according to the version list and global FileInfo given and updates
// the db accordingly. // the db accordingly.
func (t readWriteTransaction) updateLocalNeed(keyBuf, folder, name []byte, fl VersionList, global protocol.FileInfo) ([]byte, error) { func (t readWriteTransaction) updateLocalNeed(keyBuf, folder, name []byte, fl VersionList, global FileIntf) ([]byte, error) {
var err error var err error
keyBuf, err = t.keyer.GenerateNeedFileKey(keyBuf, folder, name) keyBuf, err = t.keyer.GenerateNeedFileKey(keyBuf, folder, name)
if err != nil { if err != nil {
@ -631,7 +631,7 @@ func (t readWriteTransaction) removeFromGlobal(gk, keyBuf, folder, device []byte
if err != nil { if err != nil {
return nil, err return nil, err
} }
if f, ok, err := t.getFileByKey(keyBuf); err != nil { if f, ok, err := t.getFileTrunc(keyBuf, true); err != nil {
return nil, err return nil, err
} else if ok { } else if ok {
meta.removeFile(protocol.GlobalDeviceID, f) meta.removeFile(protocol.GlobalDeviceID, f)
@ -657,7 +657,7 @@ func (t readWriteTransaction) removeFromGlobal(gk, keyBuf, folder, device []byte
if err != nil { if err != nil {
return nil, err return nil, err
} }
global, ok, err := t.getFileByKey(keyBuf) global, ok, err := t.getFileTrunc(keyBuf, true)
if err != nil { if err != nil {
return nil, err return nil, err
} }