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

结合 NWR 实现 Flexible raft #1005

Closed
wants to merge 18 commits into from
Closed

结合 NWR 实现 Flexible raft #1005

wants to merge 18 commits into from

Conversation

1294566108
Copy link
Contributor

Motivation:

ospp开源之夏-2023-结合 NWR 实现 Flexible raft,用于自定义 Quorum 的大小

Modification:

新增QuorumNWQ设计文档至rfcs

Result:

Fixes #<1003>.

@1294566108 1294566108 changed the title 新增rfcs- 新增rfcs-结合 NWR 实现 Flexible raft Jul 1, 2023
@shihuili1218
Copy link
Collaborator

辛苦啦,rfc可以单独提交pr

@sofastack-cla sofastack-cla bot added size/L and removed size/XL labels Jul 1, 2023
rfcs/0002-Flexible-Raft-with-NWR.md Outdated Show resolved Hide resolved
rfcs/0002-Flexible-Raft-with-NWR.md Outdated Show resolved Hide resolved
```
private boolean checkAndResetFactor(Double writeFactor, Double readFactor){
if (Objects.nonNull(readFactor) && Objects.nonNull(writeFactor)) {
if (readFactor + writeFactor != 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't compare integer type(1) with float type(readFactor + writeFactor) precisely. I think we can change the readFactor and writeFactor to be int types, and ensure that their sum is 10. Their range both are (0,10).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that if the user sets readFactor to 4 and writeFactor to 6. If in a cluster with 5 nodes, writeQuorum as 5 * 0.6=3 and readQuorum as n-w+1=5-3+1=3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's my point @1294566108

rfcs/0002-Flexible-Raft-with-NWR.md Outdated Show resolved Hide resolved
@sofastack-cla sofastack-cla bot added size/XL and removed size/L labels Jul 3, 2023
@sofastack-cla sofastack-cla bot added size/XXL and removed size/XL labels Jul 6, 2023
# Conflicts:
#	jraft-core/src/main/java/com/alipay/sofa/jraft/Quorum.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/core/BallotBox.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/core/NodeImpl.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/entity/MajorityQuorum.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/entity/NWRQuorum.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/entity/QuorumConfiguration.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/entity/QuorumFactory.java
#	jraft-core/src/main/java/com/alipay/sofa/jraft/option/NodeOptions.java
#	jraft-core/src/test/java/com/alipay/sofa/jraft/entity/NWRQuorumTest.java
@1294566108 1294566108 changed the title 新增rfcs-结合 NWR 实现 Flexible raft 结合 NWR 实现 Flexible raft Jul 6, 2023
@1294566108 1294566108 closed this Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants