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

raftlog: don't embed raftpb.Entry in Entry #97349

Closed
wants to merge 1 commit into from

Conversation

tbg
Copy link
Member

@tbg tbg commented Feb 20, 2023

raftpb.Entry is a fmt.Stringer, so by embedding it we were making
the string representation of structs embedding it worse.

Concretely, in #97173 I noticed that *replicatedCmd ended up just
printing the raftpb.Entry that it wrapped, which was not helpful.

Epic: none
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

`raftpb.Entry` is a `fmt.Stringer`, so by embedding it we were making
the string representation of structs embedding it worse.

Concretely, in cockroachdb#97173 I noticed that `*replicatedCmd` ended up just
printing the `raftpb.Entry` that it wrapped, which was not helpful.

Epic: none
Release note: None
@tbg tbg force-pushed the avoid-stringer-embedding branch from f5069e2 to 23dfb1a Compare February 20, 2023 12:02
@tbg tbg requested a review from pav-kv February 22, 2023 13:20
@tbg tbg marked this pull request as ready for review February 22, 2023 13:20
@tbg tbg requested a review from a team February 22, 2023 13:20
@tbg tbg requested a review from a team as a code owner February 22, 2023 13:20
@tbg
Copy link
Member Author

tbg commented Feb 22, 2023

@pavelkalinnikov this one is kind of, meh, I don't love the idea of a separate type here, but I think that blindly embedding fmt.Stringer is a bad idea (and caused loss of observability in my repros, until I added formatReplicatedCmd).

Relevant slack thread

@tbg tbg closed this Apr 26, 2023
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.

2 participants