Interface DeleteOrphanFiles
-
- All Superinterfaces:
Action<DeleteOrphanFiles,DeleteOrphanFiles.Result>
- All Known Implementing Classes:
BaseDeleteOrphanFilesSparkAction
public interface DeleteOrphanFiles extends Action<DeleteOrphanFiles,DeleteOrphanFiles.Result>
An action that deletes orphan files in a table.A metadata or data file is considered orphan if it is not reachable by any valid snapshot. The set of actual files is built by listing the underlying storage which makes this operation expensive.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DeleteOrphanFiles.Result
The action result that contains a summary of the execution.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DeleteOrphanFiles
deleteWith(java.util.function.Consumer<java.lang.String> deleteFunc)
Passes an alternative delete implementation that will be used for orphan files.DeleteOrphanFiles
executeDeleteWith(java.util.concurrent.ExecutorService executorService)
Passes an alternative executor service that will be used for removing orphaned files.DeleteOrphanFiles
location(java.lang.String location)
Passes a location which should be scanned for orphan files.DeleteOrphanFiles
olderThan(long olderThanTimestamp)
Removes orphan files only if they are older than the given timestamp.
-
-
-
Method Detail
-
location
DeleteOrphanFiles location(java.lang.String location)
Passes a location which should be scanned for orphan files.If not set, the root table location will be scanned potentially removing both orphan data and metadata files.
- Parameters:
location
- the location where to look for orphan files- Returns:
- this for method chaining
-
olderThan
DeleteOrphanFiles olderThan(long olderThanTimestamp)
Removes orphan files only if they are older than the given timestamp.This is a safety measure to avoid removing files that are being added to the table. For example, there may be a concurrent operation adding new files while this action searches for orphan files. New files may not be referenced by the metadata yet but they are not orphan.
If not set, defaults to a timestamp 3 days ago.
- Parameters:
olderThanTimestamp
- a long timestamp, as returned bySystem.currentTimeMillis()
- Returns:
- this for method chaining
-
deleteWith
DeleteOrphanFiles deleteWith(java.util.function.Consumer<java.lang.String> deleteFunc)
Passes an alternative delete implementation that will be used for orphan files.This method allows users to customize the delete func. For example, one may set a custom delete func and collect all orphan files into a set instead of physically removing them.
If not set, defaults to using the table's
io
implementation.- Parameters:
deleteFunc
- a function that will be called to delete files- Returns:
- this for method chaining
-
executeDeleteWith
DeleteOrphanFiles executeDeleteWith(java.util.concurrent.ExecutorService executorService)
Passes an alternative executor service that will be used for removing orphaned files.If this method is not called, orphaned manifests and data files will still be deleted in the current thread.
- Parameters:
executorService
- the service to use- Returns:
- this for method chaining
-
-