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

fix: use updateRoundStep to track consensus state changes #1464

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ func (cs *State) updateRoundStep(round int32, step cstypes.RoundStepType) {
}
if cs.Step != step {
cs.metrics.MarkStep(cs.Step)
schema.WriteRoundState(cs.traceClient, cs.Height, round, uint8(step))
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess my previous question applies here: Isn't updateRoundStep always followed by newStep? Then we already trace changes in newStep which means we will have duplicates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not always the case. For instance I notice the NewRound steo was never triggered and also the PrecommitWait step

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh and I removed the tracing from newStep

}
}
cs.Round = round
Expand Down Expand Up @@ -706,10 +707,6 @@ func (cs *State) newStep() {

cs.nSteps++

step := uint8(cs.RoundState.Step)

schema.WriteRoundState(cs.traceClient, cs.Height, cs.Round, step)

// newStep is called by updateToState in NewState before the eventBus is set!
if cs.eventBus != nil {
if err := cs.eventBus.PublishEventNewRoundStep(rs); err != nil {
Expand Down Expand Up @@ -1518,6 +1515,7 @@ func (cs *State) enterPrecommitWait(height int64, round int32) {
defer func() {
// Done enterPrecommitWait:
cs.TriggeredTimeoutPrecommit = true
cs.updateRoundStep(round, cstypes.RoundStepPrecommitWait)
cs.newStep()
Copy link
Contributor

@staheri14 staheri14 Aug 27, 2024

Choose a reason for hiding this comment

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

We also trace round step changes in newStep(), wouldn't that cause duplicates?

Copy link
Contributor

@staheri14 staheri14 Aug 27, 2024

Choose a reason for hiding this comment

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

I misread the code, the change is fine! I think it causes duplicate entries in the traced data.

}()

Expand Down
Loading