/** * Returns initial last logged zxid. * * @return long */ private long getInitLastLoggedZxid(){ if(self.getLearnerType() == LearnerType.PARTICIPANT) return self.getLastLoggedZxid(); else return Long.MIN_VALUE; }
/** * Returns initial last logged zxid. * * @return long */ private long getInitLastLoggedZxid(){ if(self.getLearnerType() == LearnerType.PARTICIPANT) return self.getLastLoggedZxid(); else return Long.MIN_VALUE; }
synchronized public void startLeaderElection() { try { if (getPeerState() == ServerState.LOOKING) { currentVote = new Vote(myid, getLastLoggedZxid(), getCurrentEpoch()); } } catch(IOException e) { RuntimeException re = new RuntimeException(e.getMessage()); re.setStackTrace(e.getStackTrace()); throw re; } this.electionAlg = createElectionAlgorithm(electionType); }
public boolean evaluate() { return lastLoggedZxid == q3.getQuorumPeer().getLastLoggedZxid(); } }, 30);
public boolean evaluate() { return zxid == q3.getQuorumPeer().getLastLoggedZxid(); } }, 30);
synchronized public void startLeaderElection() { try { currentVote = new Vote(myid, getLastLoggedZxid(), getCurrentEpoch()); } catch(IOException e) { RuntimeException re = new RuntimeException(e.getMessage()); re.setStackTrace(e.getStackTrace()); throw re; } for (QuorumServer p : getView().values()) { if (p.id == myid) { myQuorumAddr = p.addr; break; } } if (myQuorumAddr == null) { throw new RuntimeException("My id " + myid + " not in the peer list"); } if (electionType == 0) { try { udpSocket = new DatagramSocket(myQuorumAddr.getPort()); responder = new ResponderThread(); responder.start(); } catch (SocketException e) { throw new RuntimeException(e); } } this.electionAlg = createElectionAlgorithm(electionType); }
self.getLastLoggedZxid())); self.getLastLoggedZxid())); } else { if (result.winner.getId() >= 0) {
final long zxid = q1.getQuorumPeer().getLastLoggedZxid();
proposedZxid = self.getLastLoggedZxid();
long lastLoggedZxid = self.getLastLoggedZxid(); QuorumPacket qp = new QuorumPacket(); qp.setType(pktType);
final long lastLoggedZxid = leader.getQuorumPeer().getLastLoggedZxid(); CreateMode.PERSISTENT); LOG.info("observer zxid " + Long.toHexString(q3.getQuorumPeer().getLastLoggedZxid()) + (testObserverMaster ? "" : " observer master zxid " + Long.toHexString(follower.getQuorumPeer().getLastLoggedZxid())) + " leader zxid " + Long.toHexString(leader.getQuorumPeer().getLastLoggedZxid()));
long lastLoggedZxid = self.getLastLoggedZxid(); QuorumPacket qp = new QuorumPacket(); qp.setType(pktType);
peer.setZKDatabase(zkDb); peer.setTxnFactory(logFactory); peer.getLastLoggedZxid(); Assert.assertEquals(3, peer.getAcceptedEpoch()); Assert.assertEquals(3, peer.getCurrentEpoch());
proposedZxid = self.getLastLoggedZxid();
/** * Returns initial last logged zxid. * * @return long */ private long getInitLastLoggedZxid(){ if(self.getLearnerType() == LearnerType.PARTICIPANT) return self.getLastLoggedZxid(); else return Long.MIN_VALUE; }
synchronized public void startLeaderElection() { currentVote = new Vote(myid, getLastLoggedZxid()); for (QuorumServer p : getView().values()) { if (p.id == myid) { myQuorumAddr = p.addr; break; } } if (myQuorumAddr == null) { throw new RuntimeException("My id " + myid + " not in the peer list"); } if (electionType == 0) { try { udpSocket = new DatagramSocket(myQuorumAddr.getPort()); responder = new ResponderThread(); responder.start(); } catch (SocketException e) { throw new RuntimeException(e); } } this.electionAlg = createElectionAlgorithm(electionType); }
synchronized public void startLeaderElection() { try { currentVote = new Vote(myid, getLastLoggedZxid(), getCurrentEpoch()); } catch(IOException e) { RuntimeException re = new RuntimeException(e.getMessage()); re.setStackTrace(e.getStackTrace()); throw re; } for (QuorumServer p : getView().values()) { if (p.id == myid) { myQuorumAddr = p.addr; break; } } if (myQuorumAddr == null) { throw new RuntimeException("My id " + myid + " not in the peer list"); } if (electionType == 0) { try { udpSocket = new DatagramSocket(myQuorumAddr.getPort()); responder = new ResponderThread(); responder.start(); } catch (SocketException e) { throw new RuntimeException(e); } } this.electionAlg = createElectionAlgorithm(electionType); }
long sentLastZxid = self.getLastLoggedZxid(); qp.setZxid(sentLastZxid);
long lastLoggedZxid = self.getLastLoggedZxid(); if ((newLeaderZxid >> 32L) < (lastLoggedZxid >> 32L)) { LOG.fatal("Leader epoch " + Long.toHexString(newLeaderZxid >> 32L)
zk.loadData(); zk.startup(); long epoch = self.getLastLoggedZxid() >> 32L; epoch++; zk.setZxid(epoch << 32L);