-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
PIP-61: Advertise multiple addresses #6903
Conversation
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import 7. add license header
/pulsarbot run-failure-checks |
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import 7. add license header
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import 7. add license header
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import 7. add license header
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import 7. add license header
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest 6. remove necessary import 7. add license header
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
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.
The change looks good in general. Left a couple of comments.
@@ -146,6 +146,14 @@ | |||
) | |||
private String advertisedAddress; | |||
|
|||
// | |||
@FieldContext(category=CATEGORY_SERVER, doc = "") |
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.
Can you add documentation for these two settings?
Also, can you add these settings to broker.conf
file?
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.
I have add the configuration doc here
@@ -146,6 +146,14 @@ | |||
) | |||
private String advertisedAddress; | |||
|
|||
// |
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.
nit: remove this line if it is not 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.
I have remove the code for this line
@NotNull | ||
public Map<String, AdvertisedListener> getAdvertisedListeners() { | ||
if (this.advertisedListeners == null) { | ||
return Collections.unmodifiableMap(Collections.EMPTY_MAP); |
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.
nit: I think EMPTY_MAP
is already unmodifiable.
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.
I have fix the code
return; | ||
} else { | ||
future.complete(Optional.of(new LookupResult( | ||
nsData.get().getHttpUrl(), nsData.get().getHttpUrlTls(), listener.getBrokerServiceUrl().toString(), |
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.
Why do we get HttpUrl
and HttpUrlTls
from NamespaceBundle but get brokerServiceUrl
and brokerServiceUrlTls
?
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.
currently we only concern pulsar protocol here, the HttpUrl and HttpUrlTls behavior as before
return; | ||
} else { | ||
lookupFuture.complete(Optional.of(new LookupResult( | ||
ownerInfo.getHttpUrl(), ownerInfo.getHttpUrlTls(), listener.getBrokerServiceUrl().toString(), |
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.
same comment as above
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.
currently we only concern pulsar protocol here, the HttpUrl and HttpUrlTls behavior as before.
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class AdvertisedListener { |
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.
Why do we only include brokerServiceUrl
and brokerServiceUrlTls
in AdvertisedListener?
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.
currently we only concern pulsar protocol here, the HttpUrl and HttpUrlTls behavior as before
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
3 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
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.
Looks good to me, just some left some minor comments.
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.*; |
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.
Avoid use import .*
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.
resolve the problem
* Lookup broker-service address for a given namespace-bundle which contains given topic. | ||
* | ||
* a. Returns broker-address if namespace-bundle is already owned by any broker b. If current-broker receives | ||
* lookup-request and if it's not a leader then current broker redirects request to leader by returning | ||
* leader-service address. c. If current-broker is leader then it finds out least-loaded broker to own namespace | ||
* bundle and redirects request by returning least-loaded broker. d. If current-broker receives request to own the | ||
* namespace-bundle then it owns a bundle and returns success(connect) response to client. |
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.
It's better to use owner
rather than leader
.
And, for easier reading. Please separate a b c d into different paragraphs.
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.
I have format the comment
1. remove java.util.* code format 2. format function comment
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
ping @sijie please help review this PR again. |
/pulsarbot run-failure-checks |
6 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
* PIP-61: 1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName` 2. register the `advertisedListeners` to zookeeper 3. client find the target broker with listenerName 4. add test case PulsarMultiListenersTest 5. add test case MultipleListenerValidatorTest
this code change is for
https://github.com/apache/pulsar/wiki/PIP-61%3A-Advertised-multiple-addresses