This repository was archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 142
Support pulsar to obtain the correct unconfigured hostname listeners of KafkaProtocolHandler. #648
Merged
BewareMyPower
merged 2 commits into
streamnative:master
from
wenbingshen:checkKafkaListeners
Aug 12, 2021
Merged
Support pulsar to obtain the correct unconfigured hostname listeners of KafkaProtocolHandler. #648
BewareMyPower
merged 2 commits into
streamnative:master
from
wenbingshen:checkKafkaListeners
Aug 12, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…of KafkaProtocolHandler. Pulsar will access the getProtocolDataToAdvertise of the protocol handler when constructing LocalBrokerData. If kafkaListeners is not configured with a host name, the protocols of Pulsar LocalBrokerData will not have the host name information of the kop protocol, which will cause kop to return the wrong partition leader.
BewareMyPower
suggested changes
Aug 12, 2021
Collaborator
BewareMyPower
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.
Please fix the code style to make mvn checkstyle:check pass
Contributor
Author
|
@BewareMyPower Thanks for your review. Address your comment. PTAL :) |
BewareMyPower
approved these changes
Aug 12, 2021
Collaborator
BewareMyPower
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.
LGTM
Collaborator
|
Currently there's a flaky test. I'll try to rerun for at most 2 times. If it still didn't pass, I'll merge this PR first. |
BewareMyPower
pushed a commit
that referenced
this pull request
Sep 30, 2021
…of KafkaProtocolHandler. (#648) Fixes #647 ### Motivation Pulsar will access the getProtocolDataToAdvertise of the protocol handler when constructing LocalBrokerData. If kafkaListeners is not configured with a host name, the protocols of Pulsar LocalBrokerData will not have the host name information of the kop protocol, which will cause kop to return the wrong partition leader. ### Modifications `getKafkaAdvertisedListeners` will check whether the listeners contain the host name, if not, use `InetAddress.getLocalHost().getCanonicalHostName()` instead Co-authored-by: wenbing1 <wenbing1@staff.sina.com.cn>
BewareMyPower
pushed a commit
that referenced
this pull request
Feb 18, 2022
Related to this #1092 1. The current brokers metadata is maintained in the AdminManager, and obtaining the controllerId from here can ensure data consistency. 2. Avoid extra complex parsing listeners and handling exceptions. 3. The node ID is calculated from the hostname and port hash. If kop is not configured with ip or hostname, the program will automatically obtain the hostname. One of the problems is: when kop is running, if a new hostname address is added to the local domain name self-resolution, and as for the first position, it may cause the program to return a different host alias, the controller node id will inconsistent with the Broker cache in metadataStore. You can see the PR #648 I submitted a long time ago. 4. Reuse `testMetadataRequestForMultiListeners` test validation controller. 5. A random node from the broker cache is used as the controller. There is no controller concept in kop. It is the same whether it returns to the node itself or randomly selects a node.
BewareMyPower
pushed a commit
that referenced
this pull request
Feb 18, 2022
Related to this #1092 1. The current brokers metadata is maintained in the AdminManager, and obtaining the controllerId from here can ensure data consistency. 2. Avoid extra complex parsing listeners and handling exceptions. 3. The node ID is calculated from the hostname and port hash. If kop is not configured with ip or hostname, the program will automatically obtain the hostname. One of the problems is: when kop is running, if a new hostname address is added to the local domain name self-resolution, and as for the first position, it may cause the program to return a different host alias, the controller node id will inconsistent with the Broker cache in metadataStore. You can see the PR #648 I submitted a long time ago. 4. Reuse `testMetadataRequestForMultiListeners` test validation controller. 5. A random node from the broker cache is used as the controller. There is no controller concept in kop. It is the same whether it returns to the node itself or randomly selects a node. (cherry picked from commit 459c6cb)
BewareMyPower
pushed a commit
that referenced
this pull request
Feb 18, 2022
Related to this #1092 1. The current brokers metadata is maintained in the AdminManager, and obtaining the controllerId from here can ensure data consistency. 2. Avoid extra complex parsing listeners and handling exceptions. 3. The node ID is calculated from the hostname and port hash. If kop is not configured with ip or hostname, the program will automatically obtain the hostname. One of the problems is: when kop is running, if a new hostname address is added to the local domain name self-resolution, and as for the first position, it may cause the program to return a different host alias, the controller node id will inconsistent with the Broker cache in metadataStore. You can see the PR #648 I submitted a long time ago. 4. Reuse `testMetadataRequestForMultiListeners` test validation controller. 5. A random node from the broker cache is used as the controller. There is no controller concept in kop. It is the same whether it returns to the node itself or randomly selects a node. (cherry picked from commit 459c6cb)
michaeljmarshall
pushed a commit
to michaeljmarshall/kop
that referenced
this pull request
Dec 13, 2022
Related to this streamnative#1092 1. The current brokers metadata is maintained in the AdminManager, and obtaining the controllerId from here can ensure data consistency. 2. Avoid extra complex parsing listeners and handling exceptions. 3. The node ID is calculated from the hostname and port hash. If kop is not configured with ip or hostname, the program will automatically obtain the hostname. One of the problems is: when kop is running, if a new hostname address is added to the local domain name self-resolution, and as for the first position, it may cause the program to return a different host alias, the controller node id will inconsistent with the Broker cache in metadataStore. You can see the PR streamnative#648 I submitted a long time ago. 4. Reuse `testMetadataRequestForMultiListeners` test validation controller. 5. A random node from the broker cache is used as the controller. There is no controller concept in kop. It is the same whether it returns to the node itself or randomly selects a node. (cherry picked from commit 459c6cb)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #647
Motivation
Pulsar will access the getProtocolDataToAdvertise of the protocol handler when constructing LocalBrokerData. If kafkaListeners is not configured with a host name, the protocols of Pulsar LocalBrokerData will not have the host name information of the kop protocol, which will cause kop to return the wrong partition leader.
Modifications
getKafkaAdvertisedListenerswill check whether the listeners contain the host name, if not, useInetAddress.getLocalHost().getCanonicalHostName()instead