Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/453#discussion_r167884587
  
    --- Diff: src/java/main/org/apache/zookeeper/server/ZKDatabase.java ---
    @@ -233,14 +233,32 @@ public long getDataTreeLastProcessedZxid() {
          * @throws IOException
          */
         public long loadDataBase() throws IOException {
    -        PlayBackListener listener=new PlayBackListener(){
    +        PlayBackListener listener = new PlayBackListener(){
                 public void onTxnLoaded(TxnHeader hdr,Record txn){
                     Request r = new Request(0, hdr.getCxid(),hdr.getType(), 
hdr, txn, hdr.getZxid());
                     addCommittedProposal(r);
                 }
             };
     
    -        long zxid = 
snapLog.restore(dataTree,sessionsWithTimeouts,listener);
    +        long zxid = snapLog.restore(dataTree, sessionsWithTimeouts, 
listener);
    +        initialized = true;
    +        return zxid;
    +    }
    +
    +    /**
    +     * Fast forward the database adding transactions from the committed 
log into memory.
    +     * @return the last valid zxid.
    +     * @throws IOException
    +     */
    +    public long fastForwardDataBase() throws IOException {
    +        PlayBackListener listener = new PlayBackListener(){
    --- End diff --
    
    I think it'd be nice to extract the common logic of these two methods into 
a operate one.


---

Reply via email to