You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ay...@apache.org on 2019/08/22 17:28:57 UTC
[hadoop] branch branch-3.1 updated: HDFS-14276. [SBN read] Reduce
tailing overhead. Contributed by Wei-Chiu Chuang.
This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 900384c HDFS-14276. [SBN read] Reduce tailing overhead. Contributed by Wei-Chiu Chuang.
900384c is described below
commit 900384cf57af6e97193adb1849eb7ea8d8af399d
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Thu Aug 22 02:25:06 2019 +0530
HDFS-14276. [SBN read] Reduce tailing overhead. Contributed by Wei-Chiu Chuang.
---
.../org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java | 8 ++++++--
.../apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java | 3 +--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java
index 3573db9..ca231b4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java
@@ -468,10 +468,12 @@ public class EditLogTailer {
try {
// There's no point in triggering a log roll if the Standby hasn't
// read any more transactions since the last time a roll was
- // triggered.
+ // triggered.
+ boolean triggeredLogRoll = false;
if (tooLongSinceLastLoad() &&
lastRollTriggerTxId < lastLoadedTxnId) {
triggerActiveLogRoll();
+ triggeredLogRoll = true;
}
/**
* Check again in case someone calls {@link EditLogTailer#stop} while
@@ -497,7 +499,9 @@ public class EditLogTailer {
Time.monotonicNow() - startTime);
}
//Update NameDirSize Metric
- namesystem.getFSImage().getStorage().updateNameDirSize();
+ if (triggeredLogRoll) {
+ namesystem.getFSImage().getStorage().updateNameDirSize();
+ }
} catch (EditLogInputException elie) {
LOG.warn("Error while reading edits from disk. Will try again.", elie);
} catch (InterruptedException ie) {
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java
index 3728420..a179b16 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMXBean.java
@@ -665,6 +665,7 @@ public class TestNameNodeMXBean {
public void testNNDirectorySize() throws Exception{
Configuration conf = new Configuration();
conf.setInt(DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_KEY, 1);
+ conf.setInt(DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_KEY, 0);
MiniDFSCluster cluster = null;
for (int i = 0; i < 5; i++) {
try{
@@ -694,8 +695,6 @@ public class TestNameNodeMXBean {
FSNamesystem nn0 = cluster.getNamesystem(0);
FSNamesystem nn1 = cluster.getNamesystem(1);
- checkNNDirSize(cluster.getNameDirs(0), nn0.getNameDirSize());
- checkNNDirSize(cluster.getNameDirs(1), nn1.getNameDirSize());
cluster.transitionToActive(0);
fs = cluster.getFileSystem(0);
DFSTestUtil.createFile(fs, new Path("/file"), 0, (short) 1, 0L);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org