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

CURATOR-704. Add server compatibility check support #497

Merged
merged 6 commits into from May 2, 2024

Conversation

laurentgo
Copy link
Contributor

Add new interface ZookeeperCompatibility to represent server compatibility in addition to the existing Compatibility class (which represents client compatibility).

Enhance CuratorFramework to accept ZookeeperCompatibility instance, allowing user to specify which server version to target (default is LATEST).

Add new interface ZookeeperCompatibility to represent server
compatibility in addition to the existing Compatibility class (which
represents client compatibility).

Enhance CuratorFramework to accept ZookeeperCompatibility instance,
allowing user to specify which server version to target (default is
LATEST).
*/
public interface ZookeeperCompatibility {
public enum Version implements ZookeeperCompatibility {
VERSION_3_5(false),
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure that enumerating the ZK versions will pay back in the future.

What about letting the user build this object?
And we provide a default instance with all the known features

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'm okay removing the enum. Do you think the user should just create the concrete class or would you prefer to introduce a Builder class to help with it?

Copy link
Member

Choose a reason for hiding this comment

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

I guess we probably are pursuing something similar to ClientBuilder::assume_server_version(I am the author). My thought was that client library know server compatibility(capabilities, bugs and etc.) given a server version.

So, I think it is Curator's responsibility to build the compatibility matrix and do the dirty work but not the caller. I think we probably need only a server version (the class and the LATEST) in api side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I changed the code to remove the enum and replace it with a class + builder combo. Let me know if you're okay with this pattern

Copy link
Member

Choose a reason for hiding this comment

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

I think all we want could be a simple (major, minor, patch) tuple. Curator can derive the compatibility matrix(ZookeeperCompatibility in your case) from (major, minor, patch).

I could be biased by ClientBuilder::assume_server_version. But I think it might not be what we want to let the caller to construct the compatibility matrix (ZookeeperCompatibility in your case). I don't think users of Curator need such level of customization.

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'm getting mixed signals here. @eolivelli proposed to remove the constant for ZK 3.5 and let user build the object (and @kezhuw put a thumbs up on this comment), but then @kezhuw is proposing to have user just provide the version and curator do the work, which seems to lean back on my original proposal.

Personally, I'd okay proposing predefined constants but asking the user to provide the full version may be overly complicating things as the only version we currently care about is 3.5 vs 3.6/3.7/3.8 (as permanent watchers seems to be the only feature we are checking for)

Copy link
Member

Choose a reason for hiding this comment

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

Apologize for this! @laurentgo

I do agree with @eolivelli that enumerate zookeeper version is not good.

as permanent watchers seems to be the only feature we are checking for

I am not sure about this.

asking the user to provide the full version may be overly complicating things as the only version we currently care about is 3.5 vs 3.6/3.7/3.8

Yes, a bit. I guess I have same worry about this. But it is a one for all in api side. That is there will be no new feature toggle apis in future. All features could derive from that version and thus implementation detail.

Given all the candidates(feature enum, feature builder and version class), I prefer to a version class currently.

Any idea ? @eolivelli @tisonkun

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as permanent watchers seems to be the only feature we are checking for

I am not sure about this.

If there are other features (which are not captured by Compatibility class I guess), I'd gladly add those but I don't know enough of Curator/Zookeeper to quickly identify those

Copy link
Member

Choose a reason for hiding this comment

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

If there are other features (which are not captured by Compatibility class I guess)

This is what I am care about. We have to add new hasXyz each time we find one which I think is not good. But that is fine. We are unlikely to have ten features anyway 😄 .

@laurentgo
Copy link
Contributor Author

laurentgo commented Mar 11, 2024

@eolivelli can you help me to understand the CI / Check failure? It seems to be a license check but AFAIK ZookeeperCompatibility` class does have the ASF header.

It looks like a newline after the license header was missing

@kezhuw kezhuw changed the title CURATOR-709. Add server compatibility check support CURATOR-704. Add server compatibility check support Mar 13, 2024
@laurentgo
Copy link
Contributor Author

Gentle ping. Can I get some guidance on how to make progress on this change?

@laurentgo
Copy link
Contributor Author

I'm still interesting in having this issue addressed. Is there anything I can do to to help with this?

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

I am sorry for so late reply.
The notification was lost.

LGTM

@tisonkun @kezhuw can you please take a look? I hope we can ship this soon. It is has been parked here for too much time

@kezhuw
Copy link
Member

kezhuw commented Apr 29, 2024

+1 to the general idea and +1 to ship it. Better than never!

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

To be clear, this is a user-specified server compatibility data class.

I'm OK to see its usage in production.

@eolivelli
Copy link
Contributor

I cannot restart CI, I am now trying to close/reopen the PR in order to trigger it

@eolivelli eolivelli closed this Apr 29, 2024
@eolivelli eolivelli reopened this Apr 29, 2024
@laurentgo
Copy link
Contributor Author

@eolivelli anything I can help on my side?

@tisonkun tisonkun merged commit 82f2e53 into apache:master May 2, 2024
10 of 12 checks passed
@tisonkun
Copy link
Member

tisonkun commented May 2, 2024

I'm wondering if we can drop some supported versions and reduce our test workflows time consumption ... or we should investigate in each cases. You may check https://issues.apache.org/jira/browse/CURATOR-698 also.

@laurentgo laurentgo deleted the laurentgo/curator-709 branch May 2, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants