Skip to content

Conversation

@devmadhuu
Copy link
Contributor

What changes were proposed in this pull request?

This PR change is to fix the issue where number of keys showing wrong value when creating dirs and keys inside a FSO bucket using ozone fs -mkdir option.

As per initial analysis, below is the cause of this issue:
The issue was in the  handlePutKeyEvent  method in NSSummaryTaskDbEventHandler.java When a file is created, if its parent directory's NSSummary doesn't exist in the in-memory map or database, the
  code creates a new NSSummary with default values, including parentId = 0. This breaks the propagation chain, preventing key counts from being propagated to ancestor directories and the bucket.

  This can occur when:
  1. Directory creation events and file creation events are processed in different batches
  2. Directory NSSummaries haven't been persisted to the DB when file events arrive
  3. This can happen when directory creation events and file creation events are processed in different batches. Could be because of recent optimizations done at OM for batch processing.

  When the propagation chain is broken (parentId = 0), the propagateSizeUpwards method stops propagating counts upward, resulting in incorrect total key counts at the bucket level.

What is the link to the Apache JIRA

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

How was this patch tested?

Patch is tested using existing junit and integration tests and manually using local docker cluster.
image

@devmadhuu devmadhuu marked this pull request as draft October 28, 2025 07:59
@devmadhuu devmadhuu closed this Oct 28, 2025
@devmadhuu
Copy link
Contributor Author

Found another fix for this issue. Will raise new PR

if (parentDirInfo != null) {
nsSummary.setParentId(parentDirInfo.getParentObjectID());
nsSummary.setDirName(parentDirInfo.getName());
}

Choose a reason for hiding this comment

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

what if parentDirInfo is null? At least it should be logged and treated as metadata consistency issue.

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.

2 participants