syncthing/lib/db
Jakob Borg 488444354b lib/db: Don't panic
So, when first implementing the database layer I added panics on every
unexpected error condition mostly to be sure to flush out bugs and
inconsistencies. Then it became sort of standard, and we don't seem to
have many bugs here any more so the panics are usually caused by things
like checksum errors on read. But it's not an optimal user experience to
crash all the time.

Here I've weeded out most of the panics, while retaining a few "can't
happen" ones like errors on marshalling and write that we really can't
recover from.

For the rest, I'm mostly treating any read error as "entry didn't
exist". This should mean we'll rescan the file and correct the info (if
scanning) or treat it as a new file and do conflict handling (when
pulling). In some cases things like our global stats may be slightly
incorrect until a restart, if a database entry goes suddenly missing
during runtime.

All in all, I think this makes us a bit more robust and friendly without
introducing too many risks for the user. If the database is truly toast,
probably many other things on the system will be toast as well...

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4118
2017-04-25 22:52:37 +00:00
..
testdata lib/protocol, lib/discover, lib/db: Use protocol buffer serialization (fixes #3080) 2016-07-04 10:40:29 +00:00
.gitignore Change DB label format (index folders, devices) 2016-01-03 19:32:40 +01:00
benchmark_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
blockmap_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
blockmap.go lib/db, lib/model: Always use reasonable sized batches (fixes #2250, fixes #4112) 2017-04-22 14:23:33 +00:00
concurrency_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
debug.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
leveldb_dbinstance.go lib/db: Don't panic 2017-04-25 22:52:37 +00:00
leveldb_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
leveldb_transactions.go lib/db: Don't panic 2017-04-25 22:52:37 +00:00
leveldb.go lib/db: Don't panic 2017-04-25 22:52:37 +00:00
namespaced_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
namespaced.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
set_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
set.go lib/scanner: Use fs.Filesystem for all operations 2017-04-01 09:04:11 +00:00
structs.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
structs.pb.go vendor: Update github.com/gogo/protobuf 2017-01-03 00:16:21 +00:00
structs.proto vendor: Update github.com/gogo/protobuf 2017-01-03 00:16:21 +00:00