zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maoling <...@git.apache.org>
Subject [GitHub] zookeeper pull request #553: continue can be replaced with break
Date Thu, 28 Jun 2018 07:41:48 GMT
Github user maoling commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/553#discussion_r198735418
  
    --- Diff: src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java ---
    @@ -254,7 +254,7 @@ public synchronized boolean append(TxnHeader hdr, Record txn)
             for (File f : files) {
                 long fzxid = Util.getZxidFromName(f.getName(), LOG_FILE_PREFIX);
                 if (fzxid > snapshotZxid) {
    -                continue;
    +                break;
                 }
                 // the files
    --- End diff --
    
    @a470577391 Yes,since the files is already order by zxid asc.
    I have two suggestions personally if you want to open a new JIRA:
    1: rename the method to a explicit  one, `getLogFiles` is ambiguous
    2. use Java8 lambda to rewrite the method elegantly,`stream, filter, max `will be useful.



---

Mime
View raw message