rdhabalia commented on a change in pull request #10391:
URL: https://github.com/apache/pulsar/pull/10391#discussion_r623319212
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/NoopLoadManager.java
##########
@@ -63,33 +53,17 @@ public void start() throws PulsarServerException {
+ pulsar.getConfiguration().getWebServicePort().get();
localResourceUnit = new SimpleResourceUnit(String.format("http://%s",
lookupServiceAddress),
new PulsarResourceDescription());
- zkClient = pulsar.getZkClient();
- localData = new LocalBrokerData(pulsar.getSafeWebServiceAddress(),
pulsar.getWebServiceAddressTls(),
+ LocalBrokerData localData = new
LocalBrokerData(pulsar.getSafeWebServiceAddress(),
+ pulsar.getWebServiceAddressTls(),
pulsar.getSafeBrokerServiceUrl(),
pulsar.getBrokerServiceUrlTls());
localData.setProtocols(pulsar.getProtocolDataToAdvertise());
- String brokerZnodePath = LoadManager.LOADBALANCE_BROKERS_ROOT + "/" +
lookupServiceAddress;
+ String brokerReportPath = LoadManager.LOADBALANCE_BROKERS_ROOT + "/" +
lookupServiceAddress;
try {
- // When running in standalone, this error can happen when killing
the "standalone" process
- // ungracefully since the ZK session will not be closed and it
will take some time for ZK server
- // to prune the expired sessions after startup.
- // Since there's a single broker instance running, it's safe, in
this mode, to remove the old lock
-
- // Delete and recreate z-node
- try {
- if (zkClient.exists(brokerZnodePath, null) != null) {
- zkClient.delete(brokerZnodePath, -1);
- }
- } catch (NoNodeException nne) {
- // Ignore if z-node was just expired
- }
-
- ZkUtils.createFullPathOptimistic(zkClient, brokerZnodePath,
localData.getJsonBytes(),
- ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-
- } catch (Exception e) {
- throw new PulsarServerException(e);
+ lockManager.acquireLock(brokerReportPath, localData).join();
Review comment:
can we add log here as it's a blocking call and we can use the log to
troubleshoot if server is taking time to come-up or not coming up..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]