-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
nsq_to_file: require --topic or --topic-pattern #794
nsq_to_file: require --topic or --topic-pattern #794
Conversation
I think there's a bit of a problem with changing the default topic-pattern without changing this part: for _, topic := range topics {
if !discoverer.allowTopicName(*topicPattern, topic) {
log.Println("Skipping topic ...") EDIT: oh I see you've mentioned this explicitly. I guess I also mentally tripped on this a bit. nvm. 👍 for this very minimal behavior fix |
Agreed, would just need to be implemented differently.
That's a Go flag parsing thing and I don't think users expect it to work that way (since it implements pretty typical linux-y style), but I could obviously be wrong.
If it's confusing let's clean it up? |
Do you think it is? I really have no strong opinion, let me know if you want it changed. |
After looking at it in context, I think both approaches lack obviousness, and I don't have a simple solution. At a high level, I think what makes the most sense is for explicit topics to never go through the discovery code path. Related, I've always been unhappy with the fact that the topic discovery code is copied in two places. |
Yeah I think my "no strong opinion" stems from the fact I don't like either option 😄 Maybe something closer to right after I do like the idea of removing the pattern match when explicit topics are set... if you have both |
I don't think it's normal for an unrecognized argument to be silently ignored (... except for uncommon cases like "true" which don't ever inspect arguments) |
Fair point, it probably would make sense for it to error. From the docs:
|
I guess it considers those "arguments"? |
is this ready to go? |
@mreiferson for the initial request it is. if we want to do the rest of the suggestions discussed we can wait, and make the code a little better. been busy but things should settle shortly. |
@judwhite if this addresses the original issue, let's land it, and we can follow up with cleanup if we have the time. |
fixes #789
Notes:
--topic-pattern
without--topic
only when using--lookupd-http-address
; seems like this should work for--nsqd-tcp-address
too.nsq_to_file --topic [topic1] [topic2] ...
, which didn't produce an error, but I wondered whytopic2
wasn't getting picked up.if pattern == ""
inallowTopicName
. I think the alternative is to set it to.*
if it's empty once we've determinedlen(topics) > 0
inmain()
. I don't have a strong opinion so leaving it to review.Release notes should indicate people previously using default settings to archive all topics will need to change their command line args.
RFR /cc @mreiferson @jehiah @elubow