public final class CommitContext extends Object implements Closeable
WeakReferenceThreadMap
is used here; a GC may lose the
references, but they will recreated as needed.Constructor and Description |
---|
CommitContext(CommitOperations commitOperations,
org.apache.hadoop.conf.Configuration conf,
String jobId,
int committerThreads,
org.apache.hadoop.fs.statistics.IOStatisticsContext ioStatisticsContext)
Create for testing.
|
CommitContext(CommitOperations commitOperations,
org.apache.hadoop.mapreduce.JobContext jobContext,
int committerThreads,
org.apache.hadoop.fs.statistics.IOStatisticsContext ioStatisticsContext)
Create.
|
Modifier and Type | Method and Description |
---|---|
void |
abortMultipartCommit(String destKey,
String uploadId)
|
void |
abortSingleCommit(SinglePendingCommit commit)
|
void |
close() |
CommitOperations.MaybeIOE |
commit(SinglePendingCommit commit,
String origin)
Commit a single pending commit; exceptions are caught
and converted to an outcome.
|
void |
commitOrFail(SinglePendingCommit commit)
Commit the operation, throwing an exception on any failure.
|
org.apache.hadoop.conf.Configuration |
getConf()
Job configuration.
|
org.apache.hadoop.util.functional.TaskPool.Submitter |
getInnerSubmitter()
Return a submitter.
|
org.apache.hadoop.fs.statistics.IOStatisticsContext |
getIOStatisticsContext()
IOStatistics context of the created thread.
|
org.apache.hadoop.mapreduce.JobContext |
getJobContext()
Job Context.
|
String |
getJobId()
Get the job ID.
|
org.apache.hadoop.util.functional.TaskPool.Submitter |
getOuterSubmitter()
Return a submitter.
|
org.apache.hadoop.util.JsonSerialization<PendingSet> |
getPendingSetSerializer()
Get a serializer for .pendingset files.
|
org.apache.hadoop.util.JsonSerialization<SinglePendingCommit> |
getSinglePendingFileSerializer()
Get a serializer for .pending files.
|
boolean |
isCollectIOStatistics()
Collecting thread level IO statistics?
|
void |
maybeResetIOStatisticsContext()
Reset the IOStatistics context if statistics are being
collected.
|
void |
revertCommit(SinglePendingCommit commit)
|
void |
switchToIOStatisticsContext()
Switch to the context IOStatistics context,
if needed.
|
String |
toString() |
public CommitContext(CommitOperations commitOperations, org.apache.hadoop.mapreduce.JobContext jobContext, int committerThreads, org.apache.hadoop.fs.statistics.IOStatisticsContext ioStatisticsContext)
commitOperations
- commit callbacksjobContext
- job contextcommitterThreads
- number of commit threadsioStatisticsContext
- IOStatistics context of current threadpublic CommitContext(CommitOperations commitOperations, org.apache.hadoop.conf.Configuration conf, String jobId, int committerThreads, org.apache.hadoop.fs.statistics.IOStatisticsContext ioStatisticsContext)
commitOperations
- commit callbacksconf
- job confjobId
- IDcommitterThreads
- number of commit threadsioStatisticsContext
- IOStatistics context of current threadpublic void commitOrFail(SinglePendingCommit commit) throws IOException
CommitOperations#commitOrFail(SinglePendingCommit)
.commit
- commit to executeIOException
- on a failurepublic CommitOperations.MaybeIOE commit(SinglePendingCommit commit, String origin)
CommitOperations.commit(SinglePendingCommit, String)
.commit
- entry to commitorigin
- origin path/string for outcome textpublic void abortSingleCommit(SinglePendingCommit commit) throws IOException
commit
- pending commit to abortFileNotFoundException
- if the abort ID is unknownIOException
- on any failurepublic void revertCommit(SinglePendingCommit commit) throws IOException
commit
- pending commitIOException
- failurepublic void abortMultipartCommit(String destKey, String uploadId) throws IOException
destKey
- destination keyuploadId
- upload to cancelFileNotFoundException
- if the abort ID is unknownIOException
- on any failurepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public org.apache.hadoop.mapreduce.JobContext getJobContext()
public org.apache.hadoop.util.functional.TaskPool.Submitter getOuterSubmitter()
public org.apache.hadoop.util.functional.TaskPool.Submitter getInnerSubmitter()
public org.apache.hadoop.util.JsonSerialization<SinglePendingCommit> getSinglePendingFileSerializer()
public org.apache.hadoop.util.JsonSerialization<PendingSet> getPendingSetSerializer()
public org.apache.hadoop.conf.Configuration getConf()
public String getJobId()
public boolean isCollectIOStatistics()
public org.apache.hadoop.fs.statistics.IOStatisticsContext getIOStatisticsContext()
public void switchToIOStatisticsContext()
public void maybeResetIOStatisticsContext()
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.