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

refactor: improve raft connection and logging filter #15801

Closed
wants to merge 1 commit into from

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Jun 15, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

refactor: improve raft connection and logging filter

Only reuse a connection if there is no error returned from the last RPC.
When a raft RPC is finished, push the connection back for next RPC if it
returns an Ok. Otherwise it drops the connection and the next RPC will
re-create a new one. Such approach ensures no problematic connection
will be used.

Support multi log prefix filter.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Refactoring

Related Issues


This change is Reviewable

Only reuse a connection if there is no error returned from the last RPC.
When a raft RPC is finished, push the connection back for next RPC if it
returns an `Ok`. Otherwise it drops the connection and the next RPC will
re-create a new one. Such approach ensures no problematic connection
will be used.

Support multi log prefix filter.
@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Jun 15, 2024
}

fn match_prefix_many(meta: &Metadata, prefixes: &[String]) -> bool {
if is_severe(meta) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is it typo?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, warning and error logs are considered severe, is there better term for it?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. I think it's fine.

back_off_min_delay: Duration::from_secs(1),
back_off_max_delay: Duration::from_secs(60),
back_off_chances: 3,
back_off_ratio: 1.5,
Copy link
Contributor

Choose a reason for hiding this comment

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

are these params configuable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet.

@drmingdrmer drmingdrmer deleted the 81-raft-client branch June 16, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-refactor this PR changes the code base without new features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants