Examples of QuorumVerifier


Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

            }
            if (lastAcceptedEpoch >= epoch) {
                epoch = lastAcceptedEpoch+1;
            }
            connectingFollowers.add(sid);
            QuorumVerifier verifier = self.getQuorumVerifier();
            if (connectingFollowers.contains(self.getId()) &&
                                            verifier.containsQuorum(connectingFollowers)) {
                waitingForNewEpoch = false;
                self.setAcceptedEpoch(epoch);
                connectingFollowers.notifyAll();
            } else {
                long start = System.currentTimeMillis();
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

                if (ss.isMoreRecentThan(leaderStateSummary)) {
                    throw new IOException("Follower is ahead of the leader");
                }
                electingFollowers.add(id);
            }
            QuorumVerifier verifier = self.getQuorumVerifier();
            if (electingFollowers.contains(self.getId()) && verifier.containsQuorum(electingFollowers)) {
                electionFinished = true;
                electingFollowers.notifyAll();
            } else {               
                long start = System.currentTimeMillis();
                long cur = start;
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

      }
      if (lastAcceptedEpoch > epoch) {
        epoch = lastAcceptedEpoch+1;
      }
      connectingFollowers.add(sid);
      QuorumVerifier verifier = self.getQuorumVerifier();
      if (connectingFollowers.contains(self.getId()) && verifier.containsQuorum(connectingFollowers))
{
          waitingForNewEpoch = false;
          self.setAcceptedEpoch(epoch);
          connectingFollowers.notifyAll();
      } else {
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

        if (ss.isMoreRecentThan(leaderStateSummary)) {
          throw new IOException("Follower is ahead of the leader");
        }
        electingFollowers.add(id);
      }
      QuorumVerifier verifier = self.getQuorumVerifier();
      if (electingFollowers.contains(self.getId()) && verifier.containsQuorum(electingFollowers)) {
        electionFinished = true;
        electingFollowers.notifyAll();
            } else {               
                long start = System.currentTimeMillis();
                long cur = start;
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

            }
            if (lastAcceptedEpoch >= epoch) {
                epoch = lastAcceptedEpoch+1;
            }
            connectingFollowers.add(sid);
            QuorumVerifier verifier = self.getQuorumVerifier();
            if (connectingFollowers.contains(self.getId()) &&
                                            verifier.containsQuorum(connectingFollowers)) {
                waitingForNewEpoch = false;
                self.setAcceptedEpoch(epoch);
                connectingFollowers.notifyAll();
            } else {
                long start = System.currentTimeMillis();
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

                                                    + leaderStateSummary.getLastZxid()
                                                    + " (last zxid)");
                }
                electingFollowers.add(id);
            }
            QuorumVerifier verifier = self.getQuorumVerifier();
            if (electingFollowers.contains(self.getId()) && verifier.containsQuorum(electingFollowers)) {
                electionFinished = true;
                electingFollowers.notifyAll();
            } else {               
                long start = System.currentTimeMillis();
                long cur = start;
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

      }
      if (lastAcceptedEpoch > epoch) {
        epoch = lastAcceptedEpoch+1;
      }
      connectingFollowers.add(sid);
      QuorumVerifier verifier = self.getQuorumVerifier();
      if (connectingFollowers.contains(self.getId()) && verifier.containsQuorum(connectingFollowers))
{
          waitingForNewEpoch = false;
          self.setAcceptedEpoch(epoch);
          connectingFollowers.notifyAll();
      } else {
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

        if (ss.isMoreRecentThan(leaderStateSummary)) {
          throw new IOException("Follower is ahead of the leader");
        }
        electingFollowers.add(id);
      }
      QuorumVerifier verifier = self.getQuorumVerifier();
      if (electingFollowers.contains(self.getId()) && verifier.containsQuorum(electingFollowers)) {
        electionFinished = true;
        electingFollowers.notifyAll();
            } else {               
                long start = System.currentTimeMillis();
                long cur = start;
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

                    lzks = (LeaderZooKeeperServer)zks;
                } catch (ClassCastException e) {
                    // standalone mode - reconfiguration currently not supported
                    throw new KeeperException.UnimplementedException();
                }
                QuorumVerifier lastSeenQV = lzks.self.getLastSeenQuorumVerifier();                                                                                
                // check that there's no reconfig in progress
                if (lastSeenQV.getVersion()!=lzks.self.getQuorumVerifier().getVersion()) {
                       throw new KeeperException.ReconfigInProgress();
                }
                long configId = reconfigRequest.getCurConfigId();
 
                if (configId != -1 && configId!=lzks.self.getLastSeenQuorumVerifier().getVersion()){
                   String msg = "Reconfiguration from version " + configId + " failed -- last seen version is " + lzks.self.getLastSeenQuorumVerifier().getVersion();
                   throw new KeeperException.BadVersionException(msg);
                }

                String newMembers = reconfigRequest.getNewMembers();
               
                if (newMembers != null) { //non-incremental membership change                 
                   LOG.info("Non-incremental reconfig");
               
                   // Input may be delimited by either commas or newlines so convert to common newline separated format
                   newMembers = newMembers.replaceAll(",", "\n");
                  
                   try{
                       Properties props = new Properties();                       
                       props.load(new StringReader(newMembers));
                       request.qv = QuorumPeerConfig.parseDynamicConfig(props, lzks.self.getElectionType(), true, false);
                       request.qv.setVersion(request.getHdr().getZxid());
                   } catch (IOException e) {
                       throw new KeeperException.BadArgumentsException(e.getMessage());
                   } catch (ConfigException e) {
                       throw new KeeperException.BadArgumentsException(e.getMessage());
                   }                  
                } else { //incremental change - must be a majority quorum system  
                   LOG.info("Incremental reconfig");
                  
                   List<String> joiningServers = null;
                   String joiningServersString = reconfigRequest.getJoiningServers();
                   if (joiningServersString != null)
                   {
                       joiningServers = StringUtils.split(joiningServersString,",");
                   }
                  
                   List<String> leavingServers = null;
                   String leavingServersString = reconfigRequest.getLeavingServers();
                   if (leavingServersString != null)
                   {
                       leavingServers = StringUtils.split(leavingServersString, ",");
                   }
                  
                   if (!(lastSeenQV instanceof QuorumMaj)) {
                           String msg = "Incremental reconfiguration requested but last configuration seen has a non-majority quorum system";
                           LOG.warn(msg);
                           throw new KeeperException.BadArgumentsException(msg);              
                   }
                   Map<Long, QuorumServer> nextServers = new HashMap<Long, QuorumServer>(lastSeenQV.getAllMembers());
                   try {                          
                       if (leavingServers != null) {
                           for (String leaving: leavingServers){
                               long sid = Long.parseLong(leaving);
                               nextServers.remove(sid);
View Full Code Here

Examples of org.apache.zookeeper.server.quorum.flexible.QuorumVerifier

    /**
     * Send notifications to all peers upon a change in our vote
     */
    private void sendNotifications() {
        for (long sid : self.getCurrentAndNextConfigVoters()) {
            QuorumVerifier qv = self.getQuorumVerifier();
            ToSend notmsg = new ToSend(ToSend.mType.notification,
                    proposedLeader,
                    proposedZxid,
                    logicalclock.get(),
                    QuorumPeer.ServerState.LOOKING,
                    sid,
                    proposedEpoch, qv.toString().getBytes());
            if(LOG.isDebugEnabled()){
                LOG.debug("Sending Notification: " + proposedLeader + " (n.leader), 0x"  +
                      Long.toHexString(proposedZxid) + " (n.zxid), 0x" + Long.toHexString(logicalclock.get())  +
                      " (n.round), " + sid + " (recipient), " + self.getId() +
                      " (myid), 0x" + Long.toHexString(proposedEpoch) + " (n.peerEpoch)");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.