Skip to content

Commit b3cb4f8

Browse files
committed
HADOOP-17981. review javadocs; reduce noisiness
Change-Id: I2bc9aefa0755ed68115526d5f6f3610d9eec6704
1 parent 74b83eb commit b3cb4f8

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,6 @@ private void mergePathsInParallel(FileSystem fs, final FileStatus from,
804804

805805
/**
806806
* Rename the file via the resilient commit helper.
807-
* Becquse any file at the destination will have been deleted,
808-
* tell the commit helper that there is no need to probe the
809-
* store for existance.
810-
* This assumes that no two tasks created files with the same name,
811-
* but so does any overwrite check performed nonatomically
812-
* on the client.
813807
* @param from source filestatus
814808
* @param to destination path
815809
* @throws IOException failure to commit or rename.

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/ResilientCommitByRenameHelper.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public boolean isRenameRecoveryAvailable() {
102102
}
103103

104104
/**
105-
* get count of rename failures recovered from.
105+
* Get count of rename failures recovered from.
106106
* @return count of recoveries.
107107
*/
108108
public int getRecoveryCount() {
@@ -128,8 +128,9 @@ public static boolean filesystemHasResilientCommmit(
128128

129129
/**
130130
* Commit a file.
131-
* Rename a file from source to dest; if the underlying FS API call
132-
* returned false that's escalated to an IOE.
131+
* Rename a file from source to dest with recovery attempted
132+
* if the operation raises an exception/returns false, and
133+
* recovery is enabled.
133134
* @param sourceStatus source status file
134135
* @param dest destination path
135136
* @return the outcome
@@ -141,10 +142,9 @@ public CommitOutcome commitFile(
141142
throws IOException {
142143
final Path source = sourceStatus.getPath();
143144
String operation = String.format("rename(%s, %s)", source, dest);
144-
LOG.debug("{}", operation);
145145

146-
try (DurationInfo du = new DurationInfo(LOG, "%s with status %s",
147-
operation, sourceStatus)) {
146+
try (DurationInfo du = new DurationInfo(LOG, false,
147+
"%s with status %s", operation, sourceStatus)) {
148148
if (operations.renameFile(source, dest)) {
149149
// success
150150
return new CommitOutcome();
@@ -226,7 +226,6 @@ private String getEtag(FileStatus status) {
226226

227227
/**
228228
* Escalate a rename failure to an exception.
229-
* This never returns
230229
* @param source source path
231230
* @param dest dest path
232231
* @return an exception to throw
@@ -265,6 +264,7 @@ public String toString() {
265264
* Outcome from the commit.
266265
*/
267266
public static final class CommitOutcome {
267+
268268
/**
269269
* Rename failed but etag checking concluded it finished.
270270
*/
@@ -275,10 +275,18 @@ public static final class CommitOutcome {
275275
*/
276276
private final IOException caughtException;
277277

278+
/**
279+
* Success constructor.
280+
*/
278281
CommitOutcome() {
279282
this(false, null);
280283
}
281284

285+
/**
286+
* Full constructor; used on failures.
287+
* @param renameFailureResolvedThroughEtags was a rename failure recovered?
288+
* @param caughtException Any exception caught before etag checking succeeded.
289+
*/
282290
CommitOutcome(
283291
boolean renameFailureResolvedThroughEtags,
284292
IOException caughtException) {
@@ -315,6 +323,10 @@ public static class FileSystemOperations {
315323
*/
316324
private final FileSystem fileSystem;
317325

326+
/**
327+
* Constructor.
328+
* @param fileSystem filesystem to invoke.
329+
*/
318330
public FileSystemOperations(final FileSystem fileSystem) {
319331
this.fileSystem = fileSystem;
320332
}

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemResilientCommit.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public class ITestAzureBlobFileSystemResilientCommit
5858
private static final byte[] DATA = toAsciiByteArray("hello");
5959
private static final byte[] DATA2 = toAsciiByteArray("world");
6060

61+
/**
62+
* is the test FS set up to raise exceptions on rename failures?
63+
*/
6164
private final boolean raiseExceptions;
6265

6366
/**
@@ -160,7 +163,6 @@ public void testSimpleRename() throws Throwable {
160163
E_NO_SOURCE,
161164
() -> targetFS.rename(sourcePath, destPath));
162165
} else {
163-
164166
Assertions.assertThat(targetFS.rename(sourcePath, destPath))
165167
.describedAs("return value of rename")
166168
.isFalse();
@@ -177,7 +179,6 @@ public void testSimpleRenameNoSource() throws Throwable {
177179
E_NO_SOURCE,
178180
() -> targetFS.rename(sourcePath, destPath));
179181
} else {
180-
181182
Assertions.assertThat(targetFS.rename(sourcePath, destPath))
182183
.describedAs("return value of rename")
183184
.isFalse();
@@ -235,9 +236,9 @@ public void testDoubleCommitDifferentFiles() throws Throwable {
235236
}
236237

237238
/**
238-
* Commit a file, then
239-
* try to commit again with a filestatus with a different source etag.
240-
* Recovery will not report success.
239+
* Commit a file, then try to commit again with a
240+
* filestatus with a different source etag.
241+
* Recovery MUST fail
241242
*/
242243
@Test
243244
public void testDoubleCommitDifferentFiles2() throws Throwable {
@@ -263,7 +264,7 @@ public void testDoubleCommitDifferentFiles2() throws Throwable {
263264
}
264265

265266
/**
266-
* try to commit a file to a path where the destination
267+
* Try to commit a file to a path where the destination
267268
* directory does not exist -expect an exception to
268269
* be raised.
269270
*/
@@ -276,6 +277,10 @@ public void testCommitMissingDestDir() throws Throwable {
276277
commitHelper.commitFile(status, subpath));
277278
}
278279

280+
/**
281+
* If there is no source and no destination, recovery
282+
* MUST fail.
283+
*/
279284
@Test
280285
public void testCommitNoSource() throws Throwable {
281286
describe("delete the source file, expect commit to fail");

0 commit comments

Comments
 (0)