-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When killed. Etcdv3 node can require manual intervention to bring back #7628
Comments
To get this node to come back, I needed to manually delete the latest snapshot and WAL file, and have it recover the rest from the other nodes in the cluster |
Possible candidate for failpoint testing. Start etcd so it snapshots frequently and inject a sleep before the db sync, kill it, then check if the node restarts cleanly. |
@doodles526 could you provide me an exact steps to reproduce the same issue? |
Steps to reproduce the above issue: Restore the
Create the 1st member of a new cluster using the restored data-dir
Add a 2nd member to cluster:
Start etcd server for 2nd member:
Kill and restart the etcd server for the 2nd member:
The 2nd member will exit with the following error:
|
The snapshot that I used was just from writing 1 key value pair to a single member etcd cluster:
|
@hasbro17 that looks like a separate issue. There's no |
@heyitsanthony done #7834 |
In the case that follower recieves a snapshot from leader and crashes before renaming xxx.snap.db to db, restarting follower results loading old db. This will causes a index mismatch between snap metadata index and consistent index from db. The pr fixes the above on init of etcdserver through: 1. check if xxx.snap.db (xxx==snapshot.Metadata.Index) exists. 2. rename xxx.snap.db to db if exists. 3. load backend again with the new db file. FIXES etcd-io#7628
In the case that follower recieves a snapshot from leader and crashes before renaming xxx.snap.db to db, restarting follower results loading old db. This will causes a index mismatch between snap metadata index and consistent index from db. The pr fixes the above on init of etcdserver through: 1. check if xxx.snap.db (xxx==snapshot.Metadata.Index) exists. 2. rename xxx.snap.db to db if exists. 3. load backend again with the new db file. FIXES etcd-io#7628
In the case that follower recieves a snapshot from leader and crashes before renaming xxx.snap.db to db, restarting follower results loading old db. This will causes a index mismatch between snap metadata index and consistent index from db. The pr fixes the above on init of etcdserver through: 1. check if xxx.snap.db (xxx==snapshot.Metadata.Index) exists. 2. rename xxx.snap.db to db if exists. 3. load backend again with the new db file. FIXES etcd-io#7628
In the case that follower recieves a snapshot from leader and crashes before renaming xxx.snap.db to db, restarting follower results loading old db. This will causes a index mismatch between snap metadata index and consistent index from db. The pr fixes the above on init of etcdserver through: 1. check if xxx.snap.db (xxx==snapshot.Metadata.Index) exists. 2. rename xxx.snap.db to db if exists. 3. load backend again with the new db file. FIXES etcd-io#7628
In the case that follower recieves a snapshot from leader and crashes before renaming xxx.snap.db to db, restarting follower results loading old db. This will causes a index mismatch between snap metadata index and consistent index from db. The pr fixes the above on init of etcdserver through: 1. check if xxx.snap.db (xxx==snapshot.Metadata.Index) exists. 2. rename xxx.snap.db to db if exists. 3. load backend again with the new db file. FIXES etcd-io#7628
…nap 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 before snapshot is persisted to wal and snap file. this ensures that db file can never be newer than wal and snap file. hence, it guarantees the invariant snapshot.Metadata.Index <= db.ConsistentIndex() in NewServer() when checking validity of db and snap file. FIXES etcd-io#7628
…nap 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 before snapshot is persisted to wal and snap file. this ensures that db file can never be newer than wal and snap file. hence, it guarantees the invariant snapshot.Metadata.Index <= db.ConsistentIndex() in NewServer() when checking validity of db and snap file. FIXES etcd-io#7628
…nap 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 before snapshot is persisted to wal and snap file. this ensures that db file can never be newer than wal and snap file. hence, it guarantees the invariant snapshot.Metadata.Index <= db.ConsistentIndex() in NewServer() when checking validity of db and snap file. FIXES etcd-io#7628
…ap 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 etcd-io#7628
…ap 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 etcd-io#7628
…ap 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 etcd-io#7628
…ap 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 etcd-io#7628
…ap 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 etcd-io#7628
…ap 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 etcd-io#7628
This was discovered when running a benchmark on a 3 node etcd cluster. The issue was only produced on a single node.
It appears that the BoltDB backend lags behind the snapshots written to disk, as a hard kill to an etcd member can result in
etcdmain: database file (/data/etcd/member/snap/db index 7622690) does not match with snapshot (index 8081536).
upon starting back up. After getting this error and the node starting to flap, you are able to fix the issue by deleting the latest snapshot and WAL file. It appears that after the snapshot is written to disk before thedb
file is written to, and that upon booting etcd doesn't have an automated method of recovery.Log output
The text was updated successfully, but these errors were encountered: