From 1e3a0b0d931676b191cb4813ed1a283ebb24d4eb Mon Sep 17 00:00:00 2001 From: Stephen O'Donnell Date: Fri, 31 Jan 2020 16:11:45 -0800 Subject: [PATCH] HDFS-7175. Client-side SocketTimeoutException during Fsck. Contributed by Stephen O'Donnell, Akira Ajisaka. Signed-off-by: Wei-Chiu Chuang Co-authored-by: Akira Ajisaka --- .../hadoop/hdfs/server/namenode/NamenodeFsck.java | 13 +++++++------ .../hadoop-hdfs/src/site/markdown/HDFSCommands.md | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java index 69b1555802d..ff5f4308f47 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java @@ -147,7 +147,6 @@ public class NamenodeFsck implements DataEncryptionKeyFactory { private boolean showLocations = false; private boolean showRacks = false; private boolean showStoragePolcies = false; - private boolean showprogress = false; private boolean showCorruptFileBlocks = false; private boolean showReplicaDetails = false; @@ -249,7 +248,10 @@ public class NamenodeFsck implements DataEncryptionKeyFactory { } else if (key.equals("storagepolicies")) { this.showStoragePolcies = true; } else if (key.equals("showprogress")) { - this.showprogress = true; + out.println("The fsck switch -showprogress is deprecated and no " + + "longer has any effect. Progress is now shown by default."); + LOG.warn("The fsck switch -showprogress is deprecated and no longer " + + "has any effect. Progress is now shown by default."); } else if (key.equals("openforwrite")) { this.showOpenFiles = true; } else if (key.equals("listcorruptfileblocks")) { @@ -501,9 +503,8 @@ public class NamenodeFsck implements DataEncryptionKeyFactory { void check(String parent, HdfsFileStatus file, Result replRes, Result ecRes) throws IOException { String path = file.getFullName(parent); - if (showprogress && - (totalDirs + totalSymlinks + replRes.totalFiles + ecRes.totalFiles) - % 100 == 0) { + if ((totalDirs + totalSymlinks + replRes.totalFiles + ecRes.totalFiles) + % 1000 == 0) { out.println(); out.flush(); } @@ -607,7 +608,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory { } else if (showFiles) { out.print(path + " " + fileLen + " bytes, " + redundancyPolicy + " " + blocks.locatedBlockCount() + " block(s): "); - } else if (showprogress) { + } else if (res.totalFiles % 100 == 0) { out.print('.'); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md index 138f18f5f1d..bc5ac307694 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md +++ b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md @@ -102,7 +102,7 @@ Usage: | `-list-corruptfileblocks` | Print out list of missing blocks and files they belong to. | | `-move` | Move corrupted files to /lost+found. | | `-openforwrite` | Print out files opened for write. | -| `-showprogress` | Print out dots for progress in output. Default is OFF (no progress). | +| `-showprogress` | Deprecated. A dot is print every 100 files processed with or without this switch. | | `-storagepolicies` | Print out storage policy summary for the blocks. | | `-maintenance` | Print out maintenance state node details. | | `-blockId` | Print out information about the block. |