public class OrphanFilesClean extends Object
It will ignore exception when listing all files because it's OK to not delete unread files.
To avoid deleting newly written files, it only deletes orphan files older than 1 day by
default. The interval can be modified by olderThan(java.lang.String)
.
To avoid conflicting with snapshot expiration, tag deletion and rollback, it will skip the
snapshot/tag when catching FileNotFoundException
in the process of listing used files.
To avoid deleting files that are used but not read by mistaken, it will stop removing process when failed to read used files.
Constructor and Description |
---|
OrphanFilesClean(FileStoreTable table) |
Modifier and Type | Method and Description |
---|---|
List<Path> |
clean() |
static List<OrphanFilesClean> |
createOrphanFilesCleans(Catalog catalog,
Map<String,String> tableConfig,
String databaseName,
String tableName) |
static String[] |
executeOrphanFilesClean(List<OrphanFilesClean> tableCleans) |
OrphanFilesClean |
fileCleaner(java.util.function.Consumer<Path> fileCleaner) |
OrphanFilesClean |
olderThan(String timestamp) |
static List<String> |
showDeletedFiles(List<Path> deleteFiles,
int showLimit) |
public OrphanFilesClean(FileStoreTable table)
public OrphanFilesClean olderThan(String timestamp)
public OrphanFilesClean fileCleaner(java.util.function.Consumer<Path> fileCleaner)
public List<Path> clean() throws IOException, ExecutionException, InterruptedException
public static List<OrphanFilesClean> createOrphanFilesCleans(Catalog catalog, Map<String,String> tableConfig, String databaseName, @Nullable String tableName) throws Catalog.DatabaseNotExistException, Catalog.TableNotExistException
public static String[] executeOrphanFilesClean(List<OrphanFilesClean> tableCleans)
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.