Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues while electing leader on a single node quorum cluster. #931

Closed
navdeep-kaur opened this issue Jan 28, 2020 · 11 comments
Closed

Issues while electing leader on a single node quorum cluster. #931

navdeep-kaur opened this issue Jan 28, 2020 · 11 comments
Assignees

Comments

@navdeep-kaur
Copy link

Hi there,

On upgrading to quorum 2.4, when we are starting up the cluster with a single node, the raft_cluster is responding with {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"no leader is currently elected"}}. The single node is unable to elect itself as the leader and is always chosen as a candidate instead.

Expected behaviour

The single node should be elected as the leader.

The idea is to spin up a single boot node and run add peer for all the other nodes that we want to add to the quorum network.

@vsmk98 vsmk98 self-assigned this Jan 28, 2020
@vsmk98
Copy link
Contributor

vsmk98 commented Jan 28, 2020

Hi @navdeep-kaur - I checked in 2.4.0 version bringing up a single node cluster and it works fine for me.

➜  7nodes git:(master) ✗ geth attach qdata/dd1/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.18-stable(quorum-v2.4.0)/darwin-amd64/go1.11.13
coinbase: 0xed9d02e382b34818e88b88a309c7fe71e65f419d
at block: 0 (Thu, 01 Jan 1970 07:30:00 +0730)
 datadir: /Users/saiv/temp/quorum-examples/examples/7nodes/qdata/dd1
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 raft:1.0 rpc:1.0 txpool:1.0 web3:1.0

> raft.cluster
[{
    hostname: "127.0.0.1",
    nodeId: "ac6b1096ca56b9f6d004b779ae3728bf83f8e22453404cc3cef16a3d9b96608bc67c4b30db88e0a5a6c6390213f7acbe1153ff6d23ce57380104288ae19373ef",
    p2pPort: 21000,
    raftId: 1,
    raftPort: 50401,
    role: "minter"
}]

Can you please check if the static-nodes.json is having only one entry (the node which you are bringing up)?

@navdeep-kaur
Copy link
Author

@vsmk98 we have entries for all nodes (that will be added ) in the quorum network in the static-nodes.json when we start the network with a single node. This used to work in v2.2.3. Has something changed around this?

@MrHmP
Copy link

MrHmP commented Jan 28, 2020

@vsmk98 this used to work in v2.2.3, has something updated in v2.4.0
@jpmsam @felixonmars

@vsmk98
Copy link
Contributor

vsmk98 commented Jan 28, 2020

@MrHmP, @navdeep-kaur , there is no change in the raft consensus behaviour between 2.2.3 and 2.4.0. In both versions, the minter election will not happen and if you check the logs in version 2.2.3 you will see that the 1 node which is up is continuously trying to elect a leader. Further if you check the raft.role for this node in version 2.2.3 it will be shown as verifier and no transactions can be processed from this node. This is because raft algorithm considers the entries in static-nodes.json as the initial quorum and would expect majority voting from this quorum for electing leader.

In 2.4.0 as a part of the API response we also wanted to return the role of the node in the network. Because of this if there is no leader in the network, the api returns an error.

For your scenario, my suggestion will be to

  1. bring up a single node network with one entry in static-nodes.json
  2. As the new nodes come, use raft.addPeer to add the new node
  3. Bring up the new node with --raftjoinexistsing <<raftid>> to join the network

Please let me know if this is workable for your scenario.

@vsmk98
Copy link
Contributor

vsmk98 commented Jan 28, 2020

I am closing this issue. Please re-open if necessary.

@vsmk98 vsmk98 closed this as completed Jan 28, 2020
@Himanshu-Pandey
Copy link

I don't understand why it doesn't work with the new version if it was working for older version. Sure we have a different way of provisioning our network now, but we have to change our code for cluster deployment.
We are forced to use older version because of this.
@vsmk98

@vsmk98 vsmk98 reopened this Jan 28, 2020
@vsmk98
Copy link
Contributor

vsmk98 commented Jan 28, 2020

@Himanshu-Pandey, at I mentioned, at network level it was not working with one node in 2.2.3 and its the same behaviour in 2.4.0. The only difference is raft.cluster used to return an incorrect raft quorum based on static-nodes.json in version 2.2.3, though the actual raft quorum was not there. e.g. with a single node in version 2.2.3, you will not be able to process any transactions as there will be no leader at the network level.
I understand the api response causes changes at your end. I am discussing the same and will revert back. Thanks

@jpmsam
Copy link
Contributor

jpmsam commented Jan 31, 2020

@Himanshu-Pandey thanks for your feedback. @vsmk98 is working on resolving this. The api will not return an error going forward, but it will return the cluster details with a nil for the role until a leader is elected.

@vsmk98
Copy link
Contributor

vsmk98 commented Feb 1, 2020

@Himanshu-Pandey I have created the PR to resolve this. Please refer to raft api documentation page https://github.com/jpmorganchase/quorum/blob/fix/raft-cluster-api/docs/Consensus/raft/raft-rpc-api.md for details of the raft.cluster api with this change.

@Himanshu-Pandey
Copy link

Thanks @vsmk98

@vsmk98
Copy link
Contributor

vsmk98 commented Feb 11, 2020

Closing this issue as the PR is merged.

@vsmk98 vsmk98 closed this as completed Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants