Repository navigation
Reject enabling debug on topologies without event loggers - #9285
dragonknightk wants to merge 2 commits into
Conversation
Closes issue 7588 ## What is the purpose of the change Nimbus now rejects a request to enable debug when the topology has no event loggers, and stores no debug options for it. The UI already disables the Debug button when topology.eventlogger.executors is 0, but the UI REST endpoint and Thrift clients could still enable debug. The check is in Nimbus.debug() because the UI REST endpoint and Thrift clients all go through it, so one check covers every entry point. It uses the existing StormCommon.hasEventLoggers() on the merged topology config, the same rule the executors use, so a null value (one event logger per worker) is still allowed. debug() does not declare InvalidTopologyException in storm.thrift, so the UI REST endpoint and Thrift clients only see a generic error; the full message is in the Nimbus log. ## How was the change tested NimbusClojurePortTest.testDebugRejectedWithoutEventLoggers submits a topology with topology.eventlogger.executors set to 0 on a simulated time LocalCluster. It checks that enabling debug at topology and at component level throws InvalidTopologyException, that no debug options are stored, and that disabling debug still succeeds. The test fails without the Nimbus change. NimbusClojurePortTest.testDebugAllowedWithNullEventLoggers submits with topology.eventlogger.executors set to null, checks that the merged config still holds null although defaults.yaml sets 0, and checks that enabling debug succeeds and is stored. testDebugOnComponent and testDebugOnGlobal now submit with one event logger, since they enable debug. NimbusClojurePortTest and NimbusTest pass, and checkstyle reports no violations for storm-server. ## Upgrade notes Enabling debug on a topology whose topology.eventlogger.executors is 0 now fails instead of succeeding with no events logged. The UI REST endpoint returns HTTP 500 and Thrift clients get a TApplicationException. Set topology.eventlogger.executors to a value greater than 0 to use debug. ## AI Disclosure Human-led contribution. Grok Bot, working for dragonknightk, assisted with this change, including the code, tests, and description. All submitted content was reviewed by a human before submission. Signed-off-by: dragonknightk <[email protected]>
rzo1
left a comment
There was a problem hiding this comment.
Thx for the contrib. The check belongs in Nimbus.debug() so every entry point is covered, and reusing StormCommon.hasEventLoggers() keeps the null = one-logger-per-worker case working. Two small nits inline, neither blocking. Agree with not declaring InvalidTopologyException on debug() in the IDL: older clients would silently drop the unknown exception field and treat the call as a success.
| throw new WrappedNotAliveException(topoName); | ||
| } | ||
| if (enable && !StormCommon.hasEventLoggers(topoConf)) { | ||
| throw new WrappedInvalidTopologyException("Cannot enable debug for topology '" |
There was a problem hiding this comment.
nit: "greater than 0" leaves out the other valid option. Maybe: "... Set topology.eventlogger.executors to a value greater than 0, or unset it (null) for one event logger per worker."
| assertThrows(InvalidTopologyException.class, | ||
| () -> nimbus.debug("t1", "spout", true, 100)); | ||
| StormBase base = cluster.getClusterState().stormBase(topoId, null); | ||
| assertFalse(base.is_set_component_debug() && !base.get_component_debug().isEmpty(), |
There was a problem hiding this comment.
nit: is_set && !isEmpty would also pass if some other entry were present. Asserting on the keys you tried is more direct, e.g. assertFalse(base.is_set_component_debug() && (base.get_component_debug().containsKey(topoId) || base.get_component_debug().containsKey("spout"))).
Closes issue 7588 ## What is the purpose of the change Nimbus now rejects a request to enable debug when the topology has no event loggers, and stores no debug options for it. The UI already disables the Debug button when topology.eventlogger.executors is 0, but the UI REST endpoint and Thrift clients could still enable debug. The check is in Nimbus.debug() because the UI REST endpoint and Thrift clients all go through it, so one check covers every entry point. It uses the existing StormCommon.hasEventLoggers() on the merged topology config, the same rule the executors use, so a null value (one event logger per worker) is still allowed. debug() does not declare InvalidTopologyException in storm.thrift, so the UI REST endpoint and Thrift clients only see a generic error; the full message is in the Nimbus log. ## How was the change tested NimbusClojurePortTest.testDebugRejectedWithoutEventLoggers submits a topology with topology.eventlogger.executors set to 0 on a simulated time LocalCluster. It checks that enabling debug at topology and at component level throws InvalidTopologyException, that component_debug contains neither the topology id nor the "spout" key, and that disabling debug still succeeds. The test fails without the Nimbus change. NimbusClojurePortTest.testDebugAllowedWithNullEventLoggers submits with topology.eventlogger.executors set to null, checks that the merged config still holds null although defaults.yaml sets 0, and checks that enabling debug succeeds and is stored. testDebugOnComponent and testDebugOnGlobal now submit with one event logger, since they enable debug. NimbusClojurePortTest and NimbusTest pass, and checkstyle reports no violations for storm-server. ## Upgrade notes Enabling debug on a topology whose topology.eventlogger.executors is 0 now fails instead of succeeding with no events logged. The UI REST endpoint returns HTTP 500 and Thrift clients get a TApplicationException. Set topology.eventlogger.executors to a value greater than 0, or unset it (null) for one event logger per worker. ## AI Disclosure Human-led contribution. Grok Bot, working for dragonknightk, assisted with this change, including the code, tests, and description. All submitted content was reviewed by a human before submission. Signed-off-by: dragonknightk <[email protected]>
|
@rzo1 Thanks for the review! Both nits are addressed: the error message now also mentions unsetting topology.eventlogger.executors (null) for one event logger per worker, and the test now asserts that neither the topology id nor the "spout" key was written to component_debug. (。•̀ᴗ-)✧ |
Fixes #7588
What is the purpose of the change
Nimbus now rejects a request to enable debug when the topology has no event loggers, and stores no debug options for it. The UI already disables the Debug button when topology.eventlogger.executors is 0, but the UI REST endpoint and Thrift clients could still enable debug. The check is in Nimbus.debug() because the UI REST endpoint and Thrift clients all go through it, so one check covers every entry point. It uses the existing StormCommon.hasEventLoggers() on the merged topology config, the same rule the executors use, so a null value (one event logger per worker) is still allowed. debug() does not declare InvalidTopologyException in storm.thrift, so the UI REST endpoint and Thrift clients only see a generic error; the full message is in the Nimbus log.
How was the change tested
NimbusClojurePortTest.testDebugRejectedWithoutEventLoggers submits a topology with topology.eventlogger.executors set to 0 on a simulated time LocalCluster. It checks that enabling debug at topology and at component level throws InvalidTopologyException, that component_debug contains neither the topology id nor the "spout" key, and that disabling debug still succeeds. The test fails without the Nimbus change. NimbusClojurePortTest.testDebugAllowedWithNullEventLoggers submits with topology.eventlogger.executors set to null, checks that the merged config still holds null although defaults.yaml sets 0, and checks that enabling debug succeeds and is stored. testDebugOnComponent and testDebugOnGlobal now submit with one event logger, since they enable debug. NimbusClojurePortTest and NimbusTest pass, and checkstyle reports no violations for storm-server.
Upgrade notes
Enabling debug on a topology whose topology.eventlogger.executors is 0 now fails instead of succeeding with no events logged. The UI REST endpoint returns HTTP 500 and Thrift clients get a TApplicationException. Set topology.eventlogger.executors to a value greater than 0, or unset it (null) for one event logger per worker.
AI Disclosure
Human-led contribution. Grok Bot, working for dragonknightk, assisted with this change, including the code, tests, and description. All submitted content was reviewed by a human before submission.
(。•̀ᴗ-)✧