9 Commits

Author SHA1 Message Date
Anthony Romano
f6cd4d4f5b snap, etcdserver: tighten up snapshot path handling
Computing the snapshot file path is error prone; snapshot recovery was
constructing file paths missing a path separator so the snapshot
would never be loaded. Instead, refactor the backend path handling
to use helper functions where possible.
2017-05-11 13:46:59 -07:00
fanmin shi
8b7b7222dd etcdserver: renaming db happens after snapshot persists to wal and snap files
In the case that follower recieves a snapshot from leader
and crashes before renaming xxx.snap.db to db but after
snapshot has persisted to .wal and .snap, restarting
follower results loading old db, new .wal, and new .snap.
This will causes a index mismatch between snap metadata index
and consistent index from db.

This pr forces an ordering where saving/renaming db must
happen after snapshot is persisted to wal and snap file.
this guarantees wal and snap files are newer than db.
on server restart, etcd server checks if snap index > db consistent index.
if yes, etcd server attempts to load xxx.snap.db where xxx=snap index
if there is any and panic other wise.

FIXES #7628
2017-05-09 14:00:12 -07:00
Anthony Romano
2f1542c06d *: use filepath.Join for files 2017-03-16 07:46:06 -07:00
Gyu-Ho Lee
ef44f71da9 *: update LICENSE header 2016-05-12 20:51:48 -07:00
Xiang Li
98dbdd5fbb *: simplify network metrics 2016-05-09 22:37:12 -07:00
Ajit Yagaty
8b6de5f85d fileutil: Sync on HFS/OSX needs to be handled differently.
A call file.Sync on OSX doesn't guarantee actual persistence on
physical drive media as the data can be cached in physical drive's
buffers. Hence calls to file.Sync need to be replaced with
fcntl(F_FULLFSYNC).
2016-04-18 21:49:04 -07:00
Xiang Li
994333e720 *: record the number of bytes of snapshot sent/received 2016-02-16 16:08:26 -08:00
Xiang Li
191c5ef9cb snap: call fsync before close db file 2015-12-22 22:43:05 -08:00
Xiang Li
23bd60ccce *: rewrite snapshot sending 2015-12-08 18:21:21 -08:00