Skip to content

API: Define RepairManifests action interface - #17399

Open
rahulsmahadev wants to merge 2 commits into
apache:mainfrom
rahulsmahadev:repair-manifests-api
Open

API: Define RepairManifests action interface#17399
rahulsmahadev wants to merge 2 commits into
apache:mainfrom
rahulsmahadev:repair-manifests-api

Conversation

@rahulsmahadev

@rahulsmahadev rahulsmahadev commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Reviving #10784 by @amogh-jahagirdar (co-authored with @tabmatfournier). See #10445 for motivation. Scoped down to just repairing stats for now

Problem: manifest entry stats can disagree with the files they describe — record_count, file_size_in_bytes, column bounds and null counts written wrong by a non-reference writer. Data files are fine, only the metadata is wrong, so you get bad pruning or read failures on wrong sizes. RewriteManifests doesn't help, it carries over whatever entries it finds. Finding the bad entries means stat-ing or reading the footer of every file in a live manifest entry, so this needs to be a distributed action.

This defines the action interface only. Spark implementation and procedure to follow.

amogh-jahagirdar and others added 2 commits July 25, 2024 11:45
Co-authored-by: Mathew Fournier <160646114+tabmatfournier@users.noreply.github.com>
(cherry picked from commit eb2041b)
Narrows the RepairManifests action interface to its first-cut scope:
repairing incorrect manifest entry statistics, with a dry-run option.

- Drop repairFileEntries() and the duplicate/missing-file Result methods.
  Removing duplicate entries and dropping entries for missing files changes
  the logical contents of the table (rows deleted or, for delete files,
  resurrected) and warrants its own design; it can be added back as a
  follow-up once those semantics are settled.
- Repairing entry stats leaves table contents unchanged and preserves the
  live file count, so it is a self-contained first step.
- Tighten the javadoc: describe what each method does and add @return tags
  and the missing periods.
@github-actions github-actions Bot added the API label Jul 28, 2026
*
* @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

Iterable<ManifestFile> rewrittenManifests();

/** 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)?

long entryStatsIncorrectCount();

/** 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

/** 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants