Compare commits

..
2 Commits
Author SHA1 Message Date
Jakob BorgandGitHub 6d64daaba3 chore(db): process "unchanged" files anyway (#9755)
Skipping these makes the sequence numbering inconcistent; we've received
a file and suppsedly added it to the database, but if you check the
sequence number afterwards it didn't increase, i.e., we trigger [this
failure
condition](https://github.com/syncthing/syncthing/blob/47f48faed7331b7ba4ad3d6775d5cffacf8931b5/lib/model/indexhandler.go#L447-L459)
and, similarly, a future update will look like there was a hole in the
numbering.

I propose to at least temporarily remove this optimisation in order for
things to make more sense. Is there a reason to keep this beyond saving
some database operations?
2024-10-04 19:47:57 +00:00
Jakob BorgandGitHub 47f48faed7 fix(upgrades): avoid clobbering cache when filtering (#9752)
The slice is shared, can't overwrite elements of it. (Upgrade server
only thing.)
2024-10-02 18:56:39 +00:00
2 changed files with 2 additions and 17 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ func filterForCompabitility(rels []upgrade.Release, ua, osv string) []upgrade.Re
}
os := osArch[1]
filtered := rels[:0]
var filtered []upgrade.Release
for _, rel := range rels {
if rel.Compatibility == nil {
// No requirements means it's compatible with everything.
+1 -16
View File
@@ -159,10 +159,6 @@ func (db *Lowlevel) updateRemoteFiles(folder, device []byte, fs []protocol.FileI
if err != nil {
return err
}
if ok && unchanged(f, ef) {
l.Debugf("not inserting unchanged (remote); folder=%q device=%v %v", folder, devID, f)
continue
}
if ok {
meta.removeFile(devID, ef)
@@ -216,12 +212,8 @@ func (db *Lowlevel) updateLocalFiles(folder []byte, fs []protocol.FileInfo, meta
if err != nil {
return err
}
if ok && unchanged(f, ef) {
l.Debugf("not inserting unchanged (local); folder=%q %v", folder, f)
continue
}
blocksHashSame := ok && bytes.Equal(ef.BlocksHash, f.BlocksHash)
blocksHashSame := ok && bytes.Equal(ef.BlocksHash, f.BlocksHash)
if ok {
keyBuf, err = db.removeLocalBlockAndSequenceInfo(keyBuf, folder, name, ef, !blocksHashSame, &t)
if err != nil {
@@ -1443,13 +1435,6 @@ func (db *Lowlevel) checkErrorForRepair(err error) {
}
}
// unchanged checks if two files are the same and thus don't need to be updated.
// Local flags or the invalid bit might change without the version
// being bumped.
func unchanged(nf, ef protocol.FileIntf) bool {
return ef.FileVersion().Equal(nf.FileVersion()) && ef.IsInvalid() == nf.IsInvalid() && ef.FileLocalFlags() == nf.FileLocalFlags()
}
func (db *Lowlevel) handleFailure(err error) {
db.checkErrorForRepair(err)
if shouldReportFailure(err) {