Skip to content

Conversation

@smengcl
Copy link
Contributor

@smengcl smengcl commented Aug 11, 2023

What changes were proposed in this pull request?

A snapshot's referenced size after replication is identical to the bucket's point-in-time omBucketInfo.getUsedBytes().

Note Ozone currently only have the bucket size AFTER replication stored for quota counting. The referenced size before replication is an estimate, in order to keep create snapshot operation O(1).

  • Snapshot referenced size is stored directly into SnapshotInfoTable during snapshot creation so as to avoid opening every single snapshot under a bucket just to display the size. (Later we need an admin command or upgrade mechanism in OM to populate the referencedSize field for older clusters.)
  • Referenced size can now be shown under fs -ls (it was always 0 before this change):
bash-4.2$ ozone fs -mkdir -p ofs://om/vol1/buck2/dir3/subdir4/
bash-4.2$ ozone fs -put README.md ofs://om/vol1/buck2/dir3/subdir4/
bash-4.2$ ozone fs -createSnapshot ofs://om/vol1/buck2/ snap1
Created snapshot ofs://om/vol1/buck2/.snapshot/snap1
bash-4.2$ ozone fs -ls ofs://om/vol1/buck2/.snapshot/
Found 1 items
drwxrwxrwx   - hadoop hadoop       4068 2023-08-11 07:30 ofs://om/vol1/buck2/.snapshot/snap1
bash-4.2$
  • referencedSize also shown with ozone sh snapshot ls /vol1/buck2:
bash-4.2$ ozone sh snapshot ls /vol1/buck2
[ {
  "volumeName" : "vol1",
  "bucketName" : "buck2",
  "name" : "snap1",
  "creationTime" : 1691778428556,
  "snapshotStatus" : "SNAPSHOT_ACTIVE",
  "snapshotId" : "6a3c9f54-1e7b-4516-bf8d-44cbe3309312",
  "snapshotPath" : "vol1/buck2",
  "checkpointDir" : "-6a3c9f54-1e7b-4516-bf8d-44cbe3309312",
  "referencedSize" : 4068
} ]

What is the link to the Apache JIRA

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

How was this patch tested?

  • Tested manually in Docker compose cluster.
  • Tested via testFsLsSnapshot.

@smengcl smengcl added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Aug 11, 2023
@umamaheswararao
Copy link
Contributor

@swamirishi @hemantk-12 one of you take a look at it?

Copy link
Contributor

@hemantk-12 hemantk-12 left a comment

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

Overall looks good to me. Left some minor comments.

Copy link
Contributor

@hemantk-12 hemantk-12 left a comment

Choose a reason for hiding this comment

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

LGTM

@smengcl smengcl requested a review from aswinshakil August 15, 2023 22:12
@smengcl smengcl requested a review from prashantpogde August 17, 2023 01:22
Copy link
Contributor

@swamirishi swamirishi left a comment

Choose a reason for hiding this comment

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

Thanks @smengcl for the patch.
nit: An assert statement should also be created in TestOMSnapshotCreateRequest#testValidateAndUpdateCache & TestOmSnapshotCreateResponse#testAddToDBBatch. Otherwise the patch looks good to me

@smengcl
Copy link
Contributor Author

smengcl commented Aug 17, 2023

Thanks @smengcl for the patch. nit: An assert statement should also be created in TestOMSnapshotCreateRequest#testValidateAndUpdateCache & TestOmSnapshotCreateResponse#testAddToDBBatch. Otherwise the patch looks good to me

Added in TestOMSnapshotCreateRequest.

It is not making much sense to add the check in TestOmSnapshotCreateResponse since it does not concern the Request change in this PR. testAddToDBBatch is crafting its own OMSnapshotCreateResponse object just to test addToDBBatch and does not go through validateAndUpdateCache at all.

Conflicts:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java
@smengcl smengcl force-pushed the HDDS-9159-snap-du-ref branch from 6323285 to 881c0ea Compare August 29, 2023 18:26
Copy link
Contributor

@hemantk-12 hemantk-12 left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@aswinshakil aswinshakil left a comment

Choose a reason for hiding this comment

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

Thanks for the patch @smengcl, The changes look good to me. I have only a few minor comments. Otherwise LGTM! 👍

Copy link
Member

@aswinshakil aswinshakil left a comment

Choose a reason for hiding this comment

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

LGTM. Pending CI

@smengcl smengcl force-pushed the HDDS-9159-snap-du-ref branch from bfa7681 to 72c297d Compare September 1, 2023 23:19
@smengcl smengcl merged commit a3b89e7 into apache:master Sep 2, 2023
@smengcl
Copy link
Contributor Author

smengcl commented Sep 2, 2023

Thanks @hemantk-12 @swamirishi @aswinshakil for reviewing this.

swamirishi pushed a commit to swamirishi/ozone that referenced this pull request Dec 3, 2025
…renced size (apache#5175)

Change-Id: I9c9c0cdca4280fc7a7f447af46c33b5f78222fe5
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.

5 participants