|
21 | 21 | import java.io.IOException;
|
22 | 22 | import java.util.Objects;
|
23 | 23 |
|
| 24 | +import org.slf4j.Logger; |
| 25 | +import org.slf4j.LoggerFactory; |
| 26 | + |
24 | 27 | import org.apache.commons.lang3.tuple.Pair;
|
25 | 28 | import org.apache.hadoop.conf.Configuration;
|
26 | 29 | import org.apache.hadoop.fs.FileSystem;
|
|
51 | 54 | */
|
52 | 55 | public final class ManifestCommitterConfig implements IOStatisticsSource {
|
53 | 56 |
|
| 57 | + private static final Logger LOG = LoggerFactory.getLogger( |
| 58 | + ManifestCommitterConfig.class); |
| 59 | + |
54 | 60 | /**
|
55 | 61 | * Final destination of work.
|
56 | 62 | * This is <i>unqualified</i>.
|
@@ -153,6 +159,12 @@ public final class ManifestCommitterConfig implements IOStatisticsSource {
|
153 | 159 | */
|
154 | 160 | private final int writerQueueCapacity;
|
155 | 161 |
|
| 162 | + /** |
| 163 | + * How many attempts to save a task manifest by save and rename |
| 164 | + * before giving up. |
| 165 | + */ |
| 166 | + private final int saveManifestAttempts; |
| 167 | + |
156 | 168 | /**
|
157 | 169 | * Constructor.
|
158 | 170 | * @param outputPath destination path of the job.
|
@@ -198,6 +210,14 @@ public final class ManifestCommitterConfig implements IOStatisticsSource {
|
198 | 210 | this.writerQueueCapacity = conf.getInt(
|
199 | 211 | OPT_WRITER_QUEUE_CAPACITY,
|
200 | 212 | DEFAULT_WRITER_QUEUE_CAPACITY);
|
| 213 | + int attempts = conf.getInt(OPT_MANIFEST_SAVE_ATTEMPTS, |
| 214 | + OPT_MANIFEST_SAVE_ATTEMPTS_DEFAULT); |
| 215 | + if (attempts < 1) { |
| 216 | + LOG.warn("Invalid value for {}: {}", |
| 217 | + OPT_MANIFEST_SAVE_ATTEMPTS, attempts); |
| 218 | + attempts = 1; |
| 219 | + } |
| 220 | + this.saveManifestAttempts = attempts; |
201 | 221 |
|
202 | 222 | // if constructed with a task attempt, build the task ID and path.
|
203 | 223 | if (context instanceof TaskAttemptContext) {
|
@@ -332,6 +352,10 @@ public String getName() {
|
332 | 352 | return name;
|
333 | 353 | }
|
334 | 354 |
|
| 355 | + public int getSaveManifestAttempts() { |
| 356 | + return saveManifestAttempts; |
| 357 | + } |
| 358 | + |
335 | 359 | /**
|
336 | 360 | * Get writer queue capacity.
|
337 | 361 | * @return the queue capacity
|
|
0 commit comments