You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "simon824 (via GitHub)" <gi...@apache.org> on 2023/02/16 05:25:41 UTC

[GitHub] [incubator-hugegraph] simon824 opened a new pull request, #2112: fix: transfer add_peer/remove_peer command to leader

simon824 opened a new pull request, #2112:
URL: https://github.com/apache/incubator-hugegraph/pull/2112

   fixed #2111
   ### Environment
   <table>
   <tr>
   	<td>
   	<td>127.0.0.1:9001
   	<td>127.0.0.1:9002
   	<td>127.0.0.1:9003
   <tr>
   	<td>server.role
   	<td>master
   	<td>worker
   	<td>worker
   <tr>
   	<td>raft.role
   	<td>replicator
   	<td>leader
   	<td>replicator
   </table>
   
   ### 1. list all peers
   ![image](https://user-images.githubusercontent.com/18065113/219275028-6e99a22c-29f4-4db0-8ecd-0edec9e5b122.png)
   ### 2. add peer 127.0.0.1:9003
   ![image](https://user-images.githubusercontent.com/18065113/219275081-4e2df9c3-2e1d-4475-bdf1-2b8de5e04d7c.png)
   ### 3. check async task
   ![image](https://user-images.githubusercontent.com/18065113/219275093-df938bd9-4f7c-468a-abf8-7d89140bcce7.png)
   ### 4. list all peers again
   ![image](https://user-images.githubusercontent.com/18065113/219275101-8c7b1ddb-b456-4bc4-8200-d098687bcba8.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] imbajin merged pull request #2112: fix: transfer add_peer/remove_peer command to leader

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin merged PR #2112:
URL: https://github.com/apache/incubator-hugegraph/pull/2112


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] codecov[bot] commented on pull request #2112: fix: transfer add_peer/remove_peer command to leader

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #2112:
URL: https://github.com/apache/incubator-hugegraph/pull/2112#issuecomment-1432549836

   # [Codecov](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2112](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9ffc153) into [master](https://codecov.io/gh/apache/incubator-hugegraph/commit/c8e0f0c3e12a47694501703e2cabfc9bd97d671c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c8e0f0c) will **decrease** coverage by `20.92%`.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #2112       +/-   ##
   =============================================
   - Coverage     69.38%   48.46%   -20.92%     
   + Complexity      977      652      -325     
   =============================================
     Files           479      481        +2     
     Lines         39655    39644       -11     
     Branches       5578     5557       -21     
   =============================================
   - Hits          27513    19212     -8301     
   - Misses         9489    18354     +8865     
   + Partials       2653     2078      -575     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ache/hugegraph/backend/store/raft/RaftContext.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9iYWNrZW5kL3N0b3JlL3JhZnQvUmFmdENvbnRleHQuamF2YQ==) | `0.00% <0.00%> (-80.96%)` | :arrow_down: |
   | [...graph/backend/store/raft/RaftGroupManagerImpl.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9iYWNrZW5kL3N0b3JlL3JhZnQvUmFmdEdyb3VwTWFuYWdlckltcGwuamF2YQ==) | `0.00% <0.00%> (-28.34%)` | :arrow_down: |
   | [...graph/backend/store/raft/rpc/AddPeerProcessor.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9iYWNrZW5kL3N0b3JlL3JhZnQvcnBjL0FkZFBlZXJQcm9jZXNzb3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ph/backend/store/raft/rpc/RemovePeerProcessor.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9iYWNrZW5kL3N0b3JlL3JhZnQvcnBjL1JlbW92ZVBlZXJQcm9jZXNzb3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...he/hugegraph/util/FixedWatchWindowRateLimiter.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC91dGlsL0ZpeGVkV2F0Y2hXaW5kb3dSYXRlTGltaXRlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...he/hugegraph/backend/store/mysql/MysqlMetrics.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLW15c3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWdlZ3JhcGgvYmFja2VuZC9zdG9yZS9teXNxbC9NeXNxbE1ldHJpY3MuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...hugegraph/backend/store/raft/RaftStoreClosure.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9iYWNrZW5kL3N0b3JlL3JhZnQvUmFmdFN0b3JlQ2xvc3VyZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...hugegraph/job/schema/OlapPropertyKeyCreateJob.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9qb2Ivc2NoZW1hL09sYXBQcm9wZXJ0eUtleUNyZWF0ZUpvYi5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...hugegraph/job/schema/OlapPropertyKeyRemoveJob.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9qb2Ivc2NoZW1hL09sYXBQcm9wZXJ0eUtleVJlbW92ZUpvYi5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ugegraph/backend/store/memory/InMemoryMetrics.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1Z2VncmFwaC9iYWNrZW5kL3N0b3JlL21lbW9yeS9Jbk1lbW9yeU1ldHJpY3MuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [200 more](https://codecov.io/gh/apache/incubator-hugegraph/pull/2112?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #2112: fix: transfer add_peer/remove_peer command to leader

Posted by "javeme (via GitHub)" <gi...@apache.org>.
javeme commented on code in PR #2112:
URL: https://github.com/apache/incubator-hugegraph/pull/2112#discussion_r1108435191


##########
hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java:
##########
@@ -133,16 +143,20 @@ public String addPeer(String endpoint) {
 
     @Override
     public String removePeer(String endpoint) {
-        E.checkArgument(this.raftNode.selfIsLeader(),
-                        "Operation add_peer can only be executed on leader");
         PeerId peerId = PeerId.parsePeer(endpoint);
-        RaftClosure<?> future = new RaftClosure<>();
         try {
-            this.raftNode.node().removePeer(peerId, future);
+            RaftClosure<?> future = new RaftClosure<>();
+            if (this.raftNode.selfIsLeader()) {
+                this.raftNode.node().removePeer(peerId, future);
+            } else {
+                RemovePeerRequest request = RemovePeerRequest.newBuilder()
+                    .setEndpoint(endpoint)

Review Comment:
   prefer to align with `.newBuilder`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org