syncthing/lib/model
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
..
testdata lib/fs, lib/model: Make tests caching compatible (fixes #4749) (#4804) 2018-03-13 14:03:10 +01:00
bytesemaphore_test.go lib/model: Allow limiting number of concurrent scans (fixes #2760) (#4888) 2018-12-05 08:40:05 +01:00
bytesemaphore.go lib/model: Don't exit pullerRoutine on cancelled ctx (fixes #6559) (#6562) 2020-04-21 18:55:14 +01:00
debug.go all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02: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
fakeconns_test.go lib/model, lib/protocol: Add contexts sending indexes and download-progress (#6176) 2019-11-25 11:07:36 +01:00
folder_recvonly_test.go lib/model: Handle deleted items on RO for remote removes (fixes #6432) (#6464) 2020-04-02 16:14:25 +02:00
folder_recvonly.go lib/model: Do Revert/Override synchronously (#6460) 2020-03-27 13:05:09 +01:00
folder_sendonly.go lib/model: Do Revert/Override synchronously (#6460) 2020-03-27 13:05:09 +01:00
folder_sendrecv_test.go lib/model: Merge add and start folder funcs and related refactor (#6594) 2020-05-06 08:34:54 +02:00
folder_sendrecv.go lib/model: Improve errors when deleting dirs (fixes #6575) (#6586) 2020-05-01 11:11:38 +02:00
folder_summary.go gui, lib/model: Fix for folder stats with r-o and ignoreDel (fixes #6430) (#6431) 2020-03-22 11:46:42 +01:00
folder_test.go all: Display errors while scanning in web UI (fixes #4480) (#5215) 2018-11-07 11:04:41 +01:00
folder.go lib/protocol: Avoid data loss on database wipe by higher version numbers (fixes #3876) (#6605) 2020-05-06 08:47:02 +02:00
folderstate.go lib/config, lib/model: Limit concurrent pulls (fixes #5914) (#6290) 2020-01-27 17:31:17 +01:00
model_test.go lib/model: Merge add and start folder funcs and related refactor (#6594) 2020-05-06 08:34:54 +02:00
model.go lib/model: Merge add and start folder funcs and related refactor (#6594) 2020-05-06 08:34:54 +02:00
progressemitter_test.go lib/model: Progress emitter network operations dont need to be blocking (#6589) 2020-05-01 08:54:15 +01:00
progressemitter.go lib/model: Progress emitter network operations dont need to be blocking (#6589) 2020-05-01 08:54:15 +01:00
queue_test.go lib/model: Make jobQueue.Jobs paginated (fixes #5754) (#5804) 2019-06-27 19:25:38 +01:00
queue.go lib/model: Make jobQueue.Jobs paginated (fixes #5754) (#5804) 2019-06-27 19:25:38 +01:00
requests_test.go lib/model: Merge add and start folder funcs and related refactor (#6594) 2020-05-06 08:34:54 +02:00
sentdownloadstate.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
sharedpullerstate_test.go lib/model: Use errors.Wrap for pull errors (#5563) 2019-03-04 13:01:52 +00:00
sharedpullerstate.go lib/model: Add option to disable fsync (#6588) 2020-05-01 08:36:46 +01:00
testos_test.go lib/model: Introduce must test utility (#5586) 2019-03-09 18:45:36 +00:00
testutils_test.go lib/model: Merge add and start folder funcs and related refactor (#6594) 2020-05-06 08:34:54 +02:00
util.go all: Remove potentially problematic errors from panics (fixes #5839) (#5912) 2019-07-31 10:53:35 +02:00
utils_test.go all: Remove potentially problematic errors from panics (fixes #5839) (#5912) 2019-07-31 10:53:35 +02:00