rpc.proto 32 KB

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