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

Waltz commands should be idempotent #22

Open
whynick1 opened this issue Jul 8, 2019 · 1 comment
Open

Waltz commands should be idempotent #22

whynick1 opened this issue Jul 8, 2019 · 1 comment

Comments

@whynick1
Copy link
Contributor

whynick1 commented Jul 8, 2019

Verifying cluster does not already exist...
Cluster already exists. Aborting.
[20:43:44 17560 williamp@poc-waltz01]$ java com.wepay.waltz.tools.zk.ZooKeeperCli add-storage-node --zookeeper 127.0.0.1:2181 --root /wrptest --storage 127.0.0.1:13000 --group  0
[success] Storage node added!

[20:47:57 17560 williamp@poc-waltz01]$ java com.wepay.waltz.tools.zk.ZooKeeperCli add-storage-node --zookeeper 127.0.0.1:2181 --root /wrptest --storage 127.0.0.1:13000 --group  0
[failed] Storage node already exists.

[20:48:11 17560 williamp@poc-waltz01]$ echo $?
0

If a cluster already exists, an attempt to create it should succeed.
Similarly, an attempt to add a storage node that already exists should succeed. (In both cases, this is assuming that the currently existing cluster and the existing storage node are in the same state they would be in if they were now being initially created. I believe both of these commands are just manipulating znodes, so I think this is the case).

In the example above, we see the message '[failed] Storage node already exists', but a return value of 0 is given. This is inconsistent. If something returns 0, then by definition it has been successful. So the message indicating failure is just confusing.

@whynick1
Copy link
Contributor Author

whynick1 commented Jul 8, 2019

I think we probably want to return a non-zero exit code rather than making it act like it succeeded even though it did nothing.

from @criccomini

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

No branches or pull requests

1 participant