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(client): remove duplicate processing #15032

Closed

Conversation

wafuwafu13
Copy link
Contributor

@wafuwafu13 wafuwafu13 commented Dec 20, 2022

Signed-off-by: wafuwafu13 mariobaske@i.softbank.jp

ref: // TODO(cfc4n): keep this code block, remove codes about getToken in client.go after pr #12165 merged. https://github.com/etcd-io/etcd/pull/12165/files

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

LGTM

THank you @wafuwafu13

c.GetLogger().Error("clientv3/retry_interceptor: getToken failed", zap.Error(err))
return nil, err
}
err := c.getToken(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little confused. Are we getting a new token for each creation of a stream... and getting the token requires a separate call to etcd ? I thought we use token stored in the authTokenBundle... as long as we don't get error suggesting shouldRefreshToken...

I know it's not change in this PR, but still if you know, please let me know.

Copy link
Contributor Author

@wafuwafu13 wafuwafu13 Dec 23, 2022

Choose a reason for hiding this comment

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

I didn't understand why getToken needed to be called, but since it was mentioned in the comment, I didn't remove it.

But I think that getToken is not reqired before RecvMsg because getToken is called at client initialization and token is stored in the authTokenBundle.

Copy link
Member

Choose a reason for hiding this comment

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

Per my understanding streamClientInterceptor is just a client side stream Interceptor, but etcd only uses server side streaming (watch stream and lease keep alive), so streamClientInterceptor is only executed once on the very beginning of a stream. Note that for server-side streaming, the client side only calls SendMsg once.

So actually the token will never be refreshed during a watch stream, and it's exactly the reason of #12385, which was resolved in #14322. But unfortunately, we rollbacked the fix due to some concern on K8s side. FYI. #14992

Copy link
Member

Choose a reason for hiding this comment

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

Update: lease keep alive should be a bi-directional stream. The client side keeps sending LeaseKeepAliveRequest, and server side responds with a LeaseKeepAliveResponse each time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for letting me know. I added comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahrtr @ptabor CI passed and I have nothing to change in this PR :)

Copy link
Member

Choose a reason for hiding this comment

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

@wafuwafu13 Please squash the commits and rebase this PR.

@codecov-commenter
Copy link

codecov-commenter commented Dec 26, 2022

Codecov Report

Merging #15032 (9df449b) into main (ff71968) will decrease coverage by 0.04%.
The diff coverage is 25.00%.

@@            Coverage Diff             @@
##             main   #15032      +/-   ##
==========================================
- Coverage   74.73%   74.69%   -0.05%     
==========================================
  Files         415      415              
  Lines       34276    34275       -1     
==========================================
- Hits        25617    25601      -16     
- Misses       7017     7025       +8     
- Partials     1642     1649       +7     
Flag Coverage Δ
all 74.69% <25.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/v3/retry_interceptor.go 67.11% <25.00%> (-0.15%) ⬇️
client/v3/leasing/util.go 91.66% <0.00%> (-6.67%) ⬇️
server/etcdserver/api/v3rpc/util.go 70.96% <0.00%> (-3.23%) ⬇️
client/v3/leasing/txn.go 88.09% <0.00%> (-3.18%) ⬇️
server/proxy/grpcproxy/watch.go 92.48% <0.00%> (-2.90%) ⬇️
server/etcdserver/api/v3election/election.go 66.66% <0.00%> (-2.78%) ⬇️
client/v3/experimental/recipes/double_barrier.go 68.83% <0.00%> (-2.60%) ⬇️
client/v3/client.go 82.33% <0.00%> (-1.27%) ⬇️
client/v3/op.go 74.71% <0.00%> (-1.15%) ⬇️
server/etcdserver/raft.go 88.63% <0.00%> (-1.14%) ⬇️
... and 10 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@wafuwafu13 wafuwafu13 force-pushed the retryinterceptor-remove-todo branch 2 times, most recently from b606721 to 5f31076 Compare January 5, 2023 10:21
@ahrtr
Copy link
Member

ahrtr commented Jan 5, 2023

The second commit b606721 doesn't make any sense. Please rebase this PR instead of merging main

ahrtr and others added 23 commits January 5, 2023 19:27
Signed-off-by: Benjamin Wang <wachao@vmware.com>
…gGRPCAuthOldRevision to cache gRPC error messages

Signed-off-by: Benjamin Wang <wachao@vmware.com>
target.Endpoint and some other fields are deprecated, URL field is
suggested to use instead
path is required to be stripped of "/" prefix for naming/resolver to
work porperly

Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
…/mod

Signed-off-by: Benjamin Wang <wachao@vmware.com>
…/mod

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
…org/grpc/otelgrpc from 0.32.0 to 0.37.0 in /server

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Bumps [github.com/anishathalye/porcupine](https://github.com/anishathalye/porcupine) from 0.1.2 to 0.1.4.
- [Release notes](https://github.com/anishathalye/porcupine/releases)
- [Commits](anishathalye/porcupine@v0.1.2...v0.1.4)

---
updated-dependencies:
- dependency-name: github.com/anishathalye/porcupine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [honnef.co/go/tools](https://github.com/dominikh/go-tools) from 0.3.0 to 0.3.3.
- [Release notes](https://github.com/dominikh/go-tools/releases)
- [Commits](dominikh/go-tools@v0.3.0...v0.3.3)

---
updated-dependencies:
- dependency-name: honnef.co/go/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This PR will add `trivy-nightly-scan` for etcd images with versions `3.4.22` and `3.5.6` to scan for vulnerabilities everyday at 2AM UTC.

Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
ArkaSaha30 and others added 22 commits January 5, 2023 19:27
Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
Bumps [github.com/alexkohler/nakedret](https://github.com/alexkohler/nakedret) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/alexkohler/nakedret/releases)
- [Commits](alexkohler/nakedret@v1.0...v1.0.1)

---
updated-dependencies:
- dependency-name: github.com/alexkohler/nakedret
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.2.0 to 3.5.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@bfdd357...6edd440)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…n and old revision errors in watch'

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
Signed-off-by: ZhengSheng0524 <j13tw@yahoo.com.tw>
Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
We should call Wait for grpc-proxy process stop before start. Otherwise,
the tcp port won't be released.

Fixes: etcd-io#14926

Signed-off-by: Wei Fu <fuweid89@gmail.com>
Signed-off-by: Chao Chen <chaochn@amazon.com>
Signed-off-by: Wei Fu <fuweid89@gmail.com>
Signed-off-by: Oskar Haarklou Veileborg <ohv1020@hotmail.com>
Signed-off-by: Oskar Haarklou Veileborg <ohv1020@hotmail.com>
Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Bumps [github.com/mikefarah/yq/v4](https://github.com/mikefarah/yq) from 4.30.5 to 4.30.6.
- [Release notes](https://github.com/mikefarah/yq/releases)
- [Changelog](https://github.com/mikefarah/yq/blob/master/release_notes.txt)
- [Commits](mikefarah/yq@v4.30.5...v4.30.6)

---
updated-dependencies:
- dependency-name: github.com/mikefarah/yq/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.36 to 2.1.37.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v2.1.36...959cbb7)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.0.6 to 2.1.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](ossf/scorecard-action@99c5375...937ffa9)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
Signed-off-by: Unai Arrien <unaittxu@gmail.com>
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
@wafuwafu13
Copy link
Contributor Author

I made mistakes and will remake it.

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

Successfully merging this pull request may close these issues.