Skip to content

Commit 26ba384

Browse files
committed
Revert "HDFS-14617. Improve oiv tool to parse fsimage file in parallel with delimited format. (#2918). Contributed by Hongbing Wang."
This reverts commit 8897549.
1 parent 81879eb commit 26ba384

File tree

6 files changed

+42
-306
lines changed

6 files changed

+42
-306
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewerPB.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ public class OfflineImageViewerPB {
107107
+ " Delimited outputs. If not set, the processor\n"
108108
+ " constructs the namespace in memory \n"
109109
+ " before outputting text.\n"
110-
+ "-m,--multiThread <arg> Use multiThread to process sub-sections.\n"
111110
+ "-h,--help Display usage information and exit\n";
112111

113112
/**
@@ -133,7 +132,6 @@ private static Options buildOptions() {
133132
options.addOption("delimiter", true, "");
134133
options.addOption("sp", false, "");
135134
options.addOption("t", "temp", true, "");
136-
options.addOption("m", "multiThread", true, "");
137135

138136
return options;
139137
}
@@ -187,7 +185,6 @@ public static int run(String[] args) throws Exception {
187185
String delimiter = cmd.getOptionValue("delimiter",
188186
PBImageTextWriter.DEFAULT_DELIMITER);
189187
String tempPath = cmd.getOptionValue("t", "");
190-
int threads = Integer.parseInt(cmd.getOptionValue("m", "1"));
191188

192189
Configuration conf = new Configuration();
193190
PrintStream out = null;
@@ -230,14 +227,15 @@ public static int run(String[] args) throws Exception {
230227
boolean printStoragePolicy = cmd.hasOption("sp");
231228
try (PBImageDelimitedTextWriter writer =
232229
new PBImageDelimitedTextWriter(out, delimiter,
233-
tempPath, printStoragePolicy, threads, outputFile)) {
234-
writer.visit(inputFile);
230+
tempPath, printStoragePolicy);
231+
RandomAccessFile r = new RandomAccessFile(inputFile, "r")) {
232+
writer.visit(r);
235233
}
236234
break;
237235
case "DETECTCORRUPTION":
238236
try (PBImageCorruptionDetector detector =
239237
new PBImageCorruptionDetector(out, delimiter, tempPath)) {
240-
detector.visit(inputFile);
238+
detector.visit(new RandomAccessFile(inputFile, "r"));
241239
}
242240
break;
243241
default:

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageCorruptionDetector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public void afterOutput() throws IOException {
337337
if (parentId != -1) {
338338
entryBuilder.setParentId(parentId);
339339
}
340-
printIfNotEmpty(serialOutStream(), entryBuilder.build());
340+
printIfNotEmpty(entryBuilder.build());
341341
}
342342
}
343343
}

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageDelimitedTextWriter.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,7 @@ public String build() {
146146
PBImageDelimitedTextWriter(PrintStream out, String delimiter,
147147
String tempPath, boolean printStoragePolicy)
148148
throws IOException {
149-
this(out, delimiter, tempPath, printStoragePolicy, 1, "-");
150-
}
151-
152-
PBImageDelimitedTextWriter(PrintStream out, String delimiter,
153-
String tempPath, boolean printStoragePolicy, int threads,
154-
String parallelOut) throws IOException {
155-
super(out, delimiter, tempPath, threads, parallelOut);
149+
super(out, delimiter, tempPath);
156150
this.printStoragePolicy = printStoragePolicy;
157151
}
158152

0 commit comments

Comments
 (0)