scylladb / scylla-tools-java

Apache Cassandra, supplying tools for Scylla
Apache License 2.0
53 stars 85 forks source link

Add nodetool interposer script #361

Closed denesb closed 11 months ago

denesb commented 11 months ago

This script is intended as a wrapper for nodetool, first trying to route commands to scylla-nodetool, and if the command is unimplemented, it is routed to the java nodetool. Whether a command is implemented or not is determined by checking the exit-code of scylla-nodetool. An unimplemented command uses a unique exit-code of 100. When this is seen, the command is routed to Java nodetool. install.sh is adjusted to install nodetool as nodetool.java and nodetool-wrapper as nodetool. If scylla-nodetool is misbehaving, users can manually fall-back to the legacy nodetool, by invoking nodetool.java.

Tests: build both the unified tarball as well as the tools-java one and verified that the script works as intended at the installed location. This will also be checked by Scylla CI.

Refs: https://github.com/scylladb/scylladb/issues/15588

nyh commented 11 months ago

I'm curious, why did you want this script in scylla-tools-java.git and not scylla.git? The benefit of putting it in scylla.git is that you can later improve it (or maybe even remove it!) in the same patch with a Scylla patch, and won't need those ugly two-repository dances. But I don't insist, if you like it this way.

nyh commented 11 months ago

I'm curious, why did you want this script in scylla-tools-java.git and not scylla.git? The benefit of putting it in scylla.git is that you can later improve it (or maybe even remove it!) in the same patch with a Scylla patch, and won't need those ugly two-repository dances. But I don't insist, if you like it this way.

Oh, I misunderstood that you wanted the new script to hide the old nodetool, and other projects (e.g., dtest) which used the old nodetool will start to use yours. Then I guess I understand why it needs to be in the nodetool repository. So sorry about the spam.

tchaikov commented 11 months ago

for the posterity, this change was previously implemented in scylladb, see https://github.com/scylladb/scylladb/pull/16087

denesb commented 11 months ago

New in v2:

denesb commented 11 months ago

Note to maintainers: I want a CI pass before merge. I will open a special PR in scylla.git to get a CI run. After that passes, we can merge, I will keep this PR up-to-date w.r.t this. First, I'd like a consensus from reviewers.

denesb commented 11 months ago

CI PR: https://github.com/scylladb/scylladb/pull/16366

mykaul commented 11 months ago

Instead of running --help you could have run it once on installation, save it somewhere and read from there. I think it's a micro-optimization that isn't worth it though.

avikivity commented 11 months ago

Instead of running --help you could have run it once on installation, save it somewhere and read from there. I think it's a micro-optimization that isn't worth it though.

It's a micro-optimization but adds macro-complexity. Where do you store it? How do you know when to refresh it? Do you have write permissions? And in any case the whole thing disappears once we figure out what N is in 5/N.

This is just a way to get advance testing before the whole thing is complete.

avikivity commented 11 months ago

Please test with ./install.sh --prefix ~/tmp123 from the tarball, just to be sure. I think it will work with no changes (well it might not work if "tmp123" has spaces injected).

denesb commented 11 months ago

Please test with ./install.sh --prefix ~/tmp123 from the tarball, just to be sure. I think it will work with no changes (well it might not work if "tmp123" has spaces injected).

I already did test it like this. I guess I should have mentioned this in the patch log.

denesb commented 11 months ago

New in v3:

denesb commented 11 months ago

New in v3.1:

mykaul commented 11 months ago

Instead of running --help you could have run it once on installation, save it somewhere and read from there. I think it's a micro-optimization that isn't worth it though.

It's a micro-optimization but adds macro-complexity. Where do you store it? How do you know when to refresh it? Do you have write permissions? And in any case the whole thing disappears once we figure out what N is in 5/N.

This is just a way to get advance testing before the whole thing is complete.

%pre of the RPM should handle it all. I think it's few lines, but may be wrong. Again, unsure if it's worth it.

denesb commented 11 months ago

We have green light from CI: https://github.com/scylladb/scylladb/pull/16366#issuecomment-1851894236.

nyh commented 11 months ago

I merged this patch to scylla-tools-java, but we also need to do the submodule update in Scylla (that's https://github.com/scylladb/scylladb/pull/16366, I guess?).

avikivity commented 11 months ago

@nyh don't half-merge things, if you merge into the submodule then also update the submodule reference

nyh commented 11 months ago

@avikivity as I said, the second half of the merge was https://github.com/scylladb/scylladb/pull/16366 - a PR that @denesb already opened. If he hadn't, I would have to do it myself (to test the submodule update before merging it), but he already did.

denesb commented 11 months ago

@avikivity as I said, the second half of the merge was scylladb/scylladb#16366 - a PR that @denesb already opened. If he hadn't, I would have to do it myself (to test the submodule update before merging it), but he already did.

Said PR was opened for CI only. I wanted to get CI feedback while review was ongoing, as I was expecting some problems. My idea was that once we have CI pass, there is no need for the submodule update for this PR to go through another scylla.git PR.

Sorry for the confusion.

avikivity commented 11 months ago

@denesb your pull request clearly stated it's for CI only, no problem there

@nyh it's not generally possible to open pull requests for submodule updates, because submodule history is linear and does not tolerate merges. The maintainer should perform the merge and submodule update close together to avoid another merge from updating the submodule under its feet.

nyh commented 11 months ago

@nyh it's not generally possible to open pull requests for submodule updates, because submodule history is linear and does not tolerate merges. The maintainer should perform the merge and submodule update close together to avoid another merge from updating the submodule under its feet.

The latter is true, but PRs are still the best way to go (even if you have to merge them quickly), especially in submodules like Seastar where a submodule refresh can bring in a lot of unrelated changes, and they should all be tested to not break next.

avikivity commented 11 months ago

So far the procedure is for the maintainer to generate the submodule update.