zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #606: [ZOOKEEPER-3127] Fixing potential data inconsis...
Date Tue, 28 Aug 2018 05:45:47 GMT
Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/606#discussion_r213189883
  
    --- Diff: src/java/main/org/apache/zookeeper/server/DataTree.java ---
    @@ -941,22 +945,41 @@ public ProcessTxnResult processTxn(TxnHeader header, Record txn)
                     LOG.debug("Failed: " + header + ":" + txn, e);
                 }
             }
    +
    +
             /*
    -         * A snapshot might be in progress while we are modifying the data
    -         * tree. If we set lastProcessedZxid prior to making corresponding
    -         * change to the tree, then the zxid associated with the snapshot
    -         * file will be ahead of its contents. Thus, while restoring from
    -         * the snapshot, the restore method will not apply the transaction
    -         * for zxid associated with the snapshot file, since the restore
    -         * method assumes that transaction to be present in the snapshot.
    +         * Things we can only update after the whole txn is applied to data
    +         * tree.
              *
    -         * To avoid this, we first apply the transaction and then modify
    -         * lastProcessedZxid.  During restore, we correctly handle the
    -         * case where the snapshot contains data ahead of the zxid associated
    -         * with the file.
    +         * If we update the lastProcessedZxid with the first sub txn in multi
    +         * and there is a snapshot in progress, it's possible that the zxid
    +         * associated with the snapshot only include partial of the multi op.
    +         *
    +         * When loading snapshot, it will only load the txns after the zxid
    +         * associated with snapshot file, which could data inconsistency due
    --- End diff --
    
    nit: which could **cause** data inconsistency


---

Mime
View raw message