Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,10 @@ default RemoveDanglingDeleteFiles removeDanglingDeleteFiles(Table table) {
throw new UnsupportedOperationException(
this.getClass().getName() + " does not implement removeDanglingDeleteFiles");
}

/** Instantiates an action to repair the manifests of a table. */
default RepairManifests repairManifests(Table table) {
throw new UnsupportedOperationException(
this.getClass().getName() + " does not implement repairManifests");
}
}
58 changes: 58 additions & 0 deletions api/src/main/java/org/apache/iceberg/actions/RepairManifests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iceberg.actions;

import org.apache.iceberg.ManifestFile;

/**
* An action that repairs incorrect statistics in the manifests of a table.
*
* <p>Implementations rewrite the manifests of the table, producing a new set of manifests in which
* the statistics of the entries are corrected to match the underlying data and delete files.
*/
public interface RepairManifests extends SnapshotUpdate<RepairManifests, RepairManifests.Result> {

/**
* Repairs incorrect statistics of manifest entries, such as record counts, file sizes and column
* level statistics.
*
* @return this for method chaining
*/
RepairManifests repairEntryStats();

/**
* Determines the repairs that would be performed without actually committing the operation to the
* table.
*
* @return this for method chaining
*/
RepairManifests dryRun();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its inconsistent with remove-orphan-files dryRun but that pattern (supplying a no-op delete) doesnt really apply here. So im ok with an explicit flag.

@dramaticlly dramaticlly Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree that we don't have a catch-all consumer for both incorrect manifest-list or manifest entry, but I still think it would be beneficial to at least know which files are examined with during dry-run. I think it might help the replication to be more resilient if we run this action on both source and target and ensure the result file set are the same.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dramaticlly sorry my comment lacked context, its from my reaidng of #10784 (comment) Whether we need a dryRun or not.

I think we need, even though its the not the same as RemoveOrphanFiles where its on the procedure and not action


/** The action result that contains a summary of the execution. */
interface Result {
/** Returns rewritten manifests. */
Iterable<ManifestFile> rewrittenManifests();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also notice the rest of API says 'repaired'. here it is 'rewritten'. let's make them the same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack


/** Returns the number of manifest entries for which stats were incorrect. */
long entryStatsIncorrectCount();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just have one? Only one count should be populated right (depending on dryRun)?


/** Returns the number of manifest entries for which stats were corrected. */
long entryStatsRepairedCount();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: repairedEntryCount

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will change to just have repairedEntryCount

}
}
Loading