Skip to content

Conversation

@mladjan-gadzic
Copy link
Contributor

What changes were proposed in this pull request?

Add state field for container replica response for Recon API.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-7098

How was this patch tested?

  • manual
  • unit

required int64 firstSeenTime = 2;
required int64 lastSeenTime = 3;
required int64 bcsId = 4;
required string state = 5;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An idea was to pull an enum from https://github.com/mladjan-gadzic/ozone/blob/HDDS-7098/hadoop-hdds/interface-server/src/main/proto/ScmServerDatanodeHeartbeatProtocol.proto#L213 and use it here in order not to maintain same enum in two places but I could not make it. Because of that I decided not to use enum at all and stick with string instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

will it be backward compatible if it's a required field, or is backward compat not a concern here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say backward compatibility is not a concern here.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would break rolling upgrade, or when recon and SCM are in different versions.

I see that rolling upgrade is not yet a thing, so I am okay with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

There needs to be a powerful reason for making the proto message required. I would change this to optional. If the code depends on it, it should handle it rather than having proto layer throw an exception on parsing.

@neils-dev neils-dev added the gr label Mar 21, 2023
@mladjan-gadzic mladjan-gadzic marked this pull request as ready for review March 24, 2023 10:52
@adoroszlai adoroszlai requested a review from errose28 March 25, 2023 11:38
@kerneltime
Copy link
Contributor

cc @adoroszlai can you please take a look?

Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

It would be ideal to reuse the State Enum type.
Would the answer in this stackoverflow article help address the import problem? https://stackoverflow.com/questions/66524793/how-to-use-the-enum-of-one-proto-file-in-another-file

@mladjan-gadzic
Copy link
Contributor Author

mladjan-gadzic commented Apr 4, 2023

It would be ideal to reuse the State Enum type. Would the answer in this stackoverflow article help address the import problem? https://stackoverflow.com/questions/66524793/how-to-use-the-enum-of-one-proto-file-in-another-file

@jojochuang thanks for the review. I like that idea as well. I've tried it, but there is an issue with backward compatibility: [ERROR] Failed to execute goal com.salesforce.servicelibs:proto-backwards-compatibility:1.0.7:backwards-compatibility-check (default) on project hdds-interface-server: Backwards compatibility check failed! You can override this by specifying allowBreakingChanges=true -> [Help 1]. I'd say we should not break it, especially because I am not aware of the consequences it could have on the system

@adoroszlai
Copy link
Contributor

It would be ideal to reuse the State Enum type. Would the answer in this stackoverflow article help address the import problem? https://stackoverflow.com/questions/66524793/how-to-use-the-enum-of-one-proto-file-in-another-file

I've tried it, but there is an issue with backward compatibility

Does the compatibility check also fail if the field is optional instead of required?

@mladjan-gadzic
Copy link
Contributor Author

It would be ideal to reuse the State Enum type. Would the answer in this stackoverflow article help address the import problem? https://stackoverflow.com/questions/66524793/how-to-use-the-enum-of-one-proto-file-in-another-file

I've tried it, but there is an issue with backward compatibility

Does the compatibility check also fail if the field is optional instead of required?

Yes, it does. Backward compatibility check fails for hdds-interface-server from which I've tried to pull an enum. Furthermore I tried using optional there, but no avail.

Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

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

Not being able to use the enum is somewhat unfortunate, but there is a precedent for using the string state in hdds.proto from SCMContainerReplicaProto, which likely had to use a string for the same reason. I have one question inline, but overall LGTM if others are satisfied with the current state of the protos.

Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

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

Thanks for the update @mladjan-gadzic LGTM. Does anyone involved in the earlier proto discussion have outstanding concerns? @kerneltime @jojochuang @adoroszlai

@mladjan-gadzic
Copy link
Contributor Author

@errose28 thanks for the review!

@adoroszlai
Copy link
Contributor

Failure of TestOzoneManagerHASnapshot is unrelated and it has been fixed on master since then.

@adoroszlai adoroszlai merged commit 1afb6fa into apache:master May 22, 2023
@adoroszlai
Copy link
Contributor

Thanks @mladjan-gadzic for the patch, @devmadhuu, @errose28, @jojochuang, @kerneltime for the review.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants