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

init peer #138

Merged
merged 4 commits into from Mar 5, 2019
Merged

init peer #138

merged 4 commits into from Mar 5, 2019

Conversation

zhangjinpeng87
Copy link
Contributor

Signed-off-by: zhangjinpeng1987 zhangjinpeng@pingcap.com

Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
readyCnt int
}

func NewReadIndexQueue() *ReadIndexQueue {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this function, &ReadIndexQueue{} or new(ReadIndexQueue) will do.

queue []*ProposalMeta
}

func newProposalQueue() *ProposalQueue {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function can be removed too.

}
}

func (q *ProposalQueue) Pop(term uint64) *ProposalMeta {
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/Pop/PopFront

WrittenKeys uint64
}

func NewPeerStat() *PeerStat {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

PendingMergeApplyResult *WaitApplyResultStat
PeerStat *PeerStat

applyRouter router
Copy link
Collaborator

Choose a reason for hiding this comment

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

This field is not present in TikV.

}

type Peer struct {
Cfg *Config
Copy link
Collaborator

Choose a reason for hiding this comment

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

TiKV doesn't have this field.

Applied: appliedIndex,
CheckQuorum: true,
PreVote: cfg.Prevote,
Storage: ps,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing skip_bcast_commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add it later, not this pr.

PeerHeartbeats: make(map[uint64]time.Time),
PeersStartPendingTime: make(map[uint64]time.Time),
RecentAddedPeer: NewRecentAddedPeer(uint64(cfg.RaftRejectTransferLeaderDuration.Seconds())),
SizeDiffHint: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can remove those zero value fields.

Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
@coocood
Copy link
Collaborator

coocood commented Mar 5, 2019

LGTM

@coocood coocood merged commit 0dcb239 into ngaut:master Mar 5, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants