chef-bach icon indicating copy to clipboard operation
chef-bach copied to clipboard

Need to remove unused zookeeper functions

Open bijugs opened this issue 6 years ago • 9 comments

For e.g. here, the code got changed from :path to 'path' which is not recognized by ZooKeeper ruby.

bijugs avatar Apr 06 '18 20:04 bijugs

Ouch. Looks like a mistake when trying to move from pre- to post-1.9 hash syntax. Should read like this I think: path: znode_path, data: node_name

vt0r avatar Apr 06 '18 20:04 vt0r

:path still works, but we have 'path' in quotes which I think never worked. The change went in as part of the commit "cf690ae7f5da6b9cf240b075bbbc01df8704c32a". If we have moved to locking cookbook, assuming some of these functions can be removed.

bijugs avatar Apr 06 '18 20:04 bijugs

@bijugs Do you have an error message?

leochen4891 avatar Apr 06 '18 20:04 leochen4891

We should have moved to locking_resource now. If we can remove these functions too that'd be great! As I recall formatting the HDFS ZKFC znode may use these znode handling functions though.

cbaenziger avatar Apr 06 '18 20:04 cbaenziger

ran zk.create('path' => znode_path, 'data' => node_name) manually on chef-shell and it returns a RC of -8 which corresponds to ZBADARGUMENTS. The chef-bach function returns false as if it is an issue with acquiring the lock i.e. creation of znode.

bijugs avatar Apr 06 '18 20:04 bijugs

chef (12.19.36)> ret = zk.create('path' => znode_path, 'data' => node_name)
Zookeeper::Exceptions::BadArguments: Supported arguments are: [:path, :data, :acl, :ephemeral, :sequence, :callback, :callback_context], but arguments ["path", "data"] were supplied instead
        from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/zookeeper-1.4.11/lib/zookeeper/client_methods.rb:267:in `assert_keys'
        from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/zookeeper-1.4.11/lib/zookeeper/client_methods.rb:90:in `create'
        from (irb):24
        from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/shell.rb:75:in `block in start'
        from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/shell.rb:74:in `catch'
        from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/shell.rb:74:in `start'
        from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/bin/chef-shell:34:in `<top (required)>'
        from /usr/bin/chef-shell:57:in `load'
        from /usr/bin/chef-shell:57:in `<main>'

path: znode_path, data: node_name

works, thanks Sal

leochen4891 avatar Apr 06 '18 20:04 leochen4891

So nothing should be calling acquire_restart_lock or zk.create in Chef-BACH any more -- that should now all be in locking_restart; that looks to be orphaned code? The only znode related function still called in Chef-BACH should be znode_exists.

@bijugs Where are you seeing zk.create run?

cbaenziger avatar Apr 06 '18 21:04 cbaenziger

As I mentioned in my earlier comment, if these functions are not used anymore we should remove them and this will be a non issue. It will prevent from any future use as I was trying to use it.

bijugs avatar Apr 06 '18 21:04 bijugs

Cool! Thanks @bijugs ; I've updated the title to reflect the desired direction and what is up. Yes, let us remove all Zookeeper related functions out of bcpc

cbaenziger avatar Apr 06 '18 21:04 cbaenziger