Skip to content

HDDS-13664. Persist pendingDeleteBytes only when feature is finalized#9036

Merged
ChenSammi merged 8 commits intoapache:HDDS-13177from
priyeshkaratha:HDDS-13664
Oct 16, 2025
Merged

HDDS-13664. Persist pendingDeleteBytes only when feature is finalized#9036
ChenSammi merged 8 commits intoapache:HDDS-13177from
priyeshkaratha:HDDS-13664

Conversation

@priyeshkaratha
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR introduces refactors the pending deletion metadata handling logic and comprehensive integration testing for the DataNode data distribution feature upgrade scenario.
The changes include:

  1. Code Refactoring: Refactored to improve the pending deletion metadata handling: KeyValueContainerUtil.java
    • Extracted populatePendingDeletionMetadata() method for better separation of concerns
    • Added separate handler methods for different upgrade states
    • Enhanced the conditional logic to properly handle DATA_DISTRIBUTION feature finalization
    • Improved code readability and maintainability
  2. Integration Test Addition: Created with comprehensive test coverage for the DN data distribution upgrade scenario, specifically validating: TestDNDataDistributionFinalization.java
    • Pre-finalization behavior (handlePreDataDistributionFeature path)
    • Post-finalization behavior (handlePostDataDistributionFeature path)
    • Missing metadata recalculation scenario (getAggregatePendingDelete path)

What is the link to the Apache JIRA

HDDS-13664

How was this patch tested?

Tested using integration added integration tests.

@priyeshkaratha
Copy link
Copy Markdown
Contributor Author

@ChenSammi @sumitagrawl Can you please review the changes?

@errose28
Copy link
Copy Markdown
Contributor

Why does the title of this PR refer to datanode upgrade finalization but the code changes do not add a datanode layout feature?

@priyeshkaratha priyeshkaratha changed the title HDDS-13664. DN data distribution upgrade finalisation. HDDS-13664. Handle metadata read while restarting considering feature finalization. Sep 16, 2025
@priyeshkaratha
Copy link
Copy Markdown
Contributor Author

Why does the title of this PR refer to datanode upgrade finalization but the code changes do not add a datanode layout feature?

updated the title. There is no upgrade actions.

@priyeshkaratha priyeshkaratha marked this pull request as ready for review September 30, 2025 06:25
@errose28
Copy link
Copy Markdown
Contributor

I see the layout feature was added earlier in the feature branch. Please update the design doc with information why a layout feature is required for this. From what I can tell we are only adding new information, which does not usually require layout features.

@priyeshkaratha
Copy link
Copy Markdown
Contributor Author

Thank you @ChenSammi for the review and I have addressed all your comments in latest commit.

@ChenSammi ChenSammi changed the title HDDS-13664. Handle metadata read while restarting considering feature finalization. HDDS-13664. Persist pendingDeleteBytes only when feature is finalized Oct 16, 2025
@@ -645,12 +647,17 @@ private void updateMetaData(KeyValueContainerData containerData,

// update pending deletion blocks count and delete transaction ID in
// in-memory container status
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.

Can you refactor these two lines of comments to make it correct?

Copy link
Copy Markdown
Contributor

@ChenSammi ChenSammi Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyeshkaratha , there is one more place that pendingDeleteBytes is persisted without check the feature finalized or not, KeyValueContainerMetadataInspector#checkAndRepair. We can skip the pendingDeleteBytes check and repair if feature is not finalized.

Please also check and run the fail test locally to see if it's related.

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.

Handled checkAndRepair. Validated failed testcase locally and it is passing.

@ChenSammi
Copy link
Copy Markdown
Contributor

Thanks @priyeshkaratha.

@ChenSammi ChenSammi merged commit 929f7bb into apache:HDDS-13177 Oct 16, 2025
54 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants