Skip to content

roachpb: remove various (gogoproto.equal) options#56602

Merged
craig[bot] merged 6 commits intocockroachdb:masterfrom
tbg:errors-no-equal
Nov 12, 2020
Merged

roachpb: remove various (gogoproto.equal) options#56602
craig[bot] merged 6 commits intocockroachdb:masterfrom
tbg:errors-no-equal

Conversation

@tbg
Copy link
Copy Markdown
Member

@tbg tbg commented Nov 12, 2020

The first commit explains why some cleanup was necessary,
the others are the result of spending a little extra time
cleaning up "unnecessarily".

There are plenty of Equals left to clean up, but the returns
were diminishing. The important part is that when additions
to the KV API are made, nobody will be forced to add the
equal option any more.

  • roachpb: don't generate Equal() on Error
  • roachpb: remove more Equal methods
  • roachpb: remove (gogoproto.equal) from api.proto
  • roachpb: mostly remove (gogoproto.equal) from data.proto
  • roachpb: remove Value.Equal
  • kvserverpb: remove Equal from ReplicatedEvalResult

tbg added 6 commits November 12, 2020 11:54
We are planning to add an `errorspb.EncodedError` to `Error`, and
if `Error` has `Equal()` codegen'ed for it, it needs to be present
on `EncodedError` as well, which it isn't. Instead of putting it
there, go the other way - there's generally no reason to have equality
methods defined on everything under the sun, in fact they can be
footguns. This first commit removes the ones that were in the way
of deleting `Error.Equal`. More cleanups will follow for other
error details.

Release note: None
This removes the `(gogoproto.equal)` option from all ErrorDetails
(and more generally everything in `errors.proto`).

Looks like they were wholly unused.

Release note: None
We had generated it on `RequestHeader`, which, by virtue of being
embedded in all KV request protos, forced said protos to all generate
it as well (as not doing so would otherwise expose the RequestHeader's
Equal on the proto itself, which gogoproto rightly lints against).

It turns out that RequestHeader doesn't need Equal, so we get to delete
a lot of (generated) code, which is always a good thing.

Release note: None
I removed all of the equal options from data.proto and added only
those back for which there was a compelling reason. In investigating,
I found a few in other proto files that could also be removed.

Release note: None
It wasn't used outside of a few tests.

Release note: None
We can compare it directly since we only ever wanted to
compare it to zero.

Release note: None
@tbg tbg requested a review from nvb November 12, 2020 10:56
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

I'm hoping this means that I can remove the EqOrdering vs. Equal confusion over in #56373.

Reviewed 3 of 3 files at r1, 2 of 2 files at r2, 2 of 2 files at r3, 14 of 14 files at r4, 6 of 6 files at r5, 9 of 9 files at r6.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@tbg
Copy link
Copy Markdown
Member Author

tbg commented Nov 12, 2020

bors r=nvanbenschoten
Tftr!

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 12, 2020

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 12, 2020

Build succeeded:

@craig craig bot merged commit a5e67b6 into cockroachdb:master Nov 12, 2020
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.

3 participants