Skip to content

WIP - clean up gogo: POC - #21261

Closed
liggitt wants to merge 19 commits into
etcd-io:mainfrom
liggitt:protoc
Closed

WIP - clean up gogo: POC#21261
liggitt wants to merge 19 commits into
etcd-io:mainfrom
liggitt:protoc

Conversation

@liggitt

@liggitt liggitt commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

xref #14533 (comment)

Parts of this split out and merged as:

Other work: remove gogo use in https://github.com/etcd-io/raft

Remaining commit breakdown:

pre-work internal-only cleanup (can be pulled out to individual PRs to pass CI and merge)

  • cleanup: use nil-safe getters
  • test: use protocmp.Transform
  • vet: fix error message construction
  • internal: pass messages by pointer

pre-work with potential performance implications (needs review for correctness and performance impact, can be pulled out to an individual PR to pass CI and merge)

  • internal: clone messages instead of shallow copy

pre-work with user-facing Go API implications (POC-only, there may be better ways to accomplish the same goal for each of these, these need review and agreement; can be pulled out to individual PRs to pass CI and merge)

  • client: stop wrapping mvccpb.Event type
  • client: stop wrapping authpb.UserAddOptions type
  • client: stop passing proto by value
  • client: fix Cmp proto pass by value
  • server: stop passing Snapshot by value
  • server: stop passing mvccpb.KeyValue by value
  • etcdctl: stop passing proto by value

generator changes

  • Switch to standard protoc-gen-go
  • Drop gogo reference
  • Drop grpc-gateway gogo message v2 hack

regenerate / recover:

  • generate: scripts/genproto.sh
  • recover: Use proto.Marshal/Unmarshal/Size/Clone, proto v2 interface
  • recover: shim etcdctl JSON marshaling/unmarshaling of TxnResponse (needs review / agreement, json unmarshal of proto one-of field was a little weird before)
  • generate: scripts/fix/mod-tidy.sh

/hold POC only, not merge-ready

@k8s-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: liggitt
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot

Copy link
Copy Markdown

Hi @liggitt. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@serathius

Copy link
Copy Markdown
Member

/ok-to-test

@serathius

serathius commented Feb 6, 2026

Copy link
Copy Markdown
Member

Now I'm little scared to ask @liggitt for guidance. Really appreciate the help.

@codecov

codecov Bot commented Feb 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.75510% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.50%. Comparing base (f0c0ca0) to head (f71d836).
⚠️ Report is 150 commits behind head on main.

⚠️ Current head f71d836 differs from pull request most recent head d149059

Please upload reports for the commit d149059 to get more accurate results.

Files with missing lines Patch % Lines
server/etcdserver/v3_server.go 37.93% 18 Missing ⚠️
server/storage/wal/wal.go 82.97% 2 Missing and 6 partials ⚠️
server/etcdserver/api/v3rpc/interceptor.go 44.44% 5 Missing ⚠️
server/etcdserver/apply/apply_v2.go 70.58% 3 Missing and 2 partials ⚠️
server/storage/storage.go 50.00% 5 Missing ⚠️
etcdutl/etcdutl/bucket_command.go 0.00% 4 Missing ⚠️
pkg/pbutil/pbutil.go 66.66% 2 Missing and 2 partials ⚠️
server/lease/leasehttp/http.go 55.55% 0 Missing and 4 partials ⚠️
client/v3/concurrency/election.go 0.00% 2 Missing ⚠️
etcdutl/etcdutl/common.go 33.33% 2 Missing ⚠️
... and 18 more
Additional details and impacted files
Files with missing lines Coverage Δ
client/v3/mock/mockserver/mockserver.go 0.00% <ø> (ø)
etcdutl/snapshot/v3_snapshot.go 58.58% <100.00%> (+0.28%) ⬆️
server/etcdserver/api/v3election/election.go 2.77% <100.00%> (-59.30%) ⬇️
server/etcdserver/api/v3lock/lock.go 10.00% <100.00%> (-66.48%) ⬇️
server/etcdserver/api/v3rpc/auth.go 18.47% <ø> (-33.01%) ⬇️
server/etcdserver/api/v3rpc/key.go 13.69% <ø> (-66.04%) ⬇️
server/etcdserver/api/v3rpc/lease.go 3.89% <ø> (-77.93%) ⬇️
server/etcdserver/api/v3rpc/maintenance.go 35.05% <ø> (-38.72%) ⬇️
server/etcdserver/api/v3rpc/member.go 56.45% <ø> (-37.10%) ⬇️
server/etcdserver/apply/apply.go 47.22% <100.00%> (-45.64%) ⬇️
... and 47 more

... and 124 files with indirect coverage changes

@@             Coverage Diff             @@
##             main   #21261       +/-   ##
===========================================
- Coverage   68.37%   53.50%   -14.88%     
===========================================
  Files         429      429               
  Lines       35391    35355       -36     
===========================================
- Hits        24200    18915     -5285     
- Misses       9785    15133     +5348     
+ Partials     1406     1307       -99     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0c0ca0...d149059. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@serathius

serathius commented Feb 6, 2026

Copy link
Copy Markdown
Member

I think the PR clarifies a lot on the work that needs to be done, however it will take some time to fix tests and push it through review. @liggitt do you plan to finish it?

I think the etcd community could do the heavy lifting if needed. Let me know if you need help with next steps.

Comment on lines +99 to +112
type TxnResponseJSON struct {
Header *pb.ResponseHeader `json:"header,omitempty"`
Succeeded bool `json:"succeeded"`
Responses []ResponseOpJSON `json:"responses,omitempty"`
}
type ResponseOpJSON struct {
Response ResponseOpResponseJSON `json:"Response"`
}
type ResponseOpResponseJSON struct {
ResponseRange *pb.RangeResponse `json:"response_range,omitempty"`
ResponsePut *pb.PutResponse `json:"response_put,omitempty"`
ResponseDeleteRange *pb.DeleteRangeResponse `json:"response_delete_range,omitempty"`
ResponseTxn *pb.TxnResponse `json:"response_txn,omitempty"`
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the purpose of these change to keep the behaviour of gogo/protobuf? Can we not add these patch?

Users may use etcdctl or use client SDK, the TXN response will not be consistent if we add these patch. We just need to document the behaviour change for etcdctl.

cc @fuweid @liggitt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The goal was to preserve the current user-visible json output of etcdctl for these types. I'm not 100% sure I accomplished that, or whether users have scripted against etcdctl json output (that seems likely)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We just need to document the behaviour change for etcdctl

I wasn't sure changing that wire format was acceptable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The goal was to preserve the current user-visible json output of etcdctl for these types

Yes, I understood that now. But as I mentioned above, the JSON output of TXN response of etcdctl won't be consistent with etcd client SDK anymore. Note that users may use etcd client SDK or etcdctl. I think the former (using sdk) should be more common if they want to programmatically parse the TXN json output.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It depends on how many users are using etcdctl txn -w json in production.
Personally, I am ok with making this break change :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@fuweid yes, using protojson for all messages is a breaking change, we shouldn't do it.

Let's aim to keep etcdctl's fully compatible with etcd v3.6's behaviour.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @liggitt are you still working on this? I noticed you’ve been pushing commits to keep it up to date. If you’d like to get it ready for review, please let us know. Otherwise, I can split this into smaller changes and send them as a few separate pull requests. (commits are almost ready) Thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not really working on advancing this, was mostly rebasing to try to play with the github feature around stacked PRs (https://github.github.com/gh-stack/) but it looks like that doesn't support personal-fork / upstream-PR yet (github/gh-stack#18)

Otherwise, I can split this into smaller changes and send them as a few separate pull requests. (commits are almost ready) Thanks.

Go ahead, thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! @liggitt :)

ping @serathius @ahrtr We can work (review) on RangeStream first and then I will send the changes after that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can work (review) on RangeStream first and then I will send the changes after that.

Why should we wait if there isn’t a PR ready for review? While RangeStream is important, it’s a relatively simple change. In contrast, gogo/protobuf is more complex and will require significantly more effort.

liggitt added 7 commits April 14, 2026 10:31
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
liggitt added 12 commits April 14, 2026 11:06
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
This could be done more gradually, one proto API directory at a time, or one module at a time

Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Jordan Liggitt <liggitt@google.com>
@k8s-ci-robot

Copy link
Copy Markdown

@liggitt: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-grpcproxy-e2e-amd64 d149059 link true /test pull-etcd-grpcproxy-e2e-amd64
pull-etcd-grpcproxy-e2e-arm64 d149059 link true /test pull-etcd-grpcproxy-e2e-arm64
pull-etcd-e2e-386 d149059 link true /test pull-etcd-e2e-386
pull-etcd-integration-4-cpu-amd64 d149059 link true /test pull-etcd-integration-4-cpu-amd64
pull-etcd-e2e-arm64 d149059 link true /test pull-etcd-e2e-arm64
pull-etcd-e2e-amd64 d149059 link true /test pull-etcd-e2e-amd64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@liggitt

liggitt commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

closing this since the work got picked up by other maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

6 participants