Skip to content

HDDS-15839. Implement SCM container ID export manager - #11097

Merged
ArafatKhan2198 merged 10 commits into
apache:masterfrom
sarvekshayr:container-export-manger
Oct 13, 2026
Merged

ArafatKhan2198 merged 10 commits into
apache:masterfrom
sarvekshayr:container-export-manger

Conversation

@sarvekshayr

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Adds the SCM leader-side container ID export worker. Jobs paginate through ContainerManager.getContainerIDs() with lifecycle/health filters, write sharded text files, and pack them into a gzip-compressed TAR archive (or succeed with zero matches and no archive).

ContainerExportManager.java - Async export worker: submit, paginate, shard, TAR append, job tracking.
ExportJob.java - In-memory job state: Id, execution state, and Status (state, total rows, TAR path, error message).
ExportFileManager.java - Extended with shard write, archive creation, and failed-job cleanup helpers.

What is the link to the Apache JIRA

HDDS-15839

How was this patch tested?

Added a new unit test class TestContainerExportManager.

@sarvekshayr

Copy link
Copy Markdown
Contributor Author

Supersedes #10813.

@sarvekshayr
sarvekshayr requested a review from szetszwo August 24, 2026 03:42

@szetszwo szetszwo 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.

@sarvekshayr , thanks for the update! Please see the comments inlined and also https://issues.apache.org/jira/secure/attachment/13084134/11097_review.patch

@szetszwo szetszwo 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.

@sarvekshayr , thanks for the update! Two quick comments inlined.

@szetszwo szetszwo 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.

@sarvekshayr , thanks for the update! Please see the comments inlined.

@sarvekshayr
sarvekshayr requested a review from szetszwo September 8, 2026 03:55
@sarvekshayr

Copy link
Copy Markdown
Contributor Author

@szetszwo could you please review the PR when you have a moment?

@github-actions github-actions Bot added the scm label Sep 23, 2026

@ArafatKhan2198 ArafatKhan2198 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.

Thanks for working on this, @sarvekshayr!

I’ve left a few comments. Please feel free to close them if they’re already covered or if I’ve missed something.

@ArafatKhan2198 ArafatKhan2198 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.

Thanks for working on this @sarvekshayr
Most of the changes look good.
few final comments -

Comment on lines 165 to 173
for (File part : parts) {
if (!isLeaderReady.getAsBoolean()) {
// close() would publish the partial archive; abort() discards the temp file instead.
atomicOut.abort();
throw new IOException("SCM lost leadership while archiving " + job);
}
Archiver.includeFile(part, part.getName(), tarOut);
}
}

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.

The code checks leadership before copying each file. If leadership changes while the final file is being copied, there is no further check. Closing the streams publishes the archive, and the job reports success.

Fix: Add a final leadership/cancellation check after the loop, before closing publishes the archive. Abort the temporary output if the check fails.

Test improvement: The new test at line 353 supplies () -> false, so it tests rejection before copying begins. Add a one-file test where the first check returns true and subsequent checks return false; expect failure and no archive.

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.

Archiving is the last step of a long-running job. Failing it because leadership flipped in the final few milliseconds throws away a correct archive. Keeping it costs the operator at most one extra archive from the old leader. The contents may be slightly stale, which the class javadoc already says (best-effort, not point-in-time).

@ArafatKhan2198
ArafatKhan2198 self-requested a review October 12, 2026 06:09

@ArafatKhan2198 ArafatKhan2198 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.

Thanks for working on this @sarvekshayr
LGTM +1

@ArafatKhan2198

Copy link
Copy Markdown
Contributor

@szetszwo any comments from your end?

@ArafatKhan2198
ArafatKhan2198 merged commit 734435a into apache:master Oct 13, 2026
55 checks passed
@sarvekshayr

Copy link
Copy Markdown
Contributor Author

Thanks @szetszwo and @ArafatKhan2198 for the review.

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