-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
*: serve member list API with linearizable guarantee #11639
Conversation
clientv3/cluster.go
Outdated
@@ -131,6 +134,15 @@ func (c *cluster) MemberList(ctx context.Context) (*MemberListResponse, error) { | |||
return nil, toErr(ctx, err) | |||
} | |||
|
|||
func (c *cluster) MemberListLinearizable(ctx context.Context) (*MemberListResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: do we want to add new API MemberListLinearizable
? Or do we want to change the function signature of the existing API MemberList
by adding an additional input parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we giving choice to user between current stale information and linearzable guarantee? Per the issue, thought we will always go with linearzable guarantee. I believe when you said changing the current signature with an additional input - you mean a bool for linearzable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of making linearizable the new default for MemberList
call. Do we want to provide users the option (an input flag to MemberList
) to get stale member list? (which is similar to serializable range request). Previously, users could get stale member list from a member that is isolated in the cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe when you said changing the current signature with an additional input - you mean a bool for linearzable?
Yes.
Codecov Report
@@ Coverage Diff @@
## master #11639 +/- ##
==========================================
- Coverage 66.65% 66.01% -0.64%
==========================================
Files 403 403
Lines 36744 36768 +24
==========================================
- Hits 24493 24274 -219
- Misses 10753 10986 +233
- Partials 1498 1508 +10
Continue to review full report at Codecov.
|
@@ -34,6 +34,12 @@ | |||
"schema": { | |||
"$ref": "#/definitions/etcdserverpbAuthenticateResponse" | |||
} | |||
}, | |||
"default": { | |||
"description": "An unexpected error response", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, if you update commit for other changes, it would be good to keep the description consistent with rest of the file in this file and other swagger file by ending sentence with a period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... this is actually auto generated by the genproto.sh script. Not sure why it is not consistent with the existing contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! Not a big thing to worry about.
clientv3/cluster.go
Outdated
@@ -131,6 +134,15 @@ func (c *cluster) MemberList(ctx context.Context) (*MemberListResponse, error) { | |||
return nil, toErr(ctx, err) | |||
} | |||
|
|||
func (c *cluster) MemberListLinearizable(ctx context.Context) (*MemberListResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we giving choice to user between current stale information and linearzable guarantee? Per the issue, thought we will always go with linearzable guarantee. I believe when you said changing the current signature with an additional input - you mean a bool for linearzable?
f4a8a97
to
c39be95
Compare
PR updated. PTAL:) |
@jingyih perfect :) LGTM |
@jingyih Sorry for delay. Can we rebase |
- Add linearizable field to etcdserverpb.MemberListRequest. - Change behavior of clienv3 MemberList API. Now it is served with linearizable guarantee.
c39be95
to
0344b70
Compare
Done. Thanks! |
@ahrtr do you think we can backport this PR to release-3.4 client/server? This helps for autoSync get member list with linearizable guarantee. |
I don't think we should backport this PR to 3.4, because it may break the patch upgrade, such as from 3.4.16 to 3.4.21 (assuming this PR to be backported to 3.4.21). Actually it may break the upgrade from 3.4.x to 3.5.x as well. During rolling upgrade, some etcd member may still on the old version, but when the member with old version receives a request from client with the new version, it may panic because the The other breaking case when a member with the new version receives a request from a client with old version. When all etcd servers and the clients are on the new versions, then it's safe. The point is that we should be very cautious when adding any new features/fields in the protocol buffer struct. Usually we need three versions (such as adding the field in 3.5, but actually it takes effect in 3.7) to safely rotate to a new version. |
Note that we have similar issue on the lease list API, and it's in my to do list. |
Thanks @ahrtr for the insights!! I have some follow up questions if you don't mind answer.
I thought this field
Sounds like version skew between client and server is not allowed, do we have a public documentation on this? For reference: https://kubernetes.io/releases/version-skew-policy/ I doubt running 3.5 servers while client is on 3.4 might be safe though. |
I manually tried to run "
The reason should be the new field https://kubernetes.io/releases/version-skew-policy/ is good reference. But please note that we are planning to only support two minor versions. FYI. etcd-io/website#601 |
Thanks for the context that etcd only maintains 2 minor versions for well said good reasons! I am wondering the version-skew-policy between server and client versions, especially is it safe to run server 3.5 with client 3.4 or server 3.4 with client 3.5? If that's the case, backporting this CR becomes possible. /cc @jyotimahapatra |
The only concern for now it changes the default behavior, although might be wrong behavior. Please feel free to deliver a backporting PR to 3.4 for this, and we can have more discussion there, and get feeback from other maintainers as well. |
Fixes #11198