Package org.apache.hadoop.fs.s3a.tools
Class MarkerTool
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.s3a.s3guard.S3GuardTool
org.apache.hadoop.fs.s3a.tools.MarkerTool
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
Audit an S3 bucket for directory markers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResult of a call ofpurgeMarkers(DirMarkerTracker, int); included inMarkerTool.ScanResultso must share visibility.static final classArguments for the scan.static final classBuilder of the scan arguments.static final classResult of the scan operation.Nested classes/interfaces inherited from class org.apache.hadoop.fs.s3a.s3guard.S3GuardTool
S3GuardTool.BucketInfo -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAudit sub-command: "-audit".static final StringClean Sub-command: "-clean".static final StringName of this tool: "markers".static final StringAudit sub-command: "audit".static final StringClean Sub-command: "clean".static final StringLimit of objects to scan: "limit".static final StringMax number of markers to find: "max".static final StringMin number of markers to find: "min".static final StringOnly consider markers found in non-authoritative paths as failures: "nonauth".static final StringName of a file to save the list of markers to: "out".static final StringPurpose of this tool: "View and manipulate S3 directory markers".static final intConstant to use when there is no limit on the number of objects listed: 0.static final intConstant to use when there is no minimum number of markers: -1.Fields inherited from class org.apache.hadoop.fs.s3a.s3guard.S3GuardTool
AGE_OPTIONS_USAGE, DAYS_FLAG, HOURS_FLAG, META_FLAG, MINUTES_FLAG, SECONDS_FLAG, VERBOSE, WRONG_FILESYSTEM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MarkerTool.ScanResultexecMarkerTool(MarkerTool.ScanArgs scanArgs) Execute the marker tool, with no checks on return codes.getName()Return sub-command name.getUsage()booleanvoidReset the store and filesystem bindings.intrun(String[] args, PrintStream stream) Run the tool, capturing the output (if the tool supports that).voidsetVerbose(boolean verbose) Methods inherited from class org.apache.hadoop.fs.s3a.s3guard.S3GuardTool
addAgeOptions, badState, bindFilesystem, close, dumpFileSystemStatistics, errorln, errorln, exit, exitException, getCommandFormat, getFilesystem, initS3AFileSystem, invalidArgs, main, notFound, parseArgs, parseArgsWithErrorReporting, println, run, run, s3guardUnsupported, toUri, userAbortedMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
MARKERS
Name of this tool: "markers".- See Also:
-
PURPOSE
Purpose of this tool: "View and manipulate S3 directory markers".- See Also:
-
OPT_AUDIT
Audit sub-command: "audit".- See Also:
-
OPT_CLEAN
Clean Sub-command: "clean".- See Also:
-
AUDIT
Audit sub-command: "-audit".- See Also:
-
CLEAN
Clean Sub-command: "-clean".- See Also:
-
OPT_MIN
Min number of markers to find: "min".- See Also:
-
OPT_MAX
Max number of markers to find: "max".- See Also:
-
OPT_OUT
Name of a file to save the list of markers to: "out".- See Also:
-
OPT_LIMIT
Limit of objects to scan: "limit".- See Also:
-
OPT_NONAUTH
Only consider markers found in non-authoritative paths as failures: "nonauth".- See Also:
-
UNLIMITED_LISTING
public static final int UNLIMITED_LISTINGConstant to use when there is no limit on the number of objects listed: 0.The value is 0 and not -1 because it allows for the limit to be set on the command line
-limit 0. The command line parser rejects-limit -1as the -1 is interpreted as the (unknown) option "-1".- See Also:
-
UNLIMITED_MIN_MARKERS
public static final int UNLIMITED_MIN_MARKERSConstant to use when there is no minimum number of markers: -1.- See Also:
-
-
Constructor Details
-
MarkerTool
public MarkerTool(org.apache.hadoop.conf.Configuration conf) Constructor.- Parameters:
conf- configuration
-
-
Method Details
-
getUsage
- Specified by:
getUsagein classS3GuardTool
-
getName
Description copied from class:S3GuardToolReturn sub-command name.- Specified by:
getNamein classS3GuardTool- Returns:
- sub-command name.
-
resetBindings
public void resetBindings()Description copied from class:S3GuardToolReset the store and filesystem bindings.- Overrides:
resetBindingsin classS3GuardTool
-
run
public int run(String[] args, PrintStream stream) throws org.apache.hadoop.util.ExitUtil.ExitException, Exception Description copied from class:S3GuardToolRun the tool, capturing the output (if the tool supports that). As well as returning an exit code, the implementations can choose to throw an instance ofExitUtil.ExitExceptionwith their exit code set to the desired exit value. The exit code of such an exception is used for the tool's exit code, and the stack trace only logged at debug.- Specified by:
runin classS3GuardTool- Parameters:
args- argument liststream- output stream- Returns:
- the exit code to return.
- Throws:
Exception- on any failureorg.apache.hadoop.util.ExitUtil.ExitException
-
isVerbose
public boolean isVerbose() -
setVerbose
public void setVerbose(boolean verbose) -
execMarkerTool
Execute the marker tool, with no checks on return codes.- Parameters:
scanArgs- set of args for the scanner.- Returns:
- the result
- Throws:
IOException- IO failure
-