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 multiple listeners without configuring broker's advertisedListeners #864
Merged
BewareMyPower
merged 8 commits into
streamnative:master
from
BewareMyPower:bewaremypower/multi-listener
Oct 29, 2021
Merged
Support multiple listeners without configuring broker's advertisedListeners #864
BewareMyPower
merged 8 commits into
streamnative:master
from
BewareMyPower:bewaremypower/multi-listener
Oct 29, 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
323cbbe to
d0b09fe
Compare
EronWright
approved these changes
Oct 29, 2021
Contributor
EronWright
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.
All seems good to me.
kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/KopBrokerLookupManager.java
Outdated
Show resolved
Hide resolved
kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/KopBrokerLookupManager.java
Show resolved
Hide resolved
EronWright
reviewed
Oct 29, 2021
kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/KafkaServiceConfiguration.java
Outdated
Show resolved
Hide resolved
Demogorgon314
approved these changes
Oct 29, 2021
Member
Demogorgon314
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.
BewareMyPower
added a commit
that referenced
this pull request
Oct 29, 2021
…teners (#864) Fixes #818 ### Motivation #742 adds the multiple listeners support for KoP 2.8.x. However, there're some flaws. First, the KoP advertised listeners must be added to `advertisedListeners` config. This config should be treated as the advertised listeners for broker, not protocol handlers. What `KafkaProtocolHandler#getProtocolDataToAdvertise` returns is not used though it has been written to ZK. It also makes `kafkaAdvertisedListeners` meaningless and it was marked as deprecated. ### Modification Benefit by [PIP 95](apache/pulsar#12040), Pulsar client doesn't need to configure listener name for topic lookup. So this PR simplifies the implementation of `LookupClient` by using a shared `PulsarClient` without configuring listener name. Then this PR uses the `MetadataStoreCacheLoader` introduced from #820 to get the `kafkaAdvertisedListeners` from ZK. Since it has already been cached, this PR removes the `KOP_ADDRESS_CACHE`. To verify the feature, this PR adds a test `testMetadataRequestForMultiListeners`. The KoP config is like ```properties kafkaListeners=PLAINTEXT://0.0.0.0:<port1>,GW://0.0.0.0:<port2> kafkaProtocolMap=PLAINTEXT:PLAINTEXT,GW:PLAINTEXT kafkaAdvertisedListeners=PLAINTEXT://192.168.0.1:<port3>,GW://192.168.0.1:<port4> ``` And verify that each `KafkaRequestHandler` can handle the METADATA requests well.
BewareMyPower
added a commit
that referenced
this pull request
Nov 17, 2021
gaozhangmin
pushed a commit
to gaozhangmin/kop
that referenced
this pull request
Nov 29, 2021
…teners (streamnative#864) Fixes streamnative#818 ### Motivation streamnative#742 adds the multiple listeners support for KoP 2.8.x. However, there're some flaws. First, the KoP advertised listeners must be added to `advertisedListeners` config. This config should be treated as the advertised listeners for broker, not protocol handlers. What `KafkaProtocolHandler#getProtocolDataToAdvertise` returns is not used though it has been written to ZK. It also makes `kafkaAdvertisedListeners` meaningless and it was marked as deprecated. ### Modification Benefit by [PIP 95](apache/pulsar#12040), Pulsar client doesn't need to configure listener name for topic lookup. So this PR simplifies the implementation of `LookupClient` by using a shared `PulsarClient` without configuring listener name. Then this PR uses the `MetadataStoreCacheLoader` introduced from streamnative#820 to get the `kafkaAdvertisedListeners` from ZK. Since it has already been cached, this PR removes the `KOP_ADDRESS_CACHE`. To verify the feature, this PR adds a test `testMetadataRequestForMultiListeners`. The KoP config is like ```properties kafkaListeners=PLAINTEXT://0.0.0.0:<port1>,GW://0.0.0.0:<port2> kafkaProtocolMap=PLAINTEXT:PLAINTEXT,GW:PLAINTEXT kafkaAdvertisedListeners=PLAINTEXT://192.168.0.1:<port3>,GW://192.168.0.1:<port4> ``` And verify that each `KafkaRequestHandler` can handle the METADATA requests well. (cherry picked from commit 50699b3)
BewareMyPower
pushed a commit
that referenced
this pull request
Dec 3, 2021
…brokers (#941) **Motivation** When you enable JWT token authentication transactions do not work because transactions need broker-to-broker communication but there is currently no support for the SASL handshake. **Changes** Now when you enable authentication and you configure Token Authentication for Broker-To-Broker communications in Pulsar, we perform SASL PLAIN authentication while preparing the connection to other brokers. **Tests** I have extended existing SASL tests in order to use Transactions. I have copy/pasted some parts of the TransactionTest, but there was not enough code to make sense to share the test code. Fix conflicts made by #864, which changes the signature of `lookupBroker`.
BewareMyPower
added a commit
that referenced
this pull request
May 7, 2022
…espace (#1274) ### Motivation Currently in KoP tests, the metadata namespace configured by `kafkaMetadataNamespace` is "default", which is same with the default namespace of Pulsar and KoP (`kafkaNamespace`). https://github.com/streamnative/kop/blob/64001937c92d80ed4f652becd8d6b9768918b875/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KopProtocolHandlerTestBase.java#L176-L177 It's a terrible config because some topic policies might be changed with the metadata namespace and the offset topic is created during starting. We should avoid the namespace for normal topics being affected by these implicit operations. ### Modifications Remove the configs for `kafkaMetadataTenant` and `kafkaMetadataNamespace`, then fix the following tests: - `MultiLedgerTest`: set the infinite retention to avoid rollover ledgers being removed automatically. - `KafkaTopicConsumerManagerTest`: trigger the topic lookup before creating `PersistentTopic` objects in `BrokerService` so that broker can acquire the ownership of namespace bundles. - `CacheInvalidatorTest`: unload the metadata namespace instead of the default namespace. (cherry picked from commit 9e402f8) Resolve the conflicts by printing the KOP_ADDRESS_CACHE, which was removed in branch-2.9.x and higher since #864.
Hongten
reviewed
Mar 9, 2023
| public void testMetadataRequestForMultiListeners() throws Exception { | ||
| final Map<Integer, InetSocketAddress> bindPortToAdvertisedAddress = new HashMap<>(); | ||
| final int anotherKafkaPort = PortManager.nextFreePort(); | ||
| bindPortToAdvertisedAddress.put(kafkaBrokerPort, |
Contributor
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 encountered an error Listener 'PLAINTEXT://192.168.0.1/<unresolved>:15007' is invalid when calling super.internalSetup(). Did you have the same issue when you run this test?
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 #818
Motivation
#742 adds the multiple listeners support for KoP 2.8.x. However, there're some flaws.
First, the KoP advertised listeners must be added to
advertisedListenersconfig. This config should be treated as the advertised listeners for broker, not protocol handlers. WhatKafkaProtocolHandler#getProtocolDataToAdvertisereturns is not used though it has been written to ZK. It also makeskafkaAdvertisedListenersmeaningless and it was marked as deprecated.Modification
Benefit by PIP 95, Pulsar client doesn't need to configure listener name for topic lookup. So this PR simplifies the implementation of
LookupClientby using a sharedPulsarClientwithout configuring listener name.Then this PR uses the
MetadataStoreCacheLoaderintroduced from #820 to get thekafkaAdvertisedListenersfrom ZK. Since it has already been cached, this PR removes theKOP_ADDRESS_CACHE.To verify the feature, this PR adds a test
testMetadataRequestForMultiListeners. The KoP config is likeAnd verify that each
KafkaRequestHandlercan handle the METADATA requests well.