Yongcheng Liu created ZOOKEEPER-2660:
----------------------------------------

             Summary: acceptedEpoch and currentEpoch data inconsistency, ZK 
process can not start!
                 Key: ZOOKEEPER-2660
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2660
             Project: ZooKeeper
          Issue Type: Bug
          Components: quorum
    Affects Versions: 3.4.9, 3.4.6
         Environment: ZK: 3.4.9
            Reporter: Yongcheng Liu


1. currentEpoch is bigger than acceptedEpoch, ZK will throw IOException when 
start loadDataBase.
2. function bug. In function setAcceptedEpoch and setCurrentEpoch, it is modify 
memory variable first, then write epoch to file. If write file failed, the 
memory has been modified.

solution as follow:
for example,

        public void setAcceptedEpoch(long e) throws IOException {
                acceptedEpoch = e;
                writeLongToFile(ACCEPTED_EPOCH_FILENAME, e);
        }

need to modify as follow:

        public void setAcceptedEpoch(long e) throws IOException {
                writeLongToFile(ACCEPTED_EPOCH_FILENAME, e);
                acceptedEpoch = e;
        }




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to