@InterfaceAudience.Private @InterfaceStability.Unstable public class SuccessData extends PersistentCommitData<SuccessData>
_SUCCESS
marker file.
This provides an easy way to determine which committer was used
to commit work.
FileOutputCommitter
.SuccessData
:
An S3A committer with name in in committer
field.org.apache.hadoop.mapreduce.lib.output.committer.manifest.files.ManifestSuccessData
The JSON format SHOULD be considered public and evolving with compatibility across versions.
All the Java serialization data is different and may change across versions with no stability guarantees other than "manifest summaries MAY be serialized between processes with the exact same version of this binary on their classpaths." That is sufficient for testing in Spark.
To aid with Java serialization, the maps and lists are
exclusively those which serialize well.
IOStatisticsSnapshot has a lot of complexity in marshalling
there; this class doesn't worry about concurrent access
so is simpler.
Note: to deal with scale issues, the S3A committers do not include any
more than the number of objects listed in
CommitConstants.SUCCESS_MARKER_FILE_LIMIT
.
This is intended to suffice for basic integration tests.
Larger tests should examine the generated files themselves.
Modifier and Type | Field and Description |
---|---|
static String |
NAME
Name to include in persisted data, so as to differentiate from
any other manifests: "org.apache.hadoop.fs.s3a.commit.files.SuccessData/1".
|
static int |
VERSION
Supported version value: 1.
|
Constructor and Description |
---|
SuccessData() |
Modifier and Type | Method and Description |
---|---|
void |
addDiagnostic(String key,
String value)
Add a diagnostics entry.
|
String |
dumpDiagnostics(String prefix,
String middle,
String suffix)
Dump the diagnostics (if any) to a string.
|
String |
dumpMetrics(String prefix,
String middle,
String suffix)
Dump the metrics (if any) to a string.
|
String |
getCommitter() |
String |
getDate() |
String |
getDescription() |
Map<String,String> |
getDiagnostics() |
List<String> |
getFilenames() |
String |
getHostname() |
org.apache.hadoop.fs.statistics.IOStatisticsSnapshot |
getIOStatistics() |
String |
getJobId() |
String |
getJobIdSource() |
Map<String,Long> |
getMetrics() |
String |
getName() |
String |
getStage() |
String |
getState() |
boolean |
getSuccess()
Get the success flag.
|
long |
getTimestamp() |
protected static String |
joinMap(Map<String,?> map,
String prefix,
String middle,
String suffix)
Join any map of string to value into a string, sorting the keys first.
|
static SuccessData |
load(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Load an instance from a file, then validate it.
|
void |
putDiagnostic(String key,
String value)
Add a diagnostics entry.
|
void |
recordJobFailure(Throwable thrown)
Note a failure by setting success flag to false,
then add the exception to the diagnostics.
|
org.apache.hadoop.fs.statistics.IOStatistics |
save(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.util.JsonSerialization<SuccessData> serializer)
Save to a hadoop filesystem.
|
static org.apache.hadoop.util.JsonSerialization<SuccessData> |
serializer()
Get a JSON serializer for this class.
|
void |
setCommitter(String committer) |
void |
setDate(String date) |
void |
setDescription(String description) |
void |
setDiagnostics(Map<String,String> diagnostics) |
void |
setFilenames(List<String> filenames) |
void |
setHostname(String hostname) |
void |
setIOStatistics(org.apache.hadoop.fs.statistics.IOStatisticsSnapshot ioStatistics) |
void |
setJobId(String jobId) |
void |
setJobIdSource(String jobIdSource) |
void |
setMetrics(Map<String,Long> metrics) |
void |
setName(String name) |
void |
setState(String state) |
void |
setSuccess(boolean success)
Set the success flag.
|
void |
setTimestamp(long timestamp) |
byte[] |
toBytes(org.apache.hadoop.util.JsonSerialization<SuccessData> serializer)
Serialize to JSON and then to a byte array, after performing a
preflight validation of the data to be saved.
|
String |
toString() |
void |
validate()
Validate the data: those fields which must be non empty, must be set.
|
load, saveFile, saveToStream
public static final int VERSION
serialVersionUID
will change,
to avoid deserialization problems.public static final String NAME
public void validate() throws ValidationFailure
PersistentCommitData
validate
in class PersistentCommitData<SuccessData>
ValidationFailure
- if the data is invalidpublic byte[] toBytes(org.apache.hadoop.util.JsonSerialization<SuccessData> serializer) throws IOException
PersistentCommitData
toBytes
in class PersistentCommitData<SuccessData>
serializer
- serializer to useIOException
- serialization problem or validation failure.public org.apache.hadoop.fs.statistics.IOStatistics save(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.util.JsonSerialization<SuccessData> serializer) throws IOException
PersistentCommitData
save
in class PersistentCommitData<SuccessData>
fs
- filesystempath
- pathserializer
- serializer to useIOException
- IO exceptionpublic String dumpMetrics(String prefix, String middle, String suffix)
prefix
- prefix before every entrymiddle
- string between key and valuesuffix
- suffix to each entrypublic String dumpDiagnostics(String prefix, String middle, String suffix)
prefix
- prefix before every entrymiddle
- string between key and valuesuffix
- suffix to each entryprotected static String joinMap(Map<String,?> map, String prefix, String middle, String suffix)
map
- map to joinprefix
- prefix before every entrymiddle
- string between key and valuesuffix
- suffix to each entrypublic static SuccessData load(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException
fs
- filesystempath
- pathIOException
- IO failureValidationFailure
- if the data is invalidpublic static org.apache.hadoop.util.JsonSerialization<SuccessData> serializer()
public String getName()
public void setName(String name)
public long getTimestamp()
public void setTimestamp(long timestamp)
public String getDate()
public void setDate(String date)
public String getHostname()
public void setHostname(String hostname)
public String getCommitter()
public void setCommitter(String committer)
public String getDescription()
public void setDescription(String description)
public void addDiagnostic(String key, String value)
key
- namevalue
- valuepublic String getJobId()
public void setJobId(String jobId)
public String getJobIdSource()
public void setJobIdSource(String jobIdSource)
public org.apache.hadoop.fs.statistics.IOStatisticsSnapshot getIOStatistics()
public void setIOStatistics(org.apache.hadoop.fs.statistics.IOStatisticsSnapshot ioStatistics)
public void setSuccess(boolean success)
success
- did the job succeed?public boolean getSuccess()
public String getState()
public void setState(String state)
public String getStage()
public void putDiagnostic(String key, String value)
key
- namevalue
- valuepublic void recordJobFailure(Throwable thrown)
thrown
- throwableCopyright © 2008–2024 Apache Software Foundation. All rights reserved.