This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 7d3e4ebcca [core] Optimize FileDeletionBase.cleanUnusedIndexManifests
to less file io (#5979)
7d3e4ebcca is described below
commit 7d3e4ebcca02204604c93bb27f392a6e1150c5c2
Author: Jingsong Lee <[email protected]>
AuthorDate: Tue Jul 29 19:45:38 2025 +0800
[core] Optimize FileDeletionBase.cleanUnusedIndexManifests to less file io
(#5979)
---
.../org/apache/paimon/operation/FileDeletionBase.java | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/operation/FileDeletionBase.java
b/paimon-core/src/main/java/org/apache/paimon/operation/FileDeletionBase.java
index ac5a56d43a..dae3d5a0f2 100644
---
a/paimon-core/src/main/java/org/apache/paimon/operation/FileDeletionBase.java
+++
b/paimon-core/src/main/java/org/apache/paimon/operation/FileDeletionBase.java
@@ -43,6 +43,7 @@ import org.apache.paimon.utils.SnapshotManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -286,9 +287,15 @@ public abstract class FileDeletionBase<T extends Snapshot>
{
// clean index manifests
String indexManifest = snapshot.indexManifest();
// check exists, it may have been deleted by other snapshots
- if (indexManifest != null &&
indexFileHandler.existsManifest(indexManifest)) {
- List<IndexManifestEntry> indexManifestEntries =
- indexFileHandler.readManifest(indexManifest);
+ if (indexManifest != null) {
+ List<IndexManifestEntry> indexManifestEntries;
+ try {
+ indexManifestEntries =
indexFileHandler.readManifestWithIOException(indexManifest);
+ } catch (FileNotFoundException e) {
+ return;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
indexManifestEntries.removeIf(
entry ->
skippingSet.contains(entry.indexFile().fileName()));
deleteFiles(indexManifestEntries,
indexFileHandler::deleteIndexFile);
@@ -406,11 +413,6 @@ public abstract class FileDeletionBase<T extends Snapshot>
{
return false;
}
- /** Changelogs were not checked. Let the subclass determine whether to
delete them. */
- public Set<String> manifestSkippingSet(Snapshot skippingSnapshot) {
- return
manifestSkippingSet(Collections.singletonList(skippingSnapshot));
- }
-
public Set<String> manifestSkippingSet(List<Snapshot> skippingSnapshots) {
Set<String> skippingSet = new HashSet<>();