Skip to content

HDDS-14467. Expose pending delete bytes/namespace in OzoneBucket.#9708

Open
sadanand48 wants to merge 3 commits intoapache:masterfrom
sadanand48:HDDS-14467
Open

HDDS-14467. Expose pending delete bytes/namespace in OzoneBucket.#9708
sadanand48 wants to merge 3 commits intoapache:masterfrom
sadanand48:HDDS-14467

Conversation

@sadanand48
Copy link
Contributor

@sadanand48 sadanand48 commented Feb 4, 2026

What changes were proposed in this pull request?

After HDDS-13756, OzoneBucket.usedBytes is populated from OmBucketInfo.getTotalBucketSpace() (used + snapshotUsed bytes), which makes bucket usage ambiguous after key deletion. This change adds explicit pendingDeleteBytes / pendingDeleteNamespace fields to OzoneBucket to clarify retained bytes (snapshots or pending delete).

What is the link to the Apache JIRA

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

How was this patch tested?

Unit tests

@sadanand48 sadanand48 requested review from smengcl February 4, 2026 10:07
@jojochuang jojochuang added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Feb 5, 2026
Comment on lines 1302 to 1336
@@ -1330,6 +1332,8 @@ public List<OzoneBucket> listBuckets(String volumeName, String bucketPrefix,
.setSourceBucket(bucket.getSourceBucket())
.setUsedBytes(bucket.getTotalBucketSpace())
.setUsedNamespace(bucket.getTotalBucketNamespace())
.setPendingDeleteBytes(bucket.getSnapshotUsedBytes())
.setPendingDeleteNamespace(bucket.getSnapshotUsedNamespace())
Copy link
Contributor

@smengcl smengcl Feb 5, 2026

Choose a reason for hiding this comment

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

Thanks @sadanand48 for the patch.

Let's document the behavior of PendingDeleteBytes / PendingDeleteNamespace (e.g. not accounting for keys that are not recursed yet).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sadanand48
Copy link
Contributor Author

@jojochuang @smengcl FYI.
For recursive deletes in FSO buckets, pendingDeleteBytes / snapshotUsedBytes are not updated when the directory is deleted. They are updated only when DirectoryDeletingService moves subfiles into the deleted table via PurgeDirectoriesRequest (handled by OMDirectoriesPurgeRequestWithFSO), which calls decrUsedBytes(..., true) and increments snapshotUsedBytes.

I think this should be okay as even today the updates to usedBytes and usedNamespace happens in the same way.

Exposing snapshotUsedBytes might still be useful when snapshot lifespan is significant, as it helps users understand quota usage and why space is not reclaimed after deletes.

@sadanand48 sadanand48 marked this pull request as ready for review February 17, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snapshot https://issues.apache.org/jira/browse/HDDS-6517

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants