Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Conversation

@wenbingshen
Copy link
Contributor

@wenbingshen wenbingshen commented Aug 12, 2021

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

…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.
Copy link
Collaborator

@BewareMyPower BewareMyPower left a 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

@wenbingshen
Copy link
Contributor Author

@BewareMyPower Thanks for your review. Address your comment. PTAL :)

Copy link
Collaborator

@BewareMyPower BewareMyPower left a comment

Choose a reason for hiding this comment

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

LGTM

@BewareMyPower
Copy link
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 BewareMyPower merged commit 44e414a into streamnative:master Aug 12, 2021
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.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Unbale to find OwnedBundle for topic error unable to recover automatically

2 participants