GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — PIP-1 - Introduce Pulsar proxy component by merlimat · Pull Request #548 · apache/pulsar Conversation
|
| * @return broker-socket-address that serves given topic | ||
| */ | ||
| public CompletableFuture<InetSocketAddress> getBroker(DestinationName destination) { | ||
| public CompletableFuture<Pair<InetSocketAddress, InetSocketAddress>> getBroker(DestinationName destination) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
do you think using InetSocketAddress[] would be better to avoid creation of Pair object here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In this case it would be the same number of object allocations, either a Pair<> or the InetSocketAddress[]. No differences, except Pair conveys better the fact that 2 addresses are going to be there.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yes, I meant avoiding creation of Pair.
conveys better the fact that 2 addresses are going to be there.
Yes, make sense.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| private final int maxNumberOfRejectedRequestPerConnection; | ||
| private final int rejectedRequestResetTimeSec = 60; | ||
|
|
||
| private String targetBrokerAddress = null; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
do you think if we can add proxy in the name it will easy to understand.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure, will rename that
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| optional ServerError error = 6; | ||
| optional string message = 7; | ||
|
|
||
| // If it's true, indicates to the client that it must |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
format?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // Original principal that was verified by | ||
| // a Pulsar proxy. In this case the auth info above | ||
| // will the the auth of the proxy itself | ||
| optional string original_principal = 7; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
if proxy is going to do auth&auth for original-principal then broker will not do any validation on this original_principal right? if that's true then are we passing it for debugging only? and I don't see if we are setting it in Commands.java
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Proxy is not doing authorization on the data connections. The reason is that after the initial connect/connected it just forward everything on both sides.
The broker still needs to check whether that particular role is authorized to pulblish on a specific topic. So the proxy relays the original client principal, and that will be used by the broker for the authorization, trusting that the proxy has already validated the authentication.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (future.isSuccess()) { | ||
| outboundChannel.read(); | ||
| } else { | ||
| inboundChannel.close(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
should we log warn message here?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public void operationComplete(Future<Void> future) throws Exception { | ||
| // This is invoked when the write operation on the paired connection is completed | ||
| if (future.isSuccess()) { | ||
| outboundChannel.read(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
but we have already triggered read on outboundChannel on line-107, so channel-handler will continue reading even if we don't call here. right?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No, the auto-read on the channel is set to false. The reason is to adapt to the speed of the slowest connection.
So, we read 1 buffer from c1, write into c2. When the write is completed (meaning we were able to write on the socket because the TCP send window was open), then we read the next buffer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| brokerURI = new URI(brokerServiceUrl); | ||
| } catch (URISyntaxException e) { | ||
| proxyConnection.ctx().writeAndFlush( | ||
| Commands.newLookupErrorResponse(ServerError.ServiceNotReady, e.getMessage(), clientRequestId)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ServerError.MetadataError?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Makes more sense. Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| private void close() { | ||
| ctx.close(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
should we have additional state= 'ConnectionClosed` ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rdhabalia Addressed comments |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM .. just minor comments.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # | ||
|
|
||
| # Zookeeper quorum connection string (comma-separated) | ||
| zookeeperServers=127.0.0.1:2181 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
in other conf file we have kept it empty. should we do the same?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot these after testing
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| private final ZooKeeperCache localZkCache; | ||
| private final LocalZooKeeperConnectionService localZkConnectionSvc; | ||
|
|
||
| private final ZooKeeperDataCache<LoadReport> brokerInfo; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
org.apache.pulsar.policies.data.loadbalancer.ServiceLookupData because ModularLoadManager generates LocalBrokerData.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| DefaultExports.initialize(); | ||
| server.addServlet("/metrics", new ServletHolder(MetricsServlet.class)); | ||
|
|
||
| // server.addServlet("/*", DiscoveryServiceServlet.class, initParameters); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
does this comment require for any indication?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
forgot this, will remove
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| this.serviceUrlTls = String.format("pulsar://%s:%d/", hostname, proxyConfig.getServicePortTls()); | ||
|
|
||
| EventLoopGroup acceptorEventLoop, workersEventLoop; | ||
| if (SystemUtils.IS_OS_LINUX) { |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
just a thought SystemUtils.IS_OS_LINUX && io.netty.channel.epoll.Epoll.isAvailable()?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about Epoll.isAvailable(), probably was introduced later in Netty. Then we can just use that check, no need to verify we are on Linux.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rdhabalia Updated |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.