Skip to content

HDDS-15390. Utility to generate dependency ordered snapdiff report.#10778

Draft
SaketaChalamchala wants to merge 2 commits into
apache:masterfrom
SaketaChalamchala:HDDS-15390
Draft

HDDS-15390. Utility to generate dependency ordered snapdiff report.#10778
SaketaChalamchala wants to merge 2 commits into
apache:masterfrom
SaketaChalamchala:HDDS-15390

Conversation

@SaketaChalamchala

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Developed with the help of Cursor AI.

This PR is intended as the foundation for a more efficient snapshot diff (HDDS-9154).

Baseline snapshot diff reports order entries by diff type (DELETEs first, then RENAME/CREATE/MODIFY). That ordering is not always safe to replay. For example, if A/B is renamed to C/B and directory A is deleted, replaying the DELETE before the RENAME fails on because the rename source no longer exists.
This PR adds isolated utilities for dependency-ordered snapshot diff report generation.

SnapDiffDependencyEntry

  • Wraps a classified diff entry with objectId, parentObjectId, and the underlying DiffReportEntry
  • Provides the metadata needed to build hierarchy and path-conflict edges

SnapDiffDependencyGraph

  • Accepts a list of SnapDiffDependencyEntry values and builds a directed dependency graph in the constructor
  • Applies these dependency rules defined via directed edges (u -> v means u must appear before v):
    • Parent CREATE/RENAME/MODIFY before child CREATE/RENAME/MODIFY
    • Child DELETE before parent DELETE
    • Non-delete entry before DELETE of its parent object
    • DELETE before CREATE/RENAME(target) that targets the same path
    • RENAME(source) before CREATE that targets the same path
  • Exposes getOrderedEntries() using Kahn's algorithm
  • Exposes static toOrderedReportEntries() to convert ordered dependency entries into DiffReportEntry payloads

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15390

How was this patch tested?

Unit Test.

@SaketaChalamchala SaketaChalamchala added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-gen snapshot https://issues.apache.org/jira/browse/HDDS-6517

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants