Package org.apache.hadoop.fs.s3a.commit
Class AbstractS3ACommitter.ActiveCommit
java.lang.Object
org.apache.hadoop.fs.s3a.commit.AbstractS3ACommitter.ActiveCommit
- Enclosing class:
- AbstractS3ACommitter
State of the active commit operation.
It contains a list of all pendingset files to load as the source
of outstanding commits to complete/abort,
and tracks the files uploaded.
To avoid running out of heap by loading all the source files
simultaneously:
- The list of files to load is passed round but the contents are only loaded on demand.
- The number of written files tracked for logging in the _SUCCESS file are limited to a small amount -enough for testing only.
-
Constructor Summary
ConstructorsConstructorDescriptionActiveCommit(org.apache.hadoop.fs.FileSystem sourceFS, List<? extends org.apache.hadoop.fs.FileStatus> sourceFiles) Construct from a source FS and list of files. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.apache.hadoop.fs.FileStatus status) empty()Get the empty entry.fromStatusIterator(org.apache.hadoop.fs.FileSystem pendingFS, org.apache.hadoop.fs.RemoteIterator<? extends org.apache.hadoop.fs.FileStatus> statuses) Create an active commit of the given pending files.longintorg.apache.hadoop.fs.statistics.IOStatisticsSnapshotList<org.apache.hadoop.fs.FileStatus>org.apache.hadoop.fs.FileSystembooleanisEmpty()voidpendingsetCommitted(org.apache.hadoop.fs.statistics.IOStatistics sourceStatistics) Callback when a pendingset has been committed, including any source statistics.intsize()voiduploadCommitted(String key, long size) Note that a file was committed.
-
Constructor Details
-
ActiveCommit
public ActiveCommit(org.apache.hadoop.fs.FileSystem sourceFS, List<? extends org.apache.hadoop.fs.FileStatus> sourceFiles) Construct from a source FS and list of files.- Parameters:
sourceFS- filesystem containing the list of pending filessourceFiles- .pendingset files to load and commit.
-
-
Method Details
-
fromStatusIterator
public static AbstractS3ACommitter.ActiveCommit fromStatusIterator(org.apache.hadoop.fs.FileSystem pendingFS, org.apache.hadoop.fs.RemoteIterator<? extends org.apache.hadoop.fs.FileStatus> statuses) throws IOException Create an active commit of the given pending files.- Parameters:
pendingFS- source filesystem.statuses- iterator of file status or subclass to use.- Returns:
- the commit
- Throws:
IOException- if the iterator raises one.
-
empty
Get the empty entry.- Returns:
- an active commit with no pending files.
-
getSourceFiles
-
getSourceFS
public org.apache.hadoop.fs.FileSystem getSourceFS() -
uploadCommitted
Note that a file was committed. Increase the counter of files and total size. If there is room in the committedFiles list, the file will be added to the list and so end up in the _SUCCESS file.- Parameters:
key- key of the committed object.size- size in bytes.
-
pendingsetCommitted
public void pendingsetCommitted(org.apache.hadoop.fs.statistics.IOStatistics sourceStatistics) Callback when a pendingset has been committed, including any source statistics.- Parameters:
sourceStatistics- any source statistics
-
getIOStatistics
public org.apache.hadoop.fs.statistics.IOStatisticsSnapshot getIOStatistics() -
getCommittedObjects
-
getCommittedFileCount
public int getCommittedFileCount() -
getCommittedBytes
public long getCommittedBytes() -
size
public int size() -
isEmpty
public boolean isEmpty() -
add
public void add(org.apache.hadoop.fs.FileStatus status)
-