Skip to content

HDDS-15860. Always rewrite live SSTs before snapshot defrag ingestion#10772

Draft
smengcl wants to merge 3 commits into
apache:masterfrom
smengcl:HDDS-15860-ingest
Draft

HDDS-15860. Always rewrite live SSTs before snapshot defrag ingestion#10772
smengcl wants to merge 3 commits into
apache:masterfrom
smengcl:HDDS-15860-ingest

Conversation

@smengcl

@smengcl smengcl commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Codex (GPT-5.6 Sol)

What changes were proposed in this pull request?

Incremental snapshot defragmentation directly ingested a candidate SST when a table had exactly one delta file and the snapshot version was greater than zero.

These candidate files are live RocksDB SSTs selected at file granularity, not external SSTs containing an exact logical bucket delta. A DB-generated SST is rejected by external-file ingestion, while a previously ingested live SST may be accepted but apply the wrong value. Direct ingestion also bypasses bucket-prefix filtering, snapshot value comparison, and tombstone generation.

This change removes the single-file shortcut. All candidate SST sets now pass through spillTableDiffIntoSstFile, which constructs a fresh external SST containing the logical differences between the current and previous snapshots.

The existing incremental-defragmentation test is updated to expect rewriting regardless of snapshot version or candidate-file count. A new real-RocksDB regression test covers both DB-generated SSTs and SSTs previously ingested into a live database.

What is the link to the Apache JIRA

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

How was this patch tested?

Before the production change, the new regression reproduced both failure modes:

  • A DB-generated SST failed with External file version not found.
  • A previously ingested SST applied its stored value instead of the current snapshot value.

After the change:

  • TestSnapshotDefragService: 23 tests passed.
  • ./hadoop-ozone/dev-support/checks/checkstyle.sh: passed across all 59 modules.
  • The ozone-manager module and its dependencies compiled successfully.

Copilot AI review requested due to automatic review settings July 15, 2026 03:48
@smengcl smengcl added bug Something isn't working snapshot https://issues.apache.org/jira/browse/HDDS-6517 labels Jul 15, 2026
@smengcl
smengcl requested a review from jojochuang July 15, 2026 03:48

Copilot AI left a comment

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.

Pull request overview

This PR fixes incremental snapshot defragmentation behavior in Ozone Manager by removing the “single delta file + version > 0” fast path that directly ingested candidate SSTs. Instead, it always rewrites candidate SST sets into a freshly generated external SST containing the logical delta (including prefix filtering, snapshot value comparison, and tombstones) before ingestion into the checkpoint DB.

Changes:

  • Removed the single-file direct-ingestion shortcut in performIncrementalDefragmentation, always routing through spillTableDiffIntoSstFile.
  • Updated the existing incremental-defrag unit test expectations to require rewriting regardless of snapshot version / delta-file count.
  • Added a new parameterized regression-style test to cover “live SST” ingestion scenarios (DB-generated vs previously-ingested SST candidates).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/defrag/SnapshotDefragService.java Removes direct ingestion of single delta-file candidates; always rebuilds a logical external SST delta before ingestion.
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/defrag/TestSnapshotDefragService.java Updates expectations to always rewrite and adds a new regression test for single-live-SST candidate handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings July 15, 2026 03:55

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 15, 2026 04:09

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@jojochuang
jojochuang requested a review from sadanand48 July 16, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working snapshot https://issues.apache.org/jira/browse/HDDS-6517

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants