Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1071#discussion_r51735697
  
    --- Diff: 
storm-core/src/jvm/org/apache/storm/cluster/DistributedClusterState.java ---
    @@ -0,0 +1,268 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.storm.cluster;
    +
    +import clojure.lang.APersistentMap;
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.state.*;
    +import org.apache.curator.framework.state.ConnectionState;
    +import org.apache.storm.Config;
    +import org.apache.storm.callback.Callback;
    +import org.apache.storm.callback.WatcherCallBack;
    +import org.apache.storm.utils.Utils;
    +import org.apache.storm.zookeeper.Zookeeper;
    +import org.apache.zookeeper.CreateMode;
    +import org.apache.zookeeper.KeeperException;
    +import org.apache.zookeeper.Watcher;
    +import org.apache.zookeeper.data.ACL;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.UUID;
    +import java.util.concurrent.ConcurrentHashMap;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +
    +public class DistributedClusterState implements ClusterState {
    --- End diff --
    
    I am trying to understand how mk-distributed-cluster-state and 
mk-storm-cluster-state relate to DistributedClusterState and 
StormZKClusterState.
    
    mk-distributed-cluster-state just instantiates a class pointed to by 
Config.STORM_CLUSTER_STATE_STORE with a default of 
"org.apache.storm.cluster_state.zookeeper_state_factory" and then calls 
mkInstance on it.
    
    That functionality appears to be completely lost in this patch, and the 
StormZKStateStore is hardcoded everywhere, we need to fix that.
    Now DistributedClusterState appears to be the equivalent of what 
zookeeper_state_factory was doing without the factory pattern, and without any 
reference to zookeeper in the name, while StormZKClusterState actually looks 
like the concrete implementation of ClusterState and does not really have any 
direct dependency on Zookeeper.
    
    So to clean things up a bit lets do the following.
    
    Rename the ClusterState interface to be StateStorage and 
ClusterStateFactory to be StateStorageFactory, all of them in the 
org.apache.storm.cluster package.  Along with that please change 
`:cluster-state` in the worker-data to be `:state-store`. This class, 
DistributedClusterState, would be renamed to ZKStateStorage and an appropriate 
ZKStateStorageFactory needs to be created.  pacemaker_state_factory.clj needs 
to be reverted and updated to extend the newly renamed StateStorageFactory, and 
to return a StateStorage instance.
    
    ClusterState no longer needs to be an interface and implementation split 
off from one another.  It should be a single class that uses the StateStore 
that is passed into it in the constructor.
    
    mk-distributed-cluster-state should be a static method in mkStateStorage 
that should probably be a part of ClusterUtils.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to