syncthing/lib/db
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/db: Add index to track locally needed files (#4958) 2018-06-02 15:08:32 +02:00
.gitignore Change DB label format (index folders, devices) 2016-01-03 19:32:40 +01:00
benchmark_test.go lib/db: Fix prefixed walks (fixes #4925) (#4940) 2018-05-17 09:26:40 +02:00
blockmap_test.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
blockmap.go lib/model: Verify request content against weak (and possibly strong) hash (#4767) 2018-05-05 10:24:44 +02:00
concurrency_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
debug.go lib/db: Fix inconsistency in sequence index (fixes #5149) (#5158) 2018-09-02 21:02:28 +02:00
leveldb_dbinstance_updateschema.go lib/db: Catch unignored/conflicting files as needed (fixes #5053) (#5054) 2018-07-10 18:32:34 +03:00
leveldb_dbinstance.go lib/db: Fix inconsistency in sequence index (fixes #5149) (#5158) 2018-09-02 21:02:28 +02:00
leveldb_test.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
leveldb_transactions.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
leveldb.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
meta_test.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
meta.go lib/db: Don't account remote invalid files (fixes #5089) (#5090) 2018-07-31 13:00:03 +02:00
namespaced_test.go lib/db: Fix test for Go 1.9's smarter time.Time values 2017-06-28 14:36:04 +02:00
namespaced.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
set_test.go lib/db: Fix inconsistency in sequence index (fixes #5149) (#5158) 2018-09-02 21:02:28 +02:00
set.go lib/db: Fix inconsistency in sequence index (fixes #5149) (#5158) 2018-09-02 21:02:28 +02:00
structs.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
structs.pb.go all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
structs.proto all: Add receive only folder type (#5027) 2018-07-12 11:15:57 +03:00
util_test.go lib/db: Add index to track locally needed files (#4958) 2018-06-02 15:08:32 +02:00