HDFS-7175. Client-side SocketTimeoutException during Fsck. Contributed by Stephen O'Donnell, Akira Ajisaka.

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
Co-authored-by: Akira Ajisaka <aajisaka@apache.org>
(cherry picked from commit 1e3a0b0d93)
(cherry picked from commit e89436b183)
This commit is contained in:
Stephen O'Donnell 2020-01-31 16:11:45 -08:00 committed by Wei-Chiu Chuang
parent ffaf0d3c82
commit 8ea4787f9f
2 changed files with 8 additions and 7 deletions

View File

@ -144,7 +144,6 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
private boolean showLocations = false; private boolean showLocations = false;
private boolean showRacks = false; private boolean showRacks = false;
private boolean showStoragePolcies = false; private boolean showStoragePolcies = false;
private boolean showprogress = false;
private boolean showCorruptFileBlocks = false; private boolean showCorruptFileBlocks = false;
private boolean showReplicaDetails = false; private boolean showReplicaDetails = false;
@ -238,7 +237,10 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
} else if (key.equals("storagepolicies")) { } else if (key.equals("storagepolicies")) {
this.showStoragePolcies = true; this.showStoragePolcies = true;
} else if (key.equals("showprogress")) { } 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")) { } else if (key.equals("openforwrite")) {
this.showOpenFiles = true; this.showOpenFiles = true;
} else if (key.equals("listcorruptfileblocks")) { } else if (key.equals("listcorruptfileblocks")) {
@ -488,9 +490,8 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
void check(String parent, HdfsFileStatus file, Result replRes, Result ecRes) void check(String parent, HdfsFileStatus file, Result replRes, Result ecRes)
throws IOException { throws IOException {
String path = file.getFullName(parent); String path = file.getFullName(parent);
if (showprogress && if ((totalDirs + totalSymlinks + replRes.totalFiles + ecRes.totalFiles)
(totalDirs + totalSymlinks + replRes.totalFiles + ecRes.totalFiles) % 1000 == 0) {
% 100 == 0) {
out.println(); out.println();
out.flush(); out.flush();
} }
@ -594,7 +595,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
} else if (showFiles) { } else if (showFiles) {
out.print(path + " " + fileLen + " bytes, " + redundancyPolicy + " " + out.print(path + " " + fileLen + " bytes, " + redundancyPolicy + " " +
blocks.locatedBlockCount() + " block(s): "); blocks.locatedBlockCount() + " block(s): ");
} else if (showprogress) { } else if (res.totalFiles % 100 == 0) {
out.print('.'); out.print('.');
} }
} }

View File

@ -102,7 +102,7 @@ Usage:
| `-list-corruptfileblocks` | Print out list of missing blocks and files they belong to. | | `-list-corruptfileblocks` | Print out list of missing blocks and files they belong to. |
| `-move` | Move corrupted files to /lost+found. | | `-move` | Move corrupted files to /lost+found. |
| `-openforwrite` | Print out files opened for write. | | `-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. | | `-storagepolicies` | Print out storage policy summary for the blocks. |
| `-maintenance` | Print out maintenance state node details. | | `-maintenance` | Print out maintenance state node details. |
| `-blockId` | Print out information about the block. | | `-blockId` | Print out information about the block. |