Skip to content

Commit

Permalink
Merge pull request #10725 from jingyih/learner_part1
Browse files Browse the repository at this point in the history
*: support raft learner in etcd - part 1
  • Loading branch information
xiang90 committed May 15, 2019
2 parents a44a281 + e1acf24 commit 919b93b
Show file tree
Hide file tree
Showing 25 changed files with 1,346 additions and 355 deletions.
21 changes: 21 additions & 0 deletions Documentation/dev-guide/api_reference_v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ This is a generated documentation. Please read the proto files for more.
| MemberRemove | MemberRemoveRequest | MemberRemoveResponse | MemberRemove removes an existing member from the cluster. |
| MemberUpdate | MemberUpdateRequest | MemberUpdateResponse | MemberUpdate updates the member configuration. |
| MemberList | MemberListRequest | MemberListResponse | MemberList lists all the members in the cluster. |
| MemberPromote | MemberPromoteRequest | MemberPromoteResponse | MemberPromote promotes a member from raft learner (non-voting) to raft voting member. |



Expand Down Expand Up @@ -609,6 +610,7 @@ Empty field.
| name | name is the human-readable name of the member. If the member is not started, the name will be an empty string. | string |
| peerURLs | peerURLs is the list of URLs the member exposes to the cluster for communication. | (slice of) string |
| clientURLs | clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty. | (slice of) string |
| isLearner | isLearner indicates if the member is raft learner. | bool |



Expand All @@ -617,6 +619,7 @@ Empty field.
| Field | Description | Type |
| ----- | ----------- | ---- |
| peerURLs | peerURLs is the list of URLs the added member will use to communicate with the cluster. | (slice of) string |
| isLearner | isLearner indicates if the added member is raft learner. | bool |



Expand Down Expand Up @@ -645,6 +648,23 @@ Empty field.



##### message `MemberPromoteRequest` (etcdserver/etcdserverpb/rpc.proto)

| Field | Description | Type |
| ----- | ----------- | ---- |
| ID | ID is the member ID of the member to promote. | uint64 |



##### message `MemberPromoteResponse` (etcdserver/etcdserverpb/rpc.proto)

| Field | Description | Type |
| ----- | ----------- | ---- |
| header | | ResponseHeader |
| members | members is a list of all members after promoting the member. | (slice of) Member |



##### message `MemberRemoveRequest` (etcdserver/etcdserverpb/rpc.proto)

| Field | Description | Type |
Expand Down Expand Up @@ -819,6 +839,7 @@ Empty field.
| raftAppliedIndex | raftAppliedIndex is the current raft applied index of the responding member. | uint64 |
| errors | errors contains alarm/health information and status. | (slice of) string |
| dbSizeInUse | dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member. | int64 |
| isLearner | isLearner indicates if the member is raft learner. | bool |



Expand Down
150 changes: 146 additions & 4 deletions Documentation/dev-guide/apispec/swagger/rpc.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,33 @@
}
}
},
"/v3/cluster/member/promote": {
"post": {
"tags": [
"Cluster"
],
"summary": "MemberPromote promotes a member from raft learner (non-voting) to raft voting member.",
"operationId": "MemberPromote",
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/etcdserverpbMemberPromoteRequest"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/etcdserverpbMemberPromoteResponse"
}
}
}
}
},
"/v3/cluster/member/remove": {
"post": {
"tags": [
Expand Down Expand Up @@ -820,7 +847,7 @@
"200": {
"description": "A successful response.(streaming responses)",
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseKeepAliveResponse"
"$ref": "#/x-stream-definitions/etcdserverpbLeaseKeepAliveResponse"
}
}
}
Expand Down Expand Up @@ -1009,7 +1036,7 @@
"200": {
"description": "A successful response.(streaming responses)",
"schema": {
"$ref": "#/definitions/etcdserverpbSnapshotResponse"
"$ref": "#/x-stream-definitions/etcdserverpbSnapshotResponse"
}
}
}
Expand Down Expand Up @@ -1091,7 +1118,7 @@
"200": {
"description": "A successful response.(streaming responses)",
"schema": {
"$ref": "#/definitions/etcdserverpbWatchResponse"
"$ref": "#/x-stream-definitions/etcdserverpbWatchResponse"
}
}
}
Expand Down Expand Up @@ -1882,6 +1909,11 @@
"type": "string"
}
},
"isLearner": {
"description": "isLearner indicates if the member is raft learner.",
"type": "boolean",
"format": "boolean"
},
"name": {
"description": "name is the human-readable name of the member. If the member is not started, the name will be an empty string.",
"type": "string"
Expand All @@ -1898,6 +1930,11 @@
"etcdserverpbMemberAddRequest": {
"type": "object",
"properties": {
"isLearner": {
"description": "isLearner indicates if the added member is raft learner.",
"type": "boolean",
"format": "boolean"
},
"peerURLs": {
"description": "peerURLs is the list of URLs the added member will use to communicate with the cluster.",
"type": "array",
Expand Down Expand Up @@ -1944,6 +1981,31 @@
}
}
},
"etcdserverpbMemberPromoteRequest": {
"type": "object",
"properties": {
"ID": {
"description": "ID is the member ID of the member to promote.",
"type": "string",
"format": "uint64"
}
}
},
"etcdserverpbMemberPromoteResponse": {
"type": "object",
"properties": {
"header": {
"$ref": "#/definitions/etcdserverpbResponseHeader"
},
"members": {
"description": "members is a list of all members after promoting the member.",
"type": "array",
"items": {
"$ref": "#/definitions/etcdserverpbMember"
}
}
}
},
"etcdserverpbMemberRemoveRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -2266,6 +2328,11 @@
"header": {
"$ref": "#/definitions/etcdserverpbResponseHeader"
},
"isLearner": {
"description": "isLearner indicates if the member is raft learner.",
"type": "boolean",
"format": "boolean"
},
"leader": {
"description": "leader is the member ID which the responding member believes is the current leader.",
"type": "string",
Expand Down Expand Up @@ -2508,6 +2575,43 @@
"format": "int64"
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"runtimeStreamError": {
"type": "object",
"properties": {
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
},
"grpc_code": {
"type": "integer",
"format": "int32"
},
"http_code": {
"type": "integer",
"format": "int32"
},
"http_status": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
},
"securityDefinitions": {
Expand All @@ -2521,5 +2625,43 @@
{
"ApiKey": []
}
]
],
"x-stream-definitions": {
"etcdserverpbLeaseKeepAliveResponse": {
"properties": {
"error": {
"$ref": "#/definitions/runtimeStreamError"
},
"result": {
"$ref": "#/definitions/etcdserverpbLeaseKeepAliveResponse"
}
},
"title": "Stream result of etcdserverpbLeaseKeepAliveResponse",
"type": "object"
},
"etcdserverpbSnapshotResponse": {
"properties": {
"error": {
"$ref": "#/definitions/runtimeStreamError"
},
"result": {
"$ref": "#/definitions/etcdserverpbSnapshotResponse"
}
},
"title": "Stream result of etcdserverpbSnapshotResponse",
"type": "object"
},
"etcdserverpbWatchResponse": {
"properties": {
"error": {
"$ref": "#/definitions/runtimeStreamError"
},
"result": {
"$ref": "#/definitions/etcdserverpbWatchResponse"
}
},
"title": "Stream result of etcdserverpbWatchResponse",
"type": "object"
}
}
}
53 changes: 52 additions & 1 deletion Documentation/dev-guide/apispec/swagger/v3election.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"200": {
"description": "A successful response.(streaming responses)",
"schema": {
"$ref": "#/definitions/v3electionpbLeaderResponse"
"$ref": "#/x-stream-definitions/v3electionpbLeaderResponse"
}
}
},
Expand Down Expand Up @@ -212,6 +212,43 @@
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"runtimeStreamError": {
"type": "object",
"properties": {
"grpc_code": {
"type": "integer",
"format": "int32"
},
"http_code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"http_status": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
},
"v3electionpbCampaignRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -330,5 +367,19 @@
}
}
}
},
"x-stream-definitions": {
"v3electionpbLeaderResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/v3electionpbLeaderResponse"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of v3electionpbLeaderResponse"
}
}
}

0 comments on commit 919b93b

Please sign in to comment.