Annotate proto messages with version and detect etcd version generated the wal#13216
Annotate proto messages with version and detect etcd version generated the wal#13216ptabor merged 1 commit intoetcd-io:mainfrom
Conversation
22b26c1 to
b52a31d
Compare
3d661c6 to
3917301
Compare
|
cc @lilic |
lilic
left a comment
There was a problem hiding this comment.
Couple of initial questions haven't looked at the wal code yet.
| membershippb.ClusterVersionSetRequest cluster_version_set = 1300; | ||
| membershippb.ClusterMemberAttrSetRequest cluster_member_attr_set = 1301; | ||
| membershippb.DowngradeInfoSetRequest downgrade_info_set = 1302; | ||
| membershippb.ClusterVersionSetRequest cluster_version_set = 1300 [(versionpb.etcd_version_field) = "3.5"]; |
There was a problem hiding this comment.
Just trying to understand, will these changes need to be backported to 3.5 release as well? Would this create any compatibility issues?
There was a problem hiding this comment.
No, storage downgrade is done by older binaries. It's enough to have those annotations in v3.6, so it can verify the WAL and mark it as v3.5 compatible. v3.5 doesn't need to now about annotations.
| AuthEnableRequest auth_enable = 1000; | ||
| AuthDisableRequest auth_disable = 1011; | ||
| AuthStatusRequest auth_status = 1013; | ||
| AuthStatusRequest auth_status = 1013 [(versionpb.etcd_version_field) = "3.5"]; |
There was a problem hiding this comment.
Did you have to manually write these versions, if so will they change in future release will we have to keep bumping them?
There was a problem hiding this comment.
No need to bump them, those annotations indicate etcd version that introduced the specific field/message. However any new message/field added after this change should include those annotations.
There was a problem hiding this comment.
Thanks for that.
However any new message/field added after this change should include those annotations.
is this enforced in any way? e.g. with tests or failure of proto generation?
There was a problem hiding this comment.
+1 to enforcing.
If we had no 'message level annotations', it would be easier to enforce no fields without an annotation
in the transitive proto-descriptor.
There was a problem hiding this comment.
Enforcing is definitely in the plan. It might be a little harder to implement with message and enum annotations, but it should be possible if we introduce allowlisting (enforcer will require always message version set, but for fields only if they are not in allow list maintained by enforcer).
Decided on splitting message vs field and enum vs enum value based on:
- Enum default value (equal 0) will never be considered set, so annotating it doesn't make sense. It can be also confusing as someone might think that setting this enum value will mean that required etcd version is changed, but it's not.
- Messages with no fields, for example AuthStatusRequest. We technically can determine the version based on field annotation that uses this message, but I think it might become confusing when we will add some fields to this message. Decided that messages should be self sufficient to define their etcd version.
- Readability, having this annotation on each and every field makes the proto much less readable. I would prefer to keep the proto definition cleaner and even if the enforces will be more complicated.
There was a problem hiding this comment.
Enforcing of the version is not done to all the proto files, like lease.proto doesn't have it, so how do we determine going forward which require a version field in a tested way?
There was a problem hiding this comment.
For storage versioning we just need to ensure that protos used in WAL have annotations. This means that we should look for all submessages from raftpb.Entry as a root. We might consider expanding this to all proto if that would useful for other purposes.
| AuthEnableRequest auth_enable = 1000; | ||
| AuthDisableRequest auth_disable = 1011; | ||
| AuthStatusRequest auth_status = 1013; | ||
| AuthStatusRequest auth_status = 1013 [(versionpb.etcd_version_field) = "3.5"]; |
There was a problem hiding this comment.
+1 to enforcing.
If we had no 'message level annotations', it would be easier to enforce no fields without an annotation
in the transitive proto-descriptor.
da1f4e1 to
bdaebb0
Compare
|
Addressed/responded on all issues. PTAL |
lilic
left a comment
There was a problem hiding this comment.
Mainly reviewed as I was re-reading the storage versioning design doc.
| AuthEnableRequest auth_enable = 1000; | ||
| AuthDisableRequest auth_disable = 1011; | ||
| AuthStatusRequest auth_status = 1013; | ||
| AuthStatusRequest auth_status = 1013 [(versionpb.etcd_version_field) = "3.5"]; |
There was a problem hiding this comment.
Enforcing of the version is not done to all the proto files, like lease.proto doesn't have it, so how do we determine going forward which require a version field in a tested way?
de6d681 to
5d3d98c
Compare
bf11d4f to
f36eec0
Compare
…enerated wal Co-authored-by: Lili Cosic <cosiclili@gmail.com>
Any update on this ? |
Implements annotations as part of #13168
This PR introduces custom proto annotations etcd_version_msg, etcd_version_field, etcd_version_enum, etcd_version_enum_value.
They will be used to indicate which version a specific field/message/enum etc was introduced, and will be used during downgrade to check compatibility. For example when downgrading storage to v3.5 we should make sure wal doesn't include any message or sets any field from v3.6+. As result we can be sure that WAL will be correctly interpreted by older version.
Notes to reviewer: