Uploaded image for project: 'Apache S4'
  1. Apache S4
  2. S4-85

Improve handling of ZK connection changes

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.5.0
    • Fix Version/s: 0.5.0
    • Labels:
      None

      Description

      Currently we are handling ZK state changes a bit differently in two places.

      org.apache.s4.comm.topology.AssignmentFromZK:

          @Override
          public void handleStateChanged(KeeperState state) throws Exception {
              this.state = state;
              if (!state.equals(KeeperState.SyncConnected)) {
                  logger.warn("Session not connected for cluster [{}]: [{}]. Trying to reconnect", clusterName, state.name());
                  zkClient.close();
                  zkClient.connect(connectionTimeout, null);
                  handleNewSession();
              }
          }
      

      org.apache.s4.comm.topology.ClusterFromZK:

          @Override
          public void handleStateChanged(KeeperState state) throws Exception {
              this.state = state;
              if (!state.equals(KeeperState.SyncConnected)) {
                  logger.warn("Session not connected for cluster [{}]: [{}]. Trying to reconnect", clusterName, state.name());
                  zkClient.connect(connectionTimeout, null);
                  handleNewSession();
              }
          }
      

      In the first case we explicitly close the connection before trying to reconnect. Furthermore, I think we should only try to reconnect when the state is equals to KeeperState.Expired, since now we are closing the connection on a Disconnected event too.

        Attachments

          Activity

            People

            • Assignee:
              mmorel Matthieu Morel
              Reporter:
              dferro Daniel Gómez Ferro
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: