syncthing/lib/model
Jakob Borg b80da29b23 lib/db: Fix inconsistency in sequence index (fixes #5149) (#5158)
The problem here is that we would update the sequence index before
updating the FileInfos, which would result in a high sequence number
pointing to a low-sequence FileInfo. The index sender would pick up the
high sequence number, send the old file, and think everything was good.
On the receiving side the old file is a no-op and ignored. The file
remains out of sync until another update for it happens.

This fixes that by correcting the order of operations in the database
update: first we remove old sequence index entries, then we update the
FileInfos (which now don't have anything pointing to them) and then we
add the sequence indexes (which the index sender can see).

The other option is to add "proper" transactions where required at the
database layer. I actually have a branch for that, but it's literally
thousands of lines of diff and I'm putting that off for another day as
this solves the problem...
2018-09-02 21:02:28 +02:00
..
testdata lib/fs, lib/model: Make tests caching compatible (fixes #4749) (#4804) 2018-03-13 14:03:10 +01:00
debug.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
deviceactivity_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
deviceactivity.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
devicedownloadstate_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
devicedownloadstate.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
doc.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
folder_recvonly_test.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
folder_recvonly.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
folder_sendonly.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
folder_sendrecv_test.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
folder_sendrecv.go lib/model: Record error for unavailable files (#5066) 2018-07-14 14:09:23 +01:00
folder.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
folderstate.go lib/model, lib/config: Refactor folder health/error handling (fixes #4445, fixes #4451) 2017-10-24 07:58:55 +00:00
model_test.go lib/config: Fix aliased append, copy config inputs and outputs (fixes #5063) (#5069) 2018-07-26 23:14:12 +02:00
model.go lib/db: Fix inconsistency in sequence index (fixes #5149) (#5158) 2018-09-02 21:02:28 +02:00
progressemitter_test.go lib/fs, lib/model: Make tests caching compatible (fixes #4749) (#4804) 2018-03-13 14:03:10 +01:00
progressemitter.go all: Correct various typos 2017-02-25 08:12:13 +00:00
queue_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
queue.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
requests_test.go lib/model: Also handle missing parent dir non-regular items (#5048) 2018-07-10 18:40:06 +03:00
sentdownloadstate.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
sharedpullerstate_test.go lib/model: Remove dead code (*sharedPullerState).sourceFile 2017-12-12 11:30:47 +01:00
sharedpullerstate.go all: Implement variable sized blocks (fixes #4807) 2018-04-16 19:08:50 +01:00
util.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00