Repository: zookeeper Updated Branches: refs/heads/master 66554218a -> 069c3e4fc
ZOOKEEPER-2824: `FileChannel#size` info should be added to `FileTxnLog#commit` to solve the confuse that reason is too large log or too busy disk I/O `FileChannel#size` info should be added to `FileTxnLog#commit` to solve the confuse that reason is too large log or too busy disk I/O ------ Example from jenkins [log](https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/830/console): ```java 2017-06-28 10:25:16,645 [myid:] - WARN [SyncThread:0:FileTxnLog341] - fsync-ing the write ahead log (1945616 bytes) in SyncThread:0 took 2240ms which will adversely effect operation latency. See the ZooKeeper troubleshooting guide ``` Author: asdf2014 <benedictjin2...@gmail.com> Author: asdf2014 <1571805...@qq.com> Reviewers: Patrick Hunt <ph...@apache.org>, Andor Molnár <an...@cloudera.com>, Abraham Fine <af...@apache.org> Closes #296 from asdf2014/ZOOKEEPER-2824 and squashes the following commits: 7cf4b6848 [asdf2014] Improve latency log description dd2268f2f [asdf2014] ZOOKEEPER-2824: `FileChannel#size` info should be added to `FileTxnLog#commit` to solve the confuse that reason is too large log or too busy disk I/O Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/069c3e4f Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/069c3e4f Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/069c3e4f Branch: refs/heads/master Commit: 069c3e4fccbd56307b19b57864fbf6312ace2219 Parents: 6655421 Author: Benedict Jin <benedictjin2...@gmail.com> Authored: Thu Feb 1 15:26:58 2018 -0800 Committer: Abraham Fine <af...@apache.org> Committed: Thu Feb 1 15:26:58 2018 -0800 ---------------------------------------------------------------------- .../main/org/apache/zookeeper/server/persistence/FileTxnLog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zookeeper/blob/069c3e4f/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java ---------------------------------------------------------------------- diff --git a/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java b/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java index a35ae64..9edc38e 100644 --- a/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java +++ b/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java @@ -370,7 +370,8 @@ public class FileTxnLog implements TxnLog { if (forceSync) { long startSyncNS = System.nanoTime(); - log.getChannel().force(false); + FileChannel channel = log.getChannel(); + channel.force(false); syncElapsedMS = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startSyncNS); if (syncElapsedMS > fsyncWarningThresholdMS) { @@ -378,6 +379,7 @@ public class FileTxnLog implements TxnLog { + Thread.currentThread().getName() + " took " + syncElapsedMS + "ms which will adversely effect operation latency. " + + "File size is " + channel.size() + " bytes. " + "See the ZooKeeper troubleshooting guide"); } }