Skip to content

HDDS-17238. Initialize refCount and usedNamespace on volume create - #11720

Merged
adoroszlai merged 3 commits into
apache:masterfrom
rjgoyln:HDDS-17238
Oct 24, 2026
Merged

adoroszlai merged 3 commits into
apache:masterfrom
rjgoyln:HDDS-17238

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

OM maintains a volume's refCount and usedNamespace, but volume create stored whatever the request's VolumeInfo carried, and nothing recomputes them later. The Ozone client and ozone sh send 0, but a request from any other client can leave:

  • an empty volume that cannot be deleted (VOLUME_IS_REFERENCED), from a non-zero refCount;
  • an empty volume that rejects its first bucket (QUOTA_EXCEEDED), from usedNamespace at quotaInNamespace.

Clearing both in preExecute puts 0 into the Ratis log, so the apply step is unchanged and OMs on old and new versions agree during an upgrade. This is the fix proposed in the JIRA patch.

What is the link to the Apache JIRA?

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

How was this patch tested?

  • The new TestOMVolumeCreateRequest case fails on master, and again with only clearRefCount() applied, so it covers both counters.
  • Volume, tenant create/delete and bucket create suites pass (95 tests).

Generated-by: Claude Code (Opus 5.5)

OM maintains both counters, but volume create stored whatever the request's VolumeInfo carried, so a request with a non-zero refCount left an empty volume that cannot be deleted, and one with usedNamespace at the namespace quota rejected the volume's first bucket. Clearing them in preExecute puts 0 into the Ratis log, so replay of entries written by older OMs is unchanged.
Review pass against AGENTS.md: lines that fit in 120 characters stay on one line, the existing timestamp comment is left as it was, and the test variable is named for the builder it holds.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 16:45

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 was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions github-actions Bot added the om label Oct 23, 2026
@smengcl
smengcl marked this pull request as ready for review October 24, 2026 05:46

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

+1

@rjgoyln

rjgoyln commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the @smengcl review!

@peterxcli peterxcli left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should say why in the comment why the reset is needed, because in normal case, they should just be 0

@peterxcli peterxcli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

other lgtm!

@adoroszlai
adoroszlai merged commit d5397d6 into apache:master Oct 24, 2026
56 checks passed
@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks @rjgoyln for the patch, @peterxcli, @smengcl for the review.

errose28 added a commit to errose28/ozone that referenced this pull request Oct 27, 2026
* master: (114 commits)
  HDDS-17411. Show one initialization notice on the Namespace Usage page (apache#11737)
  HDDS-17375. Create new submodule ozone-integration-test-tools (apache#11754)
  HDDS-17452. Introduce ClientProtocol delegation for S3 Gateway (apache#11757)
  HDDS-16661. Validate unsigned S3 checksum trailer completion and framing (apache#11586)
  HDDS-17450. Speed up TestDirectoryDeletingService (apache#11765)
  HDDS-17308. ListObjectsV2 Incorrectly Filters CommonPrefixes When StartAfter Is Before the Matching Prefixes (apache#11715).
  Clamp Echo sleep time and response payload size. (apache#44)
  HDDS-17433. Add a freon command for positioned reads on shared input streams (apache#11741)
  HDDS-17239. Initialize usage counters on bucket create (apache#11742)
  HDDS-17357. Initialize Netty in background when Ozone client is created (apache#11726)
  HDDS-17426. Disable ozone.tracing.client.application-aware in acceptance tests (apache#11758)
  HDDS-16737. Share OM follower read logic between the Hadoop RPC and gRPC clients (apache#11418)
  HDDS-17446. Copy datanode container set in NodeStateMap.updateNode only once (apache#11746)
  HDDS-17454. Bump asm to 9.11.1 (apache#11750)
  HDDS-17453. Bump jackson to 2.21.8 (apache#11749)
  HDDS-17376. Scale repeated-defrag footprint tolerance with the number of OM tables (apache#11708)
  HDDS-17380. Fix deadlock when BackgroundContainerDataScanner shutdown during volume failure (apache#11729)
  HDDS-17251. List open multipart uploads in ListOpenFiles (apache#11739)
  HDDS-17361. S3 Gateway can set another user as the owner of a new key (apache#11707)
  HDDS-17238. Initialize refCount and usedNamespace on volume create (apache#11720)
  ...
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.

5 participants