-
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
nsqd/nsqlookupd: add --broadcast-address flag #142
Conversation
@dustismo thanks for taking a stab at this, I'll take a look in a few hours. FYI, in the future feel free to just continue pushing changes to existing pull requests until we either merge or close the issue rather than opening new ones. (we squash intermediate commits into logical units before merging anyway...) |
@mreiferson Yeah, sorry about the new pull. I wanted to start from a fresh branch rather then undo all the previous changes. Will not do that in the future. |
@@ -28,6 +28,8 @@ func (n *NSQd) lookupLoop() { | |||
ci["tcp_port"] = n.tcpAddr.Port | |||
ci["http_port"] = n.httpAddr.Port | |||
ci["address"] = hostname | |||
ci["broadcast_address"] = n.options.broadcastAddress |
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.
so thinking through this a bit, I think what makes the most sense is for this to send both hostname
and broadcast_address
keys in the JSON dictionary.
on the nsqlookupd
side we'll need to "auto-detect" based on the JSON coming in (old nsqd
peers will be sending just address
and new peers will be sending hostname
and broadcast_address
)
the only other addition that probably belongs in this pull request is to update |
think these last commits cover all the comments above. let me know of any additional thoughts. |
@dustismo, nice work. Last request... can you update tests in two spots to validate these field changes?
thanks |
@mreiferson sure thing, though I am a bit confused about how this cluster_test works. I see this output
but I con't figure out where that is happening. can you point me to it? |
The cluster test file depends on |
@dustismo looks like a one of the recent merges conflicts with this... can you rebase whenever you decide to get back to this? |
@mreiferson This should cover it I think. Let me know if you see anything else. Also, sorry, I did a merge of master rather then a rebase, is that a problem? |
@@ -176,7 +176,8 @@ func tombstoneTopicProducerHandler(w http.ResponseWriter, req *http.Request) { | |||
log.Printf("DB: setting tombstone for producer@%s of topic(%s)", node, topicName) | |||
producers := lookupd.DB.FindProducers("topic", topicName, "") | |||
for _, p := range producers { | |||
thisNode := fmt.Sprintf("%s:%d", p.Address, p.HttpPort) | |||
thisNode := fmt.Sprintf("%s:%d", p.BroadcastAddress, p.HttpPort) | |||
log.Println("THIS NODE: " + thisNode + " EQUALS: " + node) |
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.
we can drop this debug line
re: merge vs rebase... we take the approach that while we're working in branches we strictly rebase on master so as to not introduce merge commits. when we're ready for this to go in we'll rebase/squash down to one commit and merge that into master. |
@mreiferson I think that covers the broadcast-address flag addition for nsqlookupd. |
@@ -231,7 +237,10 @@ func (p *LookupProtocolV1) IDENTIFY(client *ClientV1, reader *bufio.Reader, para | |||
if err != nil { | |||
log.Fatalf("ERROR: unable to get hostname %s", err.Error()) | |||
} | |||
data["address"] = hostname | |||
data["address"] = lookupd.broadcastAddress //TODO: remove for 1.0 |
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.
address
should continue to be just hostname (despite the fact that broadcastAddress
defaults to hostname) for backward compatibility
the Related to this, in https://github.com/dustismo/nsq/blob/broadcast_address_flag/nsq/lookup_peer.go#L23, we need to add |
@mreiferson hows that? |
sweet, i think this looks good! can you do a final rebase on bitly/master and squash down to one commit? |
add broadcast address update test with broadcast addr format format add hostname key to lookup add hostname field fmt update test add broadcast address and hostname to nodes admin page fmt more Address changes update to use broadcast address with identify and all throughout the lookup update test for broadcast_address test broadcast address remove debug line add broadcast flag to lookupd fmt update readme switch address back to hostname for backward compat update to use broadcast address fmt
phew, rebase and squash was a new git adventure for me :). Think it all looks good now. |
thanks for the contribution, LGTM |
nsqd/nsqlookupd: add --broadcast-address flag
replaces pull request #141
adds a "broadcast_address" field to the producer objects in nsqlookupd, and the corresponding --broadcast-address option to nsqd.
Additional thoughts?