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

NodeOptions copy() 是否漏掉了RpcOptions相关属性的复制 #889

Closed
lfygh opened this issue Oct 9, 2022 · 2 comments · Fixed by #902
Closed

NodeOptions copy() 是否漏掉了RpcOptions相关属性的复制 #889

lfygh opened this issue Oct 9, 2022 · 2 comments · Fixed by #902

Comments

@lfygh
Copy link
Contributor

lfygh commented Oct 9, 2022

public class NodeOptions extends RpcOptions implements Copiable<NodeOptions> 

public class RpcOptions {
    private int                       rpcConnectTimeoutMs        = 1000;
    private int                       rpcDefaultTimeout          = 5000;
}

public NodeOptions copy() {
        final NodeOptions nodeOptions = new NodeOptions();
        nodeOptions.setElectionTimeoutMs(this.electionTimeoutMs);
        nodeOptions.setElectionPriority(this.electionPriority);
        nodeOptions.setDecayPriorityGap(this.decayPriorityGap);
        nodeOptions.setSnapshotIntervalSecs(this.snapshotIntervalSecs);
        nodeOptions.setSnapshotLogIndexMargin(this.snapshotLogIndexMargin);
        nodeOptions.setCatchupMargin(this.catchupMargin);
        nodeOptions.setFilterBeforeCopyRemote(this.filterBeforeCopyRemote);
        nodeOptions.setDisableCli(this.disableCli);
        nodeOptions.setSharedTimerPool(this.sharedTimerPool);
        nodeOptions.setTimerPoolSize(this.timerPoolSize);
        nodeOptions.setCliRpcThreadPoolSize(this.cliRpcThreadPoolSize);
        nodeOptions.setRaftRpcThreadPoolSize(this.raftRpcThreadPoolSize);
        nodeOptions.setEnableMetrics(this.enableMetrics);
        nodeOptions.setRaftOptions(this.raftOptions == null ? new RaftOptions() : this.raftOptions.copy());
        nodeOptions.setSharedElectionTimer(this.sharedElectionTimer);
        nodeOptions.setSharedVoteTimer(this.sharedVoteTimer);
        nodeOptions.setSharedStepDownTimer(this.sharedStepDownTimer);
        nodeOptions.setSharedSnapshotTimer(this.sharedSnapshotTimer);
        return nodeOptions;
    }

比如上述的rpcConnectTimeoutMs属性,copy()中没有相关set方法

@fengjiachun
Copy link
Contributor

是漏了,欢迎贡献一个 PR

@lfygh
Copy link
Contributor Author

lfygh commented Oct 10, 2022

👌

lfygh pushed a commit to lfygh/sofa-jraft that referenced this issue Oct 19, 2022
lfygh pushed a commit to lfygh/sofa-jraft that referenced this issue Oct 20, 2022
lfygh pushed a commit to lfygh/sofa-jraft that referenced this issue Oct 20, 2022
…elds. Fixes sofastackgh-889

fix(NodeOptions): NodeOptions.copy() without base class RpcOptions fields. Fixes sofastackgh-889
killme2008 pushed a commit that referenced this issue Nov 16, 2022
…elds. Fixes gh-889 (#902)

fix(NodeOptions): NodeOptions.copy() without base class RpcOptions fields. Fixes gh-889

Co-authored-by: “yanguanghui” <yanguanghui@betalpha.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants