Class SkipBadRecords
Hadoop provides an optional mode of execution in which the bad records are detected and skipped in further attempts.
This feature can be used when map/reduce tasks crashes deterministically on certain input. This happens due to bugs in the map/reduce function. The usual course would be to fix these bugs. But sometimes this is not possible; perhaps the bug is in third party libraries for which the source code is not available. Due to this, the task never reaches to completion even with multiple attempts and complete data for that task is lost.
With this feature, only a small portion of data is lost surrounding
the bad record, which may be acceptable for some user applications.
see setMapperMaxSkipRecords(Configuration, long)
The skipping mode gets kicked off after certain no of failures
see setAttemptsToStartSkipping(Configuration, int)
In the skipping mode, the map/reduce task maintains the record range which is getting processed at all times. Before giving the input to the map/reduce function, it sends this record range to the Task tracker. If task crashes, the Task tracker knows which one was the last reported range. On further attempts that range get skipped.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intGet the number of Task attempts AFTER which skip mode will be kicked off.static booleanGet the flag which if set to true,COUNTER_MAP_PROCESSED_RECORDSis incremented by MapRunner after invoking the map function.static booleanGet the flag which if set to true,COUNTER_REDUCE_PROCESSED_GROUPSis incremented by framework after invoking the reduce function.static longGet the number of acceptable skip records surrounding the bad record PER bad record in mapper.static longGet the number of acceptable skip groups surrounding the bad group PER bad group in reducer.static PathGet the directory to which skipped records are written.static voidsetAttemptsToStartSkipping(Configuration conf, int attemptsToStartSkipping) Set the number of Task attempts AFTER which skip mode will be kicked off.static voidsetAutoIncrMapperProcCount(Configuration conf, boolean autoIncr) Set the flag which if set to true,COUNTER_MAP_PROCESSED_RECORDSis incremented by MapRunner after invoking the map function.static voidsetAutoIncrReducerProcCount(Configuration conf, boolean autoIncr) Set the flag which if set to true,COUNTER_REDUCE_PROCESSED_GROUPSis incremented by framework after invoking the reduce function.static voidsetMapperMaxSkipRecords(Configuration conf, long maxSkipRecs) Set the number of acceptable skip records surrounding the bad record PER bad record in mapper.static voidsetReducerMaxSkipGroups(Configuration conf, long maxSkipGrps) Set the number of acceptable skip groups surrounding the bad group PER bad group in reducer.static voidsetSkipOutputPath(JobConf conf, Path path) Set the directory to which skipped records are written.
-
Field Details
-
COUNTER_GROUP
Special counters which are written by the application and are used by the framework for detecting bad records. For detecting bad records these counters must be incremented by the application.- See Also:
-
COUNTER_MAP_PROCESSED_RECORDS
Number of processed map records. -
COUNTER_REDUCE_PROCESSED_GROUPS
Number of processed reduce groups.
-
-
Constructor Details
-
SkipBadRecords
public SkipBadRecords()
-
-
Method Details
-
getAttemptsToStartSkipping
Get the number of Task attempts AFTER which skip mode will be kicked off. When skip mode is kicked off, the tasks reports the range of records which it will process next to the TaskTracker. So that on failures, TT knows which ones are possibly the bad records. On further executions, those are skipped. Default value is 2.- Parameters:
conf- the configuration- Returns:
- attemptsToStartSkipping no of task attempts
-
setAttemptsToStartSkipping
Set the number of Task attempts AFTER which skip mode will be kicked off. When skip mode is kicked off, the tasks reports the range of records which it will process next to the TaskTracker. So that on failures, TT knows which ones are possibly the bad records. On further executions, those are skipped. Default value is 2.- Parameters:
conf- the configurationattemptsToStartSkipping- no of task attempts
-
getAutoIncrMapperProcCount
Get the flag which if set to true,COUNTER_MAP_PROCESSED_RECORDSis incremented by MapRunner after invoking the map function. This value must be set to false for applications which process the records asynchronously or buffer the input records. For example streaming. In such cases applications should increment this counter on their own. Default value is true.- Parameters:
conf- the configuration- Returns:
trueif auto incrementCOUNTER_MAP_PROCESSED_RECORDS.falseotherwise.
-
setAutoIncrMapperProcCount
Set the flag which if set to true,COUNTER_MAP_PROCESSED_RECORDSis incremented by MapRunner after invoking the map function. This value must be set to false for applications which process the records asynchronously or buffer the input records. For example streaming. In such cases applications should increment this counter on their own. Default value is true.- Parameters:
conf- the configurationautoIncr- whether to auto incrementCOUNTER_MAP_PROCESSED_RECORDS.
-
getAutoIncrReducerProcCount
Get the flag which if set to true,COUNTER_REDUCE_PROCESSED_GROUPSis incremented by framework after invoking the reduce function. This value must be set to false for applications which process the records asynchronously or buffer the input records. For example streaming. In such cases applications should increment this counter on their own. Default value is true.- Parameters:
conf- the configuration- Returns:
trueif auto incrementCOUNTER_REDUCE_PROCESSED_GROUPS.falseotherwise.
-
setAutoIncrReducerProcCount
Set the flag which if set to true,COUNTER_REDUCE_PROCESSED_GROUPSis incremented by framework after invoking the reduce function. This value must be set to false for applications which process the records asynchronously or buffer the input records. For example streaming. In such cases applications should increment this counter on their own. Default value is true.- Parameters:
conf- the configurationautoIncr- whether to auto incrementCOUNTER_REDUCE_PROCESSED_GROUPS.
-
getSkipOutputPath
Get the directory to which skipped records are written. By default it is the sub directory of the output _logs directory. User can stop writing skipped records by setting the value null.- Parameters:
conf- the configuration.- Returns:
- path skip output directory. Null is returned if this is not set and output directory is also not set.
-
setSkipOutputPath
Set the directory to which skipped records are written. By default it is the sub directory of the output _logs directory. User can stop writing skipped records by setting the value null.- Parameters:
conf- the configuration.path- skip output directory path
-
getMapperMaxSkipRecords
Get the number of acceptable skip records surrounding the bad record PER bad record in mapper. The number includes the bad record as well. To turn the feature of detection/skipping of bad records off, set the value to 0. The framework tries to narrow down the skipped range by retrying until this threshold is met OR all attempts get exhausted for this task. Set the value to Long.MAX_VALUE to indicate that framework need not try to narrow down. Whatever records(depends on application) get skipped are acceptable. Default value is 0.- Parameters:
conf- the configuration- Returns:
- maxSkipRecs acceptable skip records.
-
setMapperMaxSkipRecords
Set the number of acceptable skip records surrounding the bad record PER bad record in mapper. The number includes the bad record as well. To turn the feature of detection/skipping of bad records off, set the value to 0. The framework tries to narrow down the skipped range by retrying until this threshold is met OR all attempts get exhausted for this task. Set the value to Long.MAX_VALUE to indicate that framework need not try to narrow down. Whatever records(depends on application) get skipped are acceptable. Default value is 0.- Parameters:
conf- the configurationmaxSkipRecs- acceptable skip records.
-
getReducerMaxSkipGroups
Get the number of acceptable skip groups surrounding the bad group PER bad group in reducer. The number includes the bad group as well. To turn the feature of detection/skipping of bad groups off, set the value to 0. The framework tries to narrow down the skipped range by retrying until this threshold is met OR all attempts get exhausted for this task. Set the value to Long.MAX_VALUE to indicate that framework need not try to narrow down. Whatever groups(depends on application) get skipped are acceptable. Default value is 0.- Parameters:
conf- the configuration- Returns:
- maxSkipGrps acceptable skip groups.
-
setReducerMaxSkipGroups
Set the number of acceptable skip groups surrounding the bad group PER bad group in reducer. The number includes the bad group as well. To turn the feature of detection/skipping of bad groups off, set the value to 0. The framework tries to narrow down the skipped range by retrying until this threshold is met OR all attempts get exhausted for this task. Set the value to Long.MAX_VALUE to indicate that framework need not try to narrow down. Whatever groups(depends on application) get skipped are acceptable. Default value is 0.- Parameters:
conf- the configurationmaxSkipGrps- acceptable skip groups.
-