sijie commented on a change in pull request #2487: Ensure standalone service 
comes back quickly after ungraceful restarts
URL: https://github.com/apache/incubator-pulsar/pull/2487#discussion_r214123073
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
 ##########
 @@ -791,9 +791,22 @@ public void start() throws PulsarServerException {
             } catch (KeeperException.NodeExistsException e) {
                 long ownerZkSessionId = getBrokerZnodeOwner();
                 if (ownerZkSessionId != 0 && ownerZkSessionId != 
zkClient.getSessionId()) {
-                    log.error("Broker znode - [{}] is own by different 
zookeeper-ssession {} ", brokerZnodePath,
-                            ownerZkSessionId);
-                    throw new PulsarServerException("Broker-znode owned by 
different zk-session " + ownerZkSessionId);
+                    if (conf.isRunningStandalone()) {
+                        // 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
+                        zkClient.delete(brokerZnodePath, -1);
 
 Review comment:
   but session can be expired in between, no?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to