etcd icon indicating copy to clipboard operation
etcd copied to clipboard

ETCD cluster enters bad state when upgrading from 0.2=>0.3

Open onsi opened this issue 12 years ago • 3 comments

Hey all,

We're seeing behavior in going from 0.2=>0.3 that we've seen before (when going from 0.2rc4=>0.2). We have three etcd instances on AWS operating in clustered mode (A, B, C). Our upgrade strategy involves upgrading one instance at a time starting with A, then B then C.

We don't attempt to preserve our data during the upgrade so we point the datadir from etcd-0.2.0 => etcd-0.3.0 during the upgrade.

What we find is that, shortly after upgrading A, A enters a bad state that is unrecoverable. Eventually new versions of B and C come up and since B and C point to A to join the cluster they fail. In order to recover we find we must stop all the nodes, nuke their state, and then start them again.

Before doing this, I salvaged A, B and C's output logs, raft logs, and snapshot files for both 0.2.0 and 0.3.0 (that way you can see the last thing that happened in 0.2.0 before the switch to 0.3.0).

The logs to (hopefully) help y'all track this down can be found here: https://drive.google.com/file/d/0BzowTjPNRrlzTTc5ZEVSYmdHOU0/edit?usp=sharing

Should we be doing our upgrades differently?

onsi avatar Feb 21 '14 17:02 onsi

Here's the process, from what we can determine:

  1. A, B, and C are running 0.2.0, with a healthy amount of data in the cluster and constant update load.
  2. A goes down
  3. B and C elect B as leader
  4. A comes back up with 0.3.0, and a new blank data directory
  5. A begins snapshotting from B
  6. A completes the first snapshot, starts another snapshot because more changes have happened.
  7. Before the snapshot is complete, B goes down
  8. A and C elect C as leader, possibly because A does not have a complete set of data
  9. A resumes/restarts snapshotting from C
  10. B comes back up with 0.3.0 and a blank data directory
  11. B contacts A on RAFT, and fails to join the cluster (Attempt to join via {A's IP ADDRESS}:7001 failed: Unable to join). Note: A does not redirect to C for this request
  12. C goes down (this is before A is finished snapshotting, and before the next attempt by B to join the cluster)
  13. B tries again to join the cluster by contacting A on A's RAFT port. A responds with a redirect to C's RAFT port. B gets a connection refused for the first attempt, and http timeout for the second and third attempts.
  14. C comes back up with 0.3.0 and a blank data directory
  15. C contacts A on RAFT, and A redirects to C's RAFT port. The redirect results in http timeouts as C tries to connect to itself.
  16. B constantly repeats its join attempts, with the same results. So does C.
  17. Thrash

lvarvel avatar Feb 21 '14 18:02 lvarvel

After testing various scenarios, there seems to be simple steps to reproduce the root problem:

  1. Fire up a three node cluster
  2. Place 20,000 entries under /v2/keys/test
  3. Add a new node to the cluster

Whammo. We start getting the following log messages from the leader: "transporter.ss.decoding.error:proto: field/encoding mismatch: wrong type for field"

Also, the following log messages show up on the new node: "[ss] Error: nil response"

You can also get the same result by downing an existing node, deleting its data directory, and bringing it back up.

Smells like a protocol buffer problem...

lvarvel avatar Feb 22 '14 00:02 lvarvel

Am closing this in favor of #591 -- seems to be the root cause.

onsi avatar Feb 22 '14 21:02 onsi