Package org.apache.hadoop.fs.s3a.commit
Class MagicCommitIntegration
java.lang.Object
org.apache.hadoop.fs.s3a.impl.AbstractStoreOperation
org.apache.hadoop.fs.s3a.commit.MagicCommitIntegration
Adds the code needed for S3A to support magic committers.
It's pulled out to keep S3A FS class slightly less complex.
This class can be instantiated even when magic commit is disabled;
in this case:
isMagicCommitPath(Path)will always return false.isUnderMagicPath(Path)will always return false.createTracker(Path, String, PutTrackerStatistics)will always return an instance ofPutTracker.
Important
: must not directly or indirectly import a class which uses any datatype in hadoop-mapreduce.-
Constructor Summary
ConstructorsConstructorDescriptionMagicCommitIntegration(S3AFileSystem owner, boolean magicCommitEnabled) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptioncreateTracker(org.apache.hadoop.fs.Path path, String key, PutTrackerStatistics trackerStatistics) Given a path and a key to that same path, create a tracker for it.booleanIs magic commit enabled?booleanisMagicCommitPath(org.apache.hadoop.fs.Path path) Predicate: is a path a magic commit path?booleanisUnderMagicPath(org.apache.hadoop.fs.Path path) Is this path in/under a magic path...regardless of file type.keyOfFinalDestination(List<String> elements, String key) Given an (elements, key) pair, return the key of the final destination of the PUT, that is: where the final path is expected to go?Methods inherited from class org.apache.hadoop.fs.s3a.impl.AbstractStoreOperation
activateAuditSpan, getAuditSpan, getStoreContext
-
Constructor Details
-
MagicCommitIntegration
Instantiate.- Parameters:
owner- owner classmagicCommitEnabled- is magic commit enabled.
-
-
Method Details
-
keyOfFinalDestination
Given an (elements, key) pair, return the key of the final destination of the PUT, that is: where the final path is expected to go?- Parameters:
elements- path split to elementskey- key- Returns:
- key for final put. If this is not a magic commit, the same as the key in.
-
createTracker
public PutTracker createTracker(org.apache.hadoop.fs.Path path, String key, PutTrackerStatistics trackerStatistics) Given a path and a key to that same path, create a tracker for it. This specific tracker will be chosen based on whether or not the path is a magic one. Auditing: the span used to invoke this method will be the one used to create the write operation helper for the commit tracker.- Parameters:
path- path of nominal writekey- key of path of nominal writetrackerStatistics- tracker statistics- Returns:
- the tracker for this operation.
-
isMagicCommitEnabled
public boolean isMagicCommitEnabled()Is magic commit enabled?- Returns:
- true if magic commit is turned on.
-
isMagicCommitPath
public boolean isMagicCommitPath(org.apache.hadoop.fs.Path path) Predicate: is a path a magic commit path?- Parameters:
path- path to examine- Returns:
- true if the path is or is under a magic directory
-
isUnderMagicPath
public boolean isUnderMagicPath(org.apache.hadoop.fs.Path path) Is this path in/under a magic path...regardless of file type. This is used to optimize create() operations.- Parameters:
path- path to check- Returns:
- true if the path is one a magic file write expects.
-