-
Notifications
You must be signed in to change notification settings - Fork 4.1k
STORM-2421: support lists of childopts in DaemonConfig. #2083
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
Conversation
|
+1. |
| * @throws IllegalArgumentException if conf is null | ||
| * @throws NullPointerException if name is null and the conf map doesn't support null keys | ||
| */ | ||
| public static String getConfigValueAsString(String name, Map<?, ?> conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to a common type for *childopts it should be a List<String> not String. The reason for a list is that something with whitespace in it can be properly represented this breaks that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@revans2 You mean, replace this method with
public static String getConfigValueAsList(String name, Map<?, ?> conf) {
// if the value is a list, return it
// if the value is a string, split it by space and return the resulting list
}
and the caller can convert it to a space-separated string if needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hmcc Yes, except the caller should not be converting it to a space separated string because it will break some use cases.
|
@hmcc : I put a comment in the bug -- the problem isn't sufficiently specified IMHO. |
3ebd7d1 to
322c8d0
Compare
|
#2112 makes most of the checkstyle changes unnecessary, which is great! Rebased & squashed commits. |
revans2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Overall it looks really good, but one minor nit that you can probably ignore if you want to. In the future I would love to see configValue replaced as it cannot express anything but a very simple type, and it only outputs a single value at a time. But it works OK for now, and it is probably big enough that it would need a separate JIRA.
| * @throws IllegalArgumentException if conf is null | ||
| * @throws NullPointerException if name is null and the conf map doesn't support null keys | ||
| */ | ||
| public static List<String> getValueAsList(String name, Map<?, ?> conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: we tend to use Map<String, Object> for conf.
|
Any hope of this getting backported into 1.0.x? |
|
@hmcc looks like there is a merge conflict now. If you could resolve it I would be happy to check this in. |
08d72da to
d618cae
Compare
|
@hmcc I'm really sorry but there's another merge conflict now. Please resolve this and mention me so that I can check this in soon. |
|
Not sure how serious this is considered, but I figured I'd raise it for discussion just in case:
Does this not risk breaking backwards compat in cases where the current value is a string containing arguments with spaces? // i.e.
-foo "hello world" => ["-foo", "\"hello", "world\""]
// or a more contrived example
-padding " " => ["-padding", "\"", "\""]Perhaps there's an existing CLI parser better suited to handling the conversion to |
|
@mal that is not an issue right now. There are a lot of changes to the code, but most of that is creating some common helper methods and refactoring. The only configs really impacted by this change are the daemon childopts https://github.com/apache/storm/blob/master/bin/storm.py#L217-L234 the old code just output the value by calling .toString on it, but the new ConfigValue will first check if it is a list and stitch it back together into a String. So but This is not ideal, I agree. Ultimately we need to add in an option to storm config to print out the config as a JSON string, or a set of JSON strings. Then have storm.py parse it properly and add in the arguments the right way to respect white space instead of what is happening right now. |
|
+1 |
Addresses https://issues.apache.org/jira/browse/STORM-2421 by: