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

Dynamic Reconfiguration #273

Merged
merged 8 commits into from
May 13, 2021

Conversation

bhack-onshape
Copy link
Contributor

Exposes the dynamic reconfiguration methods from the core ZooKeeper API to the top level JavaScript ZooKeeper class.

Description

Exposes the following methods to the ZooKeeper class as both async and callback funtions:

zoo_agetconfig
zoo_awgetconfig
zoo_areconfig

The following only has one variant as it's a syncronous function
zoo_setservers

Also expose the ZOO_CONFIG_NODE constant

These allow the user to implement client side dynamic reconfiguration support.

Motivation and Context

Adds Dynamic Reconfiguration support to the client
#208

How Has This Been Tested?

Tested in an external command line ZooKeeper client application that uses this module and implements a full client Dynamic Reconfiguration workflow. Also tested unauthenticated reconfiguration from the same client app.

Implementation is a straight line from the C API to top level JavaScript functions with no interaction with other parts of the codebase.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

@DavidVujic DavidVujic self-requested a review May 6, 2021 06:26
@DavidVujic
Copy link
Collaborator

Great! Thank you for this PR @bhack-onshape !

I will have a look at it during this week.

@jbienkowski311
Copy link
Contributor

LGTM. The only thing that I have spotted missing are TypeScript definitions. @bhack-onshape do you think you would be able to add TypeScript definitions for the new methods?

There is also typedefs.js file, however I cannot remember its purpose, @DavidVujic will propably explain it better than me.

@DavidVujic
Copy link
Collaborator

LGTM. The only thing that I have spotted missing are TypeScript definitions. @bhack-onshape do you think you would be able to add TypeScript definitions for the new methods?

There is also typedefs.js file, however I cannot remember its purpose, @DavidVujic will propably explain it better than me.

The typedefs.js is for custom "data types" (objects with properties + data types) written in a JsDoc format.

The TypeScript definition file is generated using a script/cli, based on the JsDoc comments in the source code (combined with the typedefs.js file). But there are some quirks when generating that file.

If there is a need for new data types, please add them to typedefs.js and I can generate a new TypeScript definitions file in a separate PR - and try to fix the quirks too 😄

@bhack-onshape
Copy link
Contributor Author

There's no new data types but the config_version is a Number rather than int32 since it's a 64 bit. And therefore theoretically may not be representable.JSdoc comments for the new functions should be good already unless I missed something.

@jbienkowski311
Copy link
Contributor

Okay, all is clear to me now!

@DavidVujic
Copy link
Collaborator

Sorry for the delay @bhack-onshape!

I shouldn't have promised to merge this before last week, and I apologize for that. Your PR is much appreciated and I will merge this as soon as possible, but have been under heavy work load lately 😄 Things look much better now and I will try to schedule a review, merge and release package.

@bhack-onshape
Copy link
Contributor Author

That's alright @DavidVujic ! I know what a heavy work load is like :) Is not a massively urgent thing for me to get this merged and released as the npm install process for my app clones my forked repo, builds, and uses that directly rather than using this repo at the moment. So I'm not blocked on anything.

@@ -694,6 +753,11 @@ class ZooKeeper extends EventEmitter {
return NativeZk.ZOOKEEPER_READ;
}

/** @deprecated @returns {string} "/zookeeper/config" */
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should have been added to the constants.js file instead, do direct users there instead. Long term, I would like to remove all code marked as deprecated in the source code,.

I will add it in a separate PR.

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

Successfully merging this pull request may close these issues.

3 participants