syncthing/lib
Jakob Borg 744ef0d8ac
lib/protocol: Avoid data loss on database wipe by higher version numbers (fixes #3876) (#6605)
This makes version vector values clock based instead of just incremented
from zero. The effect is that a vector that is created from scratch
(after database reset) will have a higher value for the local device
than what it could have been previously, causing a conflict. That is, if
we are A and we had

    {A: 42, B: 12}

in the old scheme, a reset and rescan would give us

    {A: 1}

which is a strict ancestor of the older file (this might be wrong). With
the new scheme we would instead have

    {A: someClockTime, b: otherClockTime}

and the new version after reset would become

    {A: someClockTime+delta}

which is in conflict with the previous entry (better).
In case the clocks are wrong (current time is less than the value in the
vector) we fall back to just simple increment like today.

This scheme is ineffective if we suffer a database reset while at the
same time setting the clock back far into the past. It's however no
worse than what we already do.

This loses the ability to emit the "added" event, as we can't look for
the magic 1 entry any more. That event was however already broken
(#5541).

Another place where we infer meaning from the vector itself is in
receive only folders, but there the only criteria is that the vector is
one item long and includes just ourselves, which remains the case with
this change.

* wip
2020-05-06 08:47:02 +02:00
..
api lib/api: Add LDAP search filters (fixes #5376) (#6488) 2020-04-04 11:33:43 +02:00
auto build: Let "go generate" create assets 2018-06-26 10:29:36 +02:00
beacon lib/beacon: Only send to appropriately flagged interfaces (ref #5957) (#6404) 2020-03-17 09:40:37 +01:00
build build, lib/build: Build faster (#6538) 2020-04-16 10:09:33 +02:00
config lib/model: Add option to disable fsync (#6588) 2020-05-01 08:36:46 +01:00
connections lib/connections: Update quic (#6591) 2020-05-01 08:14:28 +01:00
db lib/db: Refactor getting global lists (#6529) 2020-05-01 08:30:20 +01:00
dialer lib/dialer: Preserve nilness in error handling (fixes #6368) (#6369) 2020-02-26 13:16:18 +01:00
discover lib: Faster termination on exit (ref #6319) (#6329) 2020-02-13 14:43:00 +01:00
events lib/events, lib/model: Unflake test and prevent deadlock on event unsubscribing (#6261) 2020-01-11 08:14:05 +01:00
fs lib/fs: Avoid dirty offset read in fakefs (fixes #6584) 2020-04-28 09:58:31 +02:00
ignore lib/ignore: Only skip for toplevel includes (fixes #6487) (#6508) 2020-04-07 10:23:38 +02:00
locations cmd/syncthing, lib/locations: Separate data and config dirs (fixes #4924) (#6309) 2020-03-18 20:58:11 +01:00
logger all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
model lib/protocol: Avoid data loss on database wipe by higher version numbers (fixes #3876) (#6605) 2020-05-06 08:47:02 +02:00
nat lib: More contextification (#6343) 2020-02-24 21:57:15 +01:00
osutil lib/osutil: Fix "atomic" rename on Windows (ref #6495, ref #6493) (#6510) 2020-04-07 15:38:55 +02:00
pmp lib: More contextification (#6343) 2020-02-24 21:57:15 +01:00
protocol lib/protocol: Avoid data loss on database wipe by higher version numbers (fixes #3876) (#6605) 2020-05-06 08:47:02 +02:00
rand lib/rand: Various fixes (#6474) 2020-03-30 23:26:28 +02:00
rc lib/protocol, rc, utils: Add mutex Unlock before panic (#6556) 2020-04-20 14:52:16 +02:00
relay cmd/strelaypoolsrv: Expose check error to client, fix incorrect response code handling 2020-04-04 13:31:42 +02:00
scanner lib/ignore: Only skip for toplevel includes (fixes #6487) (#6508) 2020-04-07 10:23:38 +02:00
sha256 all: Remove dead code, fix lost msgLen checks (#6129) 2019-11-06 07:09:58 +01:00
signature all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
stats all: Propagate errors from NamespacedKV (#6203) 2019-11-30 13:03:24 +01:00
stun lib: More contextification (#6343) 2020-02-24 21:57:15 +01:00
sync lib/sync: Cleanly fail instead of panic in tests (#6088) 2019-10-16 10:11:11 +02:00
syncthing lib/db: Make database GC a service, stop on Stop() (#6518) 2020-04-12 10:26:57 +02:00
testutils lib/model, lib/testutils: Test closing a connection on folder restart (#5707) 2019-05-18 08:53:59 +02:00
tlsutil all: Tweak error creation (#6391) 2020-03-03 22:40:00 +01:00
upgrade all: Tweak error creation (#6391) 2020-03-03 22:40:00 +01:00
upnp lib: More contextification (#6343) 2020-02-24 21:57:15 +01:00
ur lib/ur: Correct freaky error handling (fixes #6499) (#6500) 2020-04-06 09:53:37 +02:00
util lib/protocol, rc, utils: Add mutex Unlock before panic (#6556) 2020-04-20 14:52:16 +02:00
versioner lib/versioner: Extended tests of intervals (#6462) 2020-03-31 00:14:05 +02:00
watchaggregator lib: Replace done channel with contexts in and add names to util services (#6166) 2019-11-21 08:41:15 +01:00
weakhash lib/weakhash: Fix speed reporting in benchmark (#6470) 2020-03-29 17:07:25 +02:00