@InterfaceAudience.Private @InterfaceStability.Unstable public class SuccessData extends PersistentCommitData implements org.apache.hadoop.fs.statistics.IOStatisticsSource
_SUCCESS
marker file.
This provides an easy way to determine which committer was used
to commit work.
FileOutputCommitter
.SuccessData
:
A s3guard committer with name in in committer
field.name
field
to differentiate from any other JSON-based manifest and to identify
changes in the output format.
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() |
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 |
save(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean overwrite)
Save to a hadoop filesystem.
|
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 |
setTimestamp(long timestamp) |
byte[] |
toBytes()
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.
|
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
ValidationFailure
- if the data is invalidpublic byte[] toBytes() throws IOException
PersistentCommitData
toBytes
in class PersistentCommitData
IOException
- serialization problem or validation failure.public void save(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean overwrite) throws IOException
PersistentCommitData
save
in class PersistentCommitData
fs
- filesystempath
- pathoverwrite
- should any existing file be overwrittenIOException
- 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 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()
getIOStatistics
in interface org.apache.hadoop.fs.statistics.IOStatisticsSource
public void setIOStatistics(org.apache.hadoop.fs.statistics.IOStatisticsSnapshot ioStatistics)
Copyright © 2008–2022 Apache Software Foundation. All rights reserved.