rpc.proto 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. syntax = "proto3";
  2. package rpcpb;
  3. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  4. option (gogoproto.marshaler_all) = true;
  5. option (gogoproto.sizer_all) = true;
  6. option (gogoproto.unmarshaler_all) = true;
  7. option (gogoproto.goproto_getters_all) = false;
  8. message Request {
  9. Operation Operation = 1;
  10. // Member contains the same Member object from tester configuration.
  11. Member Member = 2;
  12. // Tester contains tester configuration.
  13. Tester Tester = 3;
  14. }
  15. // SnapshotInfo contains SAVE_SNAPSHOT request results.
  16. message SnapshotInfo {
  17. string MemberName = 1;
  18. repeated string MemberClientURLs = 2;
  19. string SnapshotPath = 3;
  20. string SnapshotFileSize = 4;
  21. string SnapshotTotalSize = 5;
  22. int64 SnapshotTotalKey = 6;
  23. int64 SnapshotHash = 7;
  24. int64 SnapshotRevision = 8;
  25. string Took = 9;
  26. }
  27. message Response {
  28. bool Success = 1;
  29. string Status = 2;
  30. // Member contains the same Member object from tester request.
  31. Member Member = 3;
  32. // SnapshotInfo contains SAVE_SNAPSHOT request results.
  33. SnapshotInfo SnapshotInfo = 4;
  34. }
  35. service Transport {
  36. rpc Transport(stream Request) returns (stream Response) {}
  37. }
  38. message Member {
  39. // EtcdExecPath is the executable etcd binary path in agent server.
  40. string EtcdExecPath = 1 [(gogoproto.moretags) = "yaml:\"etcd-exec-path\""];
  41. // TODO: support embedded etcd
  42. // AgentAddr is the agent HTTP server address.
  43. string AgentAddr = 11 [(gogoproto.moretags) = "yaml:\"agent-addr\""];
  44. // FailpointHTTPAddr is the agent's failpoints HTTP server address.
  45. string FailpointHTTPAddr = 12 [(gogoproto.moretags) = "yaml:\"failpoint-http-addr\""];
  46. // BaseDir is the base directory where all logs and etcd data are stored.
  47. string BaseDir = 101 [(gogoproto.moretags) = "yaml:\"base-dir\""];
  48. // EtcdLogPath is the log file to store current etcd server logs.
  49. string EtcdLogPath = 102 [(gogoproto.moretags) = "yaml:\"etcd-log-path\""];
  50. // EtcdClientProxy is true when client traffic needs to be proxied.
  51. // If true, listen client URL port must be different than advertise client URL port.
  52. bool EtcdClientProxy = 201 [(gogoproto.moretags) = "yaml:\"etcd-client-proxy\""];
  53. // EtcdPeerProxy is true when peer traffic needs to be proxied.
  54. // If true, listen peer URL port must be different than advertise peer URL port.
  55. bool EtcdPeerProxy = 202 [(gogoproto.moretags) = "yaml:\"etcd-peer-proxy\""];
  56. // EtcdClientEndpoint is the etcd client endpoint.
  57. string EtcdClientEndpoint = 301 [(gogoproto.moretags) = "yaml:\"etcd-client-endpoint\""];
  58. // Etcd defines etcd binary configuration flags.
  59. Etcd Etcd = 302 [(gogoproto.moretags) = "yaml:\"etcd\""];
  60. // EtcdOnSnapshotRestore defines one-time use configuration during etcd
  61. // snapshot recovery process.
  62. Etcd EtcdOnSnapshotRestore = 303;
  63. // ClientCertData contains cert file contents from this member's etcd server.
  64. string ClientCertData = 401 [(gogoproto.moretags) = "yaml:\"client-cert-data\""];
  65. string ClientCertPath = 402 [(gogoproto.moretags) = "yaml:\"client-cert-path\""];
  66. // ClientKeyData contains key file contents from this member's etcd server.
  67. string ClientKeyData = 403 [(gogoproto.moretags) = "yaml:\"client-key-data\""];
  68. string ClientKeyPath = 404 [(gogoproto.moretags) = "yaml:\"client-key-path\""];
  69. // ClientTrustedCAData contains trusted CA file contents from this member's etcd server.
  70. string ClientTrustedCAData = 405 [(gogoproto.moretags) = "yaml:\"client-trusted-ca-data\""];
  71. string ClientTrustedCAPath = 406 [(gogoproto.moretags) = "yaml:\"client-trusted-ca-path\""];
  72. // PeerCertData contains cert file contents from this member's etcd server.
  73. string PeerCertData = 501 [(gogoproto.moretags) = "yaml:\"peer-cert-data\""];
  74. string PeerCertPath = 502 [(gogoproto.moretags) = "yaml:\"peer-cert-path\""];
  75. // PeerKeyData contains key file contents from this member's etcd server.
  76. string PeerKeyData = 503 [(gogoproto.moretags) = "yaml:\"peer-key-data\""];
  77. string PeerKeyPath = 504 [(gogoproto.moretags) = "yaml:\"peer-key-path\""];
  78. // PeerTrustedCAData contains trusted CA file contents from this member's etcd server.
  79. string PeerTrustedCAData = 505 [(gogoproto.moretags) = "yaml:\"peer-trusted-ca-data\""];
  80. string PeerTrustedCAPath = 506 [(gogoproto.moretags) = "yaml:\"peer-trusted-ca-path\""];
  81. // SnapshotPath is the snapshot file path to store or restore from.
  82. string SnapshotPath = 601 [(gogoproto.moretags) = "yaml:\"snapshot-path\""];
  83. // SnapshotInfo contains last SAVE_SNAPSHOT request results.
  84. SnapshotInfo SnapshotInfo = 602;
  85. }
  86. message Tester {
  87. string DataDir = 1 [(gogoproto.moretags) = "yaml:\"data-dir\""];
  88. string Network = 2 [(gogoproto.moretags) = "yaml:\"network\""];
  89. string Addr = 3 [(gogoproto.moretags) = "yaml:\"addr\""];
  90. // DelayLatencyMsRv is the delay latency in milliseconds,
  91. // to inject to simulated slow network.
  92. uint32 DelayLatencyMs = 11 [(gogoproto.moretags) = "yaml:\"delay-latency-ms\""];
  93. // DelayLatencyMsRv is the delay latency random variable in milliseconds.
  94. uint32 DelayLatencyMsRv = 12 [(gogoproto.moretags) = "yaml:\"delay-latency-ms-rv\""];
  95. // UpdatedDelayLatencyMs is the update delay latency in milliseconds,
  96. // to inject to simulated slow network. It's the final latency to apply,
  97. // in case the latency numbers are randomly generated from given delay latency field.
  98. uint32 UpdatedDelayLatencyMs = 13 [(gogoproto.moretags) = "yaml:\"updated-delay-latency-ms\""];
  99. // RoundLimit is the limit of rounds to run failure set (-1 to run without limits).
  100. int32 RoundLimit = 21 [(gogoproto.moretags) = "yaml:\"round-limit\""];
  101. // ExitOnCaseFail is true, then exit tester on first failure.
  102. bool ExitOnCaseFail = 22 [(gogoproto.moretags) = "yaml:\"exit-on-failure\""];
  103. // EnablePprof is true to enable profiler.
  104. bool EnablePprof = 23 [(gogoproto.moretags) = "yaml:\"enable-pprof\""];
  105. // CaseDelayMs is the delay duration after failure is injected.
  106. // Useful when triggering snapshot or no-op failure cases.
  107. uint32 CaseDelayMs = 31 [(gogoproto.moretags) = "yaml:\"case-delay-ms\""];
  108. // CaseShuffle is true to randomize failure injecting order.
  109. bool CaseShuffle = 32 [(gogoproto.moretags) = "yaml:\"case-shuffle\""];
  110. // Cases is the selected test cases to schedule.
  111. // If empty, run all failure cases.
  112. repeated string Cases = 33 [(gogoproto.moretags) = "yaml:\"cases\""];
  113. // FailpointCommands is the list of "gofail" commands
  114. // (e.g. panic("etcd-tester"),1*sleep(1000).
  115. repeated string FailpointCommands = 34 [(gogoproto.moretags) = "yaml:\"failpoint-commands\""];
  116. // RunnerExecPath is a path of etcd-runner binary.
  117. string RunnerExecPath = 41 [(gogoproto.moretags) = "yaml:\"runner-exec-path\""];
  118. // ExternalExecPath is a path of script for enabling/disabling an external fault injector.
  119. string ExternalExecPath = 42 [(gogoproto.moretags) = "yaml:\"external-exec-path\""];
  120. // Stressers is the list of stresser types:
  121. // KV, LEASE, ELECTION_RUNNER, WATCH_RUNNER, LOCK_RACER_RUNNER, LEASE_RUNNER.
  122. repeated string Stressers = 101 [(gogoproto.moretags) = "yaml:\"stressers\""];
  123. // Checkers is the list of consistency checker types:
  124. // KV_HASH, LEASE_EXPIRE, NO_CHECK, RUNNER.
  125. // Leave empty to skip consistency checks.
  126. repeated string Checkers = 102 [(gogoproto.moretags) = "yaml:\"checkers\""];
  127. // StressKeySize is the size of each small key written into etcd.
  128. int32 StressKeySize = 201 [(gogoproto.moretags) = "yaml:\"stress-key-size\""];
  129. // StressKeySizeLarge is the size of each large key written into etcd.
  130. int32 StressKeySizeLarge = 202 [(gogoproto.moretags) = "yaml:\"stress-key-size-large\""];
  131. // StressKeySuffixRange is the count of key range written into etcd.
  132. // Stress keys are created with "fmt.Sprintf("foo%016x", rand.Intn(keySuffixRange)".
  133. int32 StressKeySuffixRange = 203 [(gogoproto.moretags) = "yaml:\"stress-key-suffix-range\""];
  134. // StressKeySuffixRangeTxn is the count of key range written into etcd txn (max 100).
  135. // Stress keys are created with "fmt.Sprintf("/k%03d", i)".
  136. int32 StressKeySuffixRangeTxn = 204 [(gogoproto.moretags) = "yaml:\"stress-key-suffix-range-txn\""];
  137. // StressKeyTxnOps is the number of operations per a transaction (max 64).
  138. int32 StressKeyTxnOps = 205 [(gogoproto.moretags) = "yaml:\"stress-key-txn-ops\""];
  139. // StressClients is the number of concurrent stressing clients
  140. // with "one" shared TCP connection.
  141. int32 StressClients = 301 [(gogoproto.moretags) = "yaml:\"stress-clients\""];
  142. // StressQPS is the maximum number of stresser requests per second.
  143. int32 StressQPS = 302 [(gogoproto.moretags) = "yaml:\"stress-qps\""];
  144. }
  145. message Etcd {
  146. string Name = 1 [(gogoproto.moretags) = "yaml:\"name\""];
  147. string DataDir = 2 [(gogoproto.moretags) = "yaml:\"data-dir\""];
  148. string WALDir = 3 [(gogoproto.moretags) = "yaml:\"wal-dir\""];
  149. // HeartbeatIntervalMs is the time (in milliseconds) of a heartbeat interval.
  150. // Default value is 100, which is 100ms.
  151. int64 HeartbeatIntervalMs = 11 [(gogoproto.moretags) = "yaml:\"heartbeat-interval\""];
  152. // ElectionTimeoutMs is the time (in milliseconds) for an election to timeout.
  153. // Default value is 1000, which is 1s.
  154. int64 ElectionTimeoutMs = 12 [(gogoproto.moretags) = "yaml:\"election-timeout\""];
  155. repeated string ListenClientURLs = 21 [(gogoproto.moretags) = "yaml:\"listen-client-urls\""];
  156. repeated string AdvertiseClientURLs = 22 [(gogoproto.moretags) = "yaml:\"advertise-client-urls\""];
  157. bool ClientAutoTLS = 23 [(gogoproto.moretags) = "yaml:\"auto-tls\""];
  158. bool ClientCertAuth = 24 [(gogoproto.moretags) = "yaml:\"client-cert-auth\""];
  159. string ClientCertFile = 25 [(gogoproto.moretags) = "yaml:\"cert-file\""];
  160. string ClientKeyFile = 26 [(gogoproto.moretags) = "yaml:\"key-file\""];
  161. string ClientTrustedCAFile = 27 [(gogoproto.moretags) = "yaml:\"trusted-ca-file\""];
  162. repeated string ListenPeerURLs = 31 [(gogoproto.moretags) = "yaml:\"listen-peer-urls\""];
  163. repeated string AdvertisePeerURLs = 32 [(gogoproto.moretags) = "yaml:\"initial-advertise-peer-urls\""];
  164. bool PeerAutoTLS = 33 [(gogoproto.moretags) = "yaml:\"peer-auto-tls\""];
  165. bool PeerClientCertAuth = 34 [(gogoproto.moretags) = "yaml:\"peer-client-cert-auth\""];
  166. string PeerCertFile = 35 [(gogoproto.moretags) = "yaml:\"peer-cert-file\""];
  167. string PeerKeyFile = 36 [(gogoproto.moretags) = "yaml:\"peer-key-file\""];
  168. string PeerTrustedCAFile = 37 [(gogoproto.moretags) = "yaml:\"peer-trusted-ca-file\""];
  169. string InitialCluster = 41 [(gogoproto.moretags) = "yaml:\"initial-cluster\""];
  170. string InitialClusterState = 42 [(gogoproto.moretags) = "yaml:\"initial-cluster-state\""];
  171. string InitialClusterToken = 43 [(gogoproto.moretags) = "yaml:\"initial-cluster-token\""];
  172. int64 SnapshotCount = 51 [(gogoproto.moretags) = "yaml:\"snapshot-count\""];
  173. int64 QuotaBackendBytes = 52 [(gogoproto.moretags) = "yaml:\"quota-backend-bytes\""];
  174. bool PreVote = 63 [(gogoproto.moretags) = "yaml:\"pre-vote\""];
  175. bool InitialCorruptCheck = 64 [(gogoproto.moretags) = "yaml:\"initial-corrupt-check\""];
  176. }
  177. enum Operation {
  178. // NOT_STARTED is the agent status before etcd first start.
  179. NOT_STARTED = 0;
  180. // INITIAL_START_ETCD is only called to start etcd, the very first time.
  181. INITIAL_START_ETCD = 10;
  182. // RESTART_ETCD is sent to restart killed etcd.
  183. RESTART_ETCD = 11;
  184. // SIGTERM_ETCD pauses etcd process while keeping data directories
  185. // and previous etcd configurations.
  186. SIGTERM_ETCD = 20;
  187. // SIGQUIT_ETCD_AND_REMOVE_DATA kills etcd process and removes all data
  188. // directories to simulate destroying the whole machine.
  189. SIGQUIT_ETCD_AND_REMOVE_DATA = 21;
  190. // SAVE_SNAPSHOT is sent to trigger local member to download its snapshot
  191. // onto its local disk with the specified path from tester.
  192. SAVE_SNAPSHOT = 30;
  193. // RESTORE_RESTART_FROM_SNAPSHOT is sent to trigger local member to
  194. // restore a cluster from existing snapshot from disk, and restart
  195. // an etcd instance from recovered data.
  196. RESTORE_RESTART_FROM_SNAPSHOT = 31;
  197. // RESTART_FROM_SNAPSHOT is sent to trigger local member to restart
  198. // and join an existing cluster that has been recovered from a snapshot.
  199. // Local member joins this cluster with fresh data.
  200. RESTART_FROM_SNAPSHOT = 32;
  201. // SIGQUIT_ETCD_AND_ARCHIVE_DATA is sent when consistency check failed,
  202. // thus need to archive etcd data directories.
  203. SIGQUIT_ETCD_AND_ARCHIVE_DATA = 40;
  204. // SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT destroys etcd process,
  205. // etcd data, and agent server.
  206. SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT = 41;
  207. // BLACKHOLE_PEER_PORT_TX_RX drops all outgoing/incoming packets from/to
  208. // the peer port on target member's peer port.
  209. BLACKHOLE_PEER_PORT_TX_RX = 100;
  210. // UNBLACKHOLE_PEER_PORT_TX_RX removes outgoing/incoming packet dropping.
  211. UNBLACKHOLE_PEER_PORT_TX_RX = 101;
  212. // DELAY_PEER_PORT_TX_RX delays all outgoing/incoming packets from/to
  213. // the peer port on target member's peer port.
  214. DELAY_PEER_PORT_TX_RX = 200;
  215. // UNDELAY_PEER_PORT_TX_RX removes all outgoing/incoming delays.
  216. UNDELAY_PEER_PORT_TX_RX = 201;
  217. }
  218. // Case defines various system faults or test case in distributed systems,
  219. // in order to verify correct behavior of etcd servers and clients.
  220. enum Case {
  221. // SIGTERM_ONE_FOLLOWER stops a randomly chosen follower (non-leader)
  222. // but does not delete its data directories on disk for next restart.
  223. // It waits "delay-ms" before recovering this failure.
  224. // The expected behavior is that the follower comes back online
  225. // and rejoins the cluster, and then each member continues to process
  226. // client requests ('Put' request that requires Raft consensus).
  227. SIGTERM_ONE_FOLLOWER = 0;
  228. // SIGTERM_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT stops a randomly chosen
  229. // follower but does not delete its data directories on disk for next
  230. // restart. And waits until most up-to-date node (leader) applies the
  231. // snapshot count of entries since the stop operation.
  232. // The expected behavior is that the follower comes back online and
  233. // rejoins the cluster, and then active leader sends snapshot
  234. // to the follower to force it to follow the leader's log.
  235. // As always, after recovery, each member must be able to process
  236. // client requests.
  237. SIGTERM_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT = 1;
  238. // SIGTERM_LEADER stops the active leader node but does not delete its
  239. // data directories on disk for next restart. Then it waits "delay-ms"
  240. // before recovering this failure, in order to trigger election timeouts.
  241. // The expected behavior is that a new leader gets elected, and the
  242. // old leader comes back online and rejoins the cluster as a follower.
  243. // As always, after recovery, each member must be able to process
  244. // client requests.
  245. SIGTERM_LEADER = 2;
  246. // SIGTERM_LEADER_UNTIL_TRIGGER_SNAPSHOT stops the active leader node
  247. // but does not delete its data directories on disk for next restart.
  248. // And waits until most up-to-date node ("new" leader) applies the
  249. // snapshot count of entries since the stop operation.
  250. // The expected behavior is that cluster elects a new leader, and the
  251. // old leader comes back online and rejoins the cluster as a follower.
  252. // And it receives the snapshot from the new leader to overwrite its
  253. // store. As always, after recovery, each member must be able to
  254. // process client requests.
  255. SIGTERM_LEADER_UNTIL_TRIGGER_SNAPSHOT = 3;
  256. // SIGTERM_QUORUM stops majority number of nodes to make the whole cluster
  257. // inoperable but does not delete data directories on stopped nodes
  258. // for next restart. And it waits "delay-ms" before recovering failure.
  259. // The expected behavior is that nodes come back online, thus cluster
  260. // comes back operative as well. As always, after recovery, each member
  261. // must be able to process client requests.
  262. SIGTERM_QUORUM = 4;
  263. // SIGTERM_ALL stops the whole cluster but does not delete data directories
  264. // on disk for next restart. And it waits "delay-ms" before recovering
  265. // this failure.
  266. // The expected behavior is that nodes come back online, thus cluster
  267. // comes back operative as well. As always, after recovery, each member
  268. // must be able to process client requests.
  269. SIGTERM_ALL = 5;
  270. // SIGQUIT_AND_REMOVE_ONE_FOLLOWER stops a randomly chosen follower
  271. // (non-leader), deletes its data directories on disk, and removes
  272. // this member from cluster (membership reconfiguration). On recovery,
  273. // tester adds a new member, and this member joins the existing cluster
  274. // with fresh data. It waits "delay-ms" before recovering this
  275. // failure. This simulates destroying one follower machine, where operator
  276. // needs to add a new member from a fresh machine.
  277. // The expected behavior is that a new member joins the existing cluster,
  278. // and then each member continues to process client requests.
  279. SIGQUIT_AND_REMOVE_ONE_FOLLOWER = 10;
  280. // SIGQUIT_AND_REMOVE_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT stops a randomly
  281. // chosen follower, deletes its data directories on disk, and removes
  282. // this member from cluster (membership reconfiguration). On recovery,
  283. // tester adds a new member, and this member joins the existing cluster
  284. // restart. On member remove, cluster waits until most up-to-date node
  285. // (leader) applies the snapshot count of entries since the stop operation.
  286. // This simulates destroying a leader machine, where operator needs to add
  287. // a new member from a fresh machine.
  288. // The expected behavior is that a new member joins the existing cluster,
  289. // and receives a snapshot from the active leader. As always, after
  290. // recovery, each member must be able to process client requests.
  291. SIGQUIT_AND_REMOVE_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT = 11;
  292. // SIGQUIT_AND_REMOVE_LEADER stops the active leader node, deletes its
  293. // data directories on disk, and removes this member from cluster.
  294. // On recovery, tester adds a new member, and this member joins the
  295. // existing cluster with fresh data. It waits "delay-ms" before
  296. // recovering this failure. This simulates destroying a leader machine,
  297. // where operator needs to add a new member from a fresh machine.
  298. // The expected behavior is that a new member joins the existing cluster,
  299. // and then each member continues to process client requests.
  300. SIGQUIT_AND_REMOVE_LEADER = 12;
  301. // SIGQUIT_AND_REMOVE_LEADER_UNTIL_TRIGGER_SNAPSHOT stops the active leader,
  302. // deletes its data directories on disk, and removes this member from
  303. // cluster (membership reconfiguration). On recovery, tester adds a new
  304. // member, and this member joins the existing cluster restart. On member
  305. // remove, cluster waits until most up-to-date node (new leader) applies
  306. // the snapshot count of entries since the stop operation. This simulates
  307. // destroying a leader machine, where operator needs to add a new member
  308. // from a fresh machine.
  309. // The expected behavior is that on member remove, cluster elects a new
  310. // leader, and a new member joins the existing cluster and receives a
  311. // snapshot from the newly elected leader. As always, after recovery, each
  312. // member must be able to process client requests.
  313. SIGQUIT_AND_REMOVE_LEADER_UNTIL_TRIGGER_SNAPSHOT = 13;
  314. // SIGQUIT_AND_REMOVE_QUORUM_AND_RESTORE_LEADER_SNAPSHOT_FROM_SCRATCH first
  315. // stops majority number of nodes, deletes data directories on those quorum
  316. // nodes, to make the whole cluster inoperable. Now that quorum and their
  317. // data are totally destroyed, cluster cannot even remove unavailable nodes
  318. // (e.g. 2 out of 3 are lost, so no leader can be elected).
  319. // Let's assume 3-node cluster of node A, B, and C. One day, node A and B
  320. // are destroyed and all their data are gone. The only viable solution is
  321. // to recover from C's latest snapshot.
  322. //
  323. // To simulate:
  324. // 1. Assume node C is the current leader with most up-to-date data.
  325. // 2. Download snapshot from node C, before destroying node A and B.
  326. // 3. Destroy node A and B, and make the whole cluster inoperable.
  327. // 4. Now node C cannot operate either.
  328. // 5. SIGTERM node C and remove its data directories.
  329. // 6. Restore a new seed member from node C's latest snapshot file.
  330. // 7. Add another member to establish 2-node cluster.
  331. // 8. Add another member to establish 3-node cluster.
  332. // 9. Add more if any.
  333. //
  334. // The expected behavior is that etcd successfully recovers from such
  335. // disastrous situation as only 1-node survives out of 3-node cluster,
  336. // new members joins the existing cluster, and previous data from snapshot
  337. // are still preserved after recovery process. As always, after recovery,
  338. // each member must be able to process client requests.
  339. SIGQUIT_AND_REMOVE_QUORUM_AND_RESTORE_LEADER_SNAPSHOT_FROM_SCRATCH = 14;
  340. // BLACKHOLE_PEER_PORT_TX_RX_ONE_FOLLOWER drops all outgoing/incoming
  341. // packets from/to the peer port on a randomly chosen follower
  342. // (non-leader), and waits for "delay-ms" until recovery.
  343. // The expected behavior is that once dropping operation is undone,
  344. // each member must be able to process client requests.
  345. BLACKHOLE_PEER_PORT_TX_RX_ONE_FOLLOWER = 100;
  346. // BLACKHOLE_PEER_PORT_TX_RX_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT drops
  347. // all outgoing/incoming packets from/to the peer port on a randomly
  348. // chosen follower (non-leader), and waits for most up-to-date node
  349. // (leader) applies the snapshot count of entries since the blackhole
  350. // operation.
  351. // The expected behavior is that once packet drop operation is undone,
  352. // the slow follower tries to catch up, possibly receiving the snapshot
  353. // from the active leader. As always, after recovery, each member must
  354. // be able to process client requests.
  355. BLACKHOLE_PEER_PORT_TX_RX_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT = 101;
  356. // BLACKHOLE_PEER_PORT_TX_RX_LEADER drops all outgoing/incoming packets
  357. // from/to the peer port on the active leader (isolated), and waits for
  358. // "delay-ms" until recovery, in order to trigger election timeout.
  359. // The expected behavior is that after election timeout, a new leader gets
  360. // elected, and once dropping operation is undone, the old leader comes
  361. // back and rejoins the cluster as a follower. As always, after recovery,
  362. // each member must be able to process client requests.
  363. BLACKHOLE_PEER_PORT_TX_RX_LEADER = 102;
  364. // BLACKHOLE_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT drops all
  365. // outgoing/incoming packets from/to the peer port on the active leader,
  366. // and waits for most up-to-date node (leader) applies the snapshot
  367. // count of entries since the blackhole operation.
  368. // The expected behavior is that cluster elects a new leader, and once
  369. // dropping operation is undone, the old leader comes back and rejoins
  370. // the cluster as a follower. The slow follower tries to catch up, likely
  371. // receiving the snapshot from the new active leader. As always, after
  372. // recovery, each member must be able to process client requests.
  373. BLACKHOLE_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT = 103;
  374. // BLACKHOLE_PEER_PORT_TX_RX_QUORUM drops all outgoing/incoming packets
  375. // from/to the peer ports on majority nodes of cluster, thus losing its
  376. // leader and cluster being inoperable. And it waits for "delay-ms"
  377. // until recovery.
  378. // The expected behavior is that once packet drop operation is undone,
  379. // nodes come back online, thus cluster comes back operative. As always,
  380. // after recovery, each member must be able to process client requests.
  381. BLACKHOLE_PEER_PORT_TX_RX_QUORUM = 104;
  382. // BLACKHOLE_PEER_PORT_TX_RX_ALL drops all outgoing/incoming packets
  383. // from/to the peer ports on all nodes, thus making cluster totally
  384. // inoperable. It waits for "delay-ms" until recovery.
  385. // The expected behavior is that once packet drop operation is undone,
  386. // nodes come back online, thus cluster comes back operative. As always,
  387. // after recovery, each member must be able to process client requests.
  388. BLACKHOLE_PEER_PORT_TX_RX_ALL = 105;
  389. // DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER delays outgoing/incoming packets
  390. // from/to the peer port on a randomly chosen follower (non-leader).
  391. // It waits for "delay-ms" until recovery.
  392. // The expected behavior is that once packet delay operation is undone,
  393. // the follower comes back and tries to catch up with latest changes from
  394. // cluster. And as always, after recovery, each member must be able to
  395. // process client requests.
  396. DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER = 200;
  397. // RANDOM_DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER delays outgoing/incoming
  398. // packets from/to the peer port on a randomly chosen follower
  399. // (non-leader) with a randomized time duration (thus isolated). It
  400. // waits for "delay-ms" until recovery.
  401. // The expected behavior is that once packet delay operation is undone,
  402. // each member must be able to process client requests.
  403. RANDOM_DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER = 201;
  404. // DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT delays
  405. // outgoing/incoming packets from/to the peer port on a randomly chosen
  406. // follower (non-leader), and waits for most up-to-date node (leader)
  407. // applies the snapshot count of entries since the delay operation.
  408. // The expected behavior is that the delayed follower gets isolated
  409. // and behind the current active leader, and once delay operation is undone,
  410. // the slow follower comes back and catches up possibly receiving snapshot
  411. // from the active leader. As always, after recovery, each member must be
  412. // able to process client requests.
  413. DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT = 202;
  414. // RANDOM_DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT delays
  415. // outgoing/incoming packets from/to the peer port on a randomly chosen
  416. // follower (non-leader) with a randomized time duration, and waits for
  417. // most up-to-date node (leader) applies the snapshot count of entries
  418. // since the delay operation.
  419. // The expected behavior is that the delayed follower gets isolated
  420. // and behind the current active leader, and once delay operation is undone,
  421. // the slow follower comes back and catches up, possibly receiving a
  422. // snapshot from the active leader. As always, after recovery, each member
  423. // must be able to process client requests.
  424. RANDOM_DELAY_PEER_PORT_TX_RX_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT = 203;
  425. // DELAY_PEER_PORT_TX_RX_LEADER delays outgoing/incoming packets from/to
  426. // the peer port on the active leader. And waits for "delay-ms" until
  427. // recovery.
  428. // The expected behavior is that cluster may elect a new leader, and
  429. // once packet delay operation is undone, the (old) leader comes back
  430. // and tries to catch up with latest changes from cluster. As always,
  431. // after recovery, each member must be able to process client requests.
  432. DELAY_PEER_PORT_TX_RX_LEADER = 204;
  433. // RANDOM_DELAY_PEER_PORT_TX_RX_LEADER delays outgoing/incoming packets
  434. // from/to the peer port on the active leader with a randomized time
  435. // duration. And waits for "delay-ms" until recovery.
  436. // The expected behavior is that cluster may elect a new leader, and
  437. // once packet delay operation is undone, the (old) leader comes back
  438. // and tries to catch up with latest changes from cluster. As always,
  439. // after recovery, each member must be able to process client requests.
  440. RANDOM_DELAY_PEER_PORT_TX_RX_LEADER = 205;
  441. // DELAY_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT delays
  442. // outgoing/incoming packets from/to the peer port on the active leader,
  443. // and waits for most up-to-date node (current or new leader) applies the
  444. // snapshot count of entries since the delay operation.
  445. // The expected behavior is that cluster may elect a new leader, and
  446. // the old leader gets isolated and behind the current active leader,
  447. // and once delay operation is undone, the slow follower comes back
  448. // and catches up, likely receiving a snapshot from the active leader.
  449. // As always, after recovery, each member must be able to process client
  450. // requests.
  451. DELAY_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT = 206;
  452. // RANDOM_DELAY_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT delays
  453. // outgoing/incoming packets from/to the peer port on the active leader,
  454. // with a randomized time duration. And it waits for most up-to-date node
  455. // (current or new leader) applies the snapshot count of entries since the
  456. // delay operation.
  457. // The expected behavior is that cluster may elect a new leader, and
  458. // the old leader gets isolated and behind the current active leader,
  459. // and once delay operation is undone, the slow follower comes back
  460. // and catches up, likely receiving a snapshot from the active leader.
  461. // As always, after recovery, each member must be able to process client
  462. // requests.
  463. RANDOM_DELAY_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT = 207;
  464. // DELAY_PEER_PORT_TX_RX_QUORUM delays outgoing/incoming packets from/to
  465. // the peer ports on majority nodes of cluster. And it waits for
  466. // "delay-ms" until recovery, likely to trigger election timeouts.
  467. // The expected behavior is that cluster may elect a new leader, while
  468. // quorum of nodes struggle with slow networks, and once delay operation
  469. // is undone, nodes come back and cluster comes back operative. As always,
  470. // after recovery, each member must be able to process client requests.
  471. DELAY_PEER_PORT_TX_RX_QUORUM = 208;
  472. // RANDOM_DELAY_PEER_PORT_TX_RX_QUORUM delays outgoing/incoming packets
  473. // from/to the peer ports on majority nodes of cluster, with randomized
  474. // time durations. And it waits for "delay-ms" until recovery, likely
  475. // to trigger election timeouts.
  476. // The expected behavior is that cluster may elect a new leader, while
  477. // quorum of nodes struggle with slow networks, and once delay operation
  478. // is undone, nodes come back and cluster comes back operative. As always,
  479. // after recovery, each member must be able to process client requests.
  480. RANDOM_DELAY_PEER_PORT_TX_RX_QUORUM = 209;
  481. // DELAY_PEER_PORT_TX_RX_ALL delays outgoing/incoming packets from/to the
  482. // peer ports on all nodes. And it waits for "delay-ms" until recovery,
  483. // likely to trigger election timeouts.
  484. // The expected behavior is that cluster may become totally inoperable,
  485. // struggling with slow networks across the whole cluster. Once delay
  486. // operation is undone, nodes come back and cluster comes back operative.
  487. // As always, after recovery, each member must be able to process client
  488. // requests.
  489. DELAY_PEER_PORT_TX_RX_ALL = 210;
  490. // RANDOM_DELAY_PEER_PORT_TX_RX_ALL delays outgoing/incoming packets
  491. // from/to the peer ports on all nodes, with randomized time durations.
  492. // And it waits for "delay-ms" until recovery, likely to trigger
  493. // election timeouts.
  494. // The expected behavior is that cluster may become totally inoperable,
  495. // struggling with slow networks across the whole cluster. Once delay
  496. // operation is undone, nodes come back and cluster comes back operative.
  497. // As always, after recovery, each member must be able to process client
  498. // requests.
  499. RANDOM_DELAY_PEER_PORT_TX_RX_ALL = 211;
  500. // NO_FAIL_WITH_STRESS stops injecting failures while testing the
  501. // consistency and correctness under pressure loads, for the duration of
  502. // "delay-ms". Goal is to ensure cluster be still making progress
  503. // on recovery, and verify system does not deadlock following a sequence
  504. // of failure injections.
  505. // The expected behavior is that cluster remains fully operative in healthy
  506. // condition. As always, after recovery, each member must be able to process
  507. // client requests.
  508. NO_FAIL_WITH_STRESS = 300;
  509. // NO_FAIL_WITH_NO_STRESS_FOR_LIVENESS neither injects failures nor
  510. // sends stressig client requests to the cluster, for the duration of
  511. // "delay-ms". Goal is to ensure cluster be still making progress
  512. // on recovery, and verify system does not deadlock following a sequence
  513. // of failure injections.
  514. // The expected behavior is that cluster remains fully operative in healthy
  515. // condition, and clients requests during liveness period succeed without
  516. // errors.
  517. // Note: this is how Google Chubby does failure injection testing
  518. // https://static.googleusercontent.com/media/research.google.com/en//archive/paxos_made_live.pdf.
  519. NO_FAIL_WITH_NO_STRESS_FOR_LIVENESS = 301;
  520. // FAILPOINTS injects failpoints to etcd server runtime, triggering panics
  521. // in critical code paths.
  522. FAILPOINTS = 400;
  523. // EXTERNAL runs external failure injection scripts.
  524. EXTERNAL = 500;
  525. }
  526. enum Stresser {
  527. KV = 0;
  528. LEASE = 1;
  529. ELECTION_RUNNER = 2;
  530. WATCH_RUNNER = 3;
  531. LOCK_RACER_RUNNER = 4;
  532. LEASE_RUNNER = 5;
  533. }
  534. enum Checker {
  535. KV_HASH = 0;
  536. LEASE_EXPIRE = 1;
  537. RUNNER = 2;
  538. NO_CHECK = 3;
  539. }