Skip to content
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

Merged
merged 19 commits into from
Jun 3, 2020
Merged

PIP-61: Advertise multiple addresses #6903

merged 19 commits into from
Jun 3, 2020

Conversation

zplinuxlover
Copy link
Contributor

first file added 7 commits April 24, 2020 14:30
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName`
2. register the `advertisedListeners` to zookeeper
1. resolve broker.conf, validate `advertisedListeners` and `internalListenerName`
2. register the `advertisedListeners` to zookeeper
3. client find the target broker with listenerName
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
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
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
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
@codelipenghui codelipenghui added this to the 2.6.0 milestone May 7, 2020
@codelipenghui codelipenghui added the type/feature The PR added a new feature or issue requested a new feature label May 7, 2020
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
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

first file added 5 commits May 7, 2020 10:33
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
@sijie sijie changed the title Feature/pip 61 PIP-61: Advertise multiple addresses May 7, 2020
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

2 similar comments
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover zplinuxlover removed their assignment May 7, 2020
Copy link
Member

@sijie sijie left a 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 = "")
Copy link
Member

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?

Copy link
Contributor Author

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;

//
Copy link
Member

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.

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Contributor Author

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(),
Copy link
Member

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?

Copy link
Contributor Author

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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above

Copy link
Contributor Author

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 {
Copy link
Member

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?

Copy link
Contributor Author

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

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

3 similar comments
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

4 similar comments
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

Copy link
Contributor

@codelipenghui codelipenghui left a 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.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid use import .*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve the problem

Comment on lines 164 to 170
* 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

2 similar comments
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover zplinuxlover requested a review from sijie May 29, 2020 09:23
@codelipenghui
Copy link
Contributor

ping @sijie please help review this PR again.

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

6 similar comments
@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zplinuxlover
Copy link
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui merged commit 8e40bd9 into apache:master Jun 3, 2020
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature The PR added a new feature or issue requested a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants