Skip to content

HDDS-15991. Speed up deleted table scans in quota repair - #11386

Open
chihsuan wants to merge 6 commits into
apache:masterfrom
chihsuan:HDDS-15991
Open

chihsuan wants to merge 6 commits into
apache:masterfrom
chihsuan:HDDS-15991

Conversation

@chihsuan

@chihsuan chihsuan commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed?

Speed up quota repair after large deletes by:

  • Decoding active deletedTable values in parallel using the existing batch workers. Snapshot deletedTable scans remain unchanged.
  • Reading only keys from deletedDirectoryTable, avoiding unused value decoding. Corrupt values in this table no longer cause repair to fail.

JIRA

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

How was this patch tested?

Added tests in TestQuotaRepairTask.

Local benchmark with 1M synthetic rows on a MacBook with a warm cache:

  • deletedTable 1.9s → 1.0s.
  • deletedDirectoryTable 0.63s → 0.21s.

Generated-by: Claude Code (Claude Opus 5.5)

Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:39
@github-actions github-actions Bot added the om label Oct 2, 2026
@chihsuan chihsuan changed the title HDDS-15991. Decode deletedTable rows on worker threads in quota repair HDDS-15991. Speed up deleted table scans in quota repair Oct 2, 2026
@chihsuan
chihsuan marked this pull request as ready for review October 2, 2026 15:47

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.

Copilot review overview

🟡 Changes recommended

The corrupt deleted-directory value behavior needs direct regression coverage.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Speeds up OM quota repair scans after large deletions.

Changes:

  • Parallelizes active deletedTable value decoding.
  • Uses key-only deleted-directory scans.
  • Adds quota-repair regression tests.
File Description
QuotaRepairTask.java Optimizes deleted-table scans.
TestQuotaRepairTask.java Tests batching, accounting, and decode failures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Copilot review overview

🟢 Approval recommended

The optimization preserves quota semantics and includes focused regression coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@chihsuan

chihsuan commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

cc @chungen0126 🙏

// a typed iterator decodes on this thread, so keep values raw and let the workers decode
try (Table.KeyValueIterator<String, byte[]> keyIter = metadataManager.getStore()
.getTable(OMDBDefinition.DELETED_TABLE, StringCodec.get(), ByteArrayCodec.get(), CacheType.NO_CACHE)
.iterator()) {

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.

nit: please use .iterator(null, VALUE_ONLY) here, with the corresponding static import. The consumer only reads kv.getValue(), so we can avoid copying and decoding unused keys.

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.

Thanks, good point! Switched to VALUE_ONLY in d95fcef.

@rich7420

rich7420 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

overall LGTM

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.

3 participants