zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lvfangmin <...@git.apache.org>
Subject [GitHub] zookeeper pull request #628: ZOOKEEPER-3140: Allow Followers to host Observe...
Date Fri, 21 Sep 2018 18:16:31 GMT
Github user lvfangmin commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/628#discussion_r219312930
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/Leader.java ---
    @@ -1465,4 +1508,107 @@ private boolean isRunning() {
         private boolean isParticipant(long sid) {
             return self.getQuorumVerifier().getVotingMembers().containsKey(sid);
         }
    +
    +    @Override
    +    public int getCurrentTick() {
    +        return self.tick.get();
    +    }
    +
    +    @Override
    +    public int syncTimeout() {
    +        return self.tickTime * self.syncLimit;
    +    }
    +
    +    @Override
    +    public int getTickOfNextAckDeadline() {
    +        return self.tick.get() + self.syncLimit;
    +    }
    +
    +    @Override
    +    public int getTickOfInitialAckDeadline() {
    +        return self.tick.get() + self.initLimit + self.syncLimit;
    +    }
    +
    +    @Override
    +    public long getAndDecrementFollowerCounter() {
    +        return followerCounter.getAndDecrement();
    +    }
    +
    +    @Override
    +    public void touch(long sess, int to) {
    +        zk.touch(sess, to);
    +    }
    +
    +    @Override
    +    public void submitLearnerRequest(Request si) {
    +        zk.submitLearnerRequest(si);
    +    }
    +
    +    @Override
    +    public long getQuorumVerifierVersion() {
    +        return self.getQuorumVerifier().getVersion();
    +    }
    +
    +    @Override
    +    public String getPeerInfo(long sid) {
    +        QuorumPeer.QuorumServer server = self.getView().get(sid);
    +        return server == null ? "" : server.toString();
    +    }
    +
    +    @Override
    +    public byte[] getQuorumVerifierBytes() {
    +        return self.getLastSeenQuorumVerifier().toString().getBytes();
    +    }
    +
    +    @Override
    +    public QuorumAuthServer getQuorumAuthServer() {
    +        return (self == null) ? null : self.authServer;
    +    }
    +
    +    @Override
    +    public void revalidateSession(QuorumPacket qp, LearnerHandler learnerHandler) throws
IOException {
    +        ByteArrayInputStream bis = new ByteArrayInputStream(qp.getData());
    +        DataInputStream dis = new DataInputStream(bis);
    +        long id = dis.readLong();
    +        int to = dis.readInt();
    +        ByteArrayOutputStream bos = new ByteArrayOutputStream();
    +        DataOutputStream dos = new DataOutputStream(bos);
    +        dos.writeLong(id);
    +        boolean valid = zk.checkIfValidGlobalSession(id, to);
    +        if (valid) {
    +            try {
    +                //set the session owner
    --- End diff --
    
    Add space after //, suggest to put these 3 line comments into a single line.


---

Mime
View raw message