wal: not return ErrIndexNotFound in ReadAll

This IndexNotFound case is reasonable now because we don't write dummy
entries into wals any more.
raft: move good case of truncateAndAppend to the first place
raft: clearify that the firstIndex might not be available.
Merge pull request #1831 from xiang90/fix_unstable

raft: fix unstable
raft: panic on bad slice
Merge pull request #1836 from xiang90/panic_slice

raft: panic on bad slice
raft: do not restore snapshot if local raft has longer matching history

Raft should not restore the snapshot if it has longer matching history.
Or restoring snapshot might remove the matched entries.
Merge pull request #1837 from xiang90/fix_restore

raft: do not restore snapshot if local raft has longer matching history
raft: panic if loaded commit is out of range
Merge pull request #1825 from yichengq/242

wal: not return ErrIndexNotFound in ReadAll
Merge pull request #1716 from yichengq/225

raft: panic if loaded commit is out of range
doc: add etcd-lock into libraries-and-tools.md

Lock implementation for etcd. It has three go routines:
    a) acquire - loop that watches for the lock to be free and tries to acquire it.
    b) watch - to watch for lock changes
    c) refresh - to refresh the ttl when the lock is acquired

All the changes in lock ownership are notified on the events channel. Any feedback welcome!
Merge pull request #1815 from ravigadde/patch-1

docs: add etcd-lock into libraries-and-tools.md
raft: add TestUnstableFirstIndex
raft: add TestUnstableLastIndex
raft: add TestUnstableMaybeTerm
raft: print out term in decimal format
Merge pull request #1843 from yichengq/248

raft: print out term in decimal format
Merge pull request #1842 from xiang90/unstable_test

raft: add TestUnstableFirstIndex
raft: add TestUnstableRestore