lib/db, lib/model: Cover exec-paths with debug logging (#6918)

This commit is contained in:
Simon Frei 2020-08-20 16:11:20 +02:00 committed by GitHub
parent f79e980fdf
commit cc1f6e4d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -140,6 +140,7 @@ func (db *Lowlevel) updateRemoteFiles(folder, device []byte, fs []protocol.FileI
return err return err
} }
if ok && unchanged(f, ef) { if ok && unchanged(f, ef) {
l.Debugf("not inserting unchanged (remote); folder=%q device=%v %v", folder, devID, f)
continue continue
} }
@ -148,7 +149,7 @@ func (db *Lowlevel) updateRemoteFiles(folder, device []byte, fs []protocol.FileI
} }
meta.addFile(devID, f) meta.addFile(devID, f)
l.Debugf("insert; folder=%q device=%v %v", folder, devID, f) l.Debugf("insert (remote); folder=%q device=%v %v", folder, devID, f)
if err := t.putFile(dk, f); err != nil { if err := t.putFile(dk, f); err != nil {
return err return err
} }
@ -196,6 +197,7 @@ func (db *Lowlevel) updateLocalFiles(folder []byte, fs []protocol.FileInfo, meta
return err return err
} }
if ok && unchanged(f, ef) { if ok && unchanged(f, ef) {
l.Debugf("not inserting unchanged (local); folder=%q %v", folder, f)
continue continue
} }
blocksHashSame := ok && bytes.Equal(ef.BlocksHash, f.BlocksHash) blocksHashSame := ok && bytes.Equal(ef.BlocksHash, f.BlocksHash)

View File

@ -628,17 +628,20 @@ func (f *folder) scanSubdirs(subDirs []string) error {
if f.localFlags&protocol.FlagLocalReceiveOnly != 0 && len(snap.Availability(file.Name)) == 0 { if f.localFlags&protocol.FlagLocalReceiveOnly != 0 && len(snap.Availability(file.Name)) == 0 {
file.LocalFlags &^= protocol.FlagLocalReceiveOnly file.LocalFlags &^= protocol.FlagLocalReceiveOnly
} }
l.Debugln("marking file as deleted", nf)
batchAppend(nf, snap) batchAppend(nf, snap)
changes++ changes++
case file.IsDeleted() && file.IsReceiveOnlyChanged() && f.localFlags&protocol.FlagLocalReceiveOnly != 0 && len(snap.Availability(file.Name)) == 0: case file.IsDeleted() && file.IsReceiveOnlyChanged() && f.localFlags&protocol.FlagLocalReceiveOnly != 0 && len(snap.Availability(file.Name)) == 0:
file.Version = protocol.Vector{} file.Version = protocol.Vector{}
file.LocalFlags &^= protocol.FlagLocalReceiveOnly file.LocalFlags &^= protocol.FlagLocalReceiveOnly
l.Debugln("marking deleted item that doesn't exist anywhere as not receive-only", file)
batchAppend(file.ConvertDeletedToFileInfo(), snap) batchAppend(file.ConvertDeletedToFileInfo(), snap)
changes++ changes++
case file.IsDeleted() && file.LocalFlags != f.localFlags: case file.IsDeleted() && file.LocalFlags != f.localFlags:
// No need to bump the version for a file that was // No need to bump the version for a file that was
// and is deleted and just the local flags changed. // and is deleted and just the local flags changed.
file.LocalFlags = f.localFlags file.LocalFlags = f.localFlags
l.Debugln("changing localflags on deleted item", file)
batchAppend(file.ConvertDeletedToFileInfo(), snap) batchAppend(file.ConvertDeletedToFileInfo(), snap)
changes++ changes++
} }