Skip to content

HDDS-14996. Add metrics to track Snapshot backup SST file stats.#10065

Draft
jojochuang wants to merge 4 commits intoapache:masterfrom
jojochuang:HDDS-14996
Draft

HDDS-14996. Add metrics to track Snapshot backup SST file stats.#10065
jojochuang wants to merge 4 commits intoapache:masterfrom
jojochuang:HDDS-14996

Conversation

@jojochuang
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

HDDS-14996. Add metrics to track Snapshot backup SST file stats.

Please describe your PR in detail:

  • Added SstBackupDirSize and SstBackupSstFilesCount metrics to OMSnapshotDirectoryMetrics to track disk space usage and file counts for the backup SST
    directory.
  • Refactored calculation logic into a reusable calculateDirSize helper that handles both snapshots and backup SST directories while maintaining
    inode-based deduplication for hard-linked files.
  • Initialized metrics in the constructor to ensure reliability and avoid NullPointerException during testing.
  • Added TestOMSnapshotDirectoryMetrics.java to verify the new metrics and ensured Java 8 compatibility.

What is the link to the Apache JIRA

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

How was this patch tested?

New unit tests

Change-Id: Ib531e9a99d2e98a2e7b2a8ec4e39a3c36cd9aaa0
@jojochuang jojochuang requested a review from sadanand48 April 10, 2026 06:56
@jojochuang jojochuang added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Apr 10, 2026
Change-Id: I0c50b044a6d44ea9d4eb0f96e4202d76998c9b41
…Metrics.

Change-Id: I162534c354312e0c33ee7fc4cabb646ac48780c8
assertEquals(2, metrics.getNumSnapshots());
// Total SST count should still be 1 if hardlink is counted once,
// but the implementation uses visitedInodes per snapshot directory?
// Wait, let's check the implementation again.
Copy link
Copy Markdown
Contributor

@sadanand48 sadanand48 Apr 10, 2026

Choose a reason for hiding this comment

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

yes this is fixed now with a global hashset instead of at per snapshot dir. Thanks for the fixing. The comments may not be needed

@@ -132,54 +152,93 @@ protected boolean updateMetrics() {
*
* @param directory the directory containing all checkpointDirs.
Copy link
Copy Markdown
Contributor

@sadanand48 sadanand48 Apr 10, 2026

Choose a reason for hiding this comment

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

Suggested change
* @param directory the directory containing all checkpointDirs.
* @param snapshotsDir the directory containing all checkpointDirs.
* @param sstBackupDir the backup SST directory

Change-Id: I5b70076aa2549f9c2839acf873b8e316c1e85325
@jojochuang jojochuang requested a review from sadanand48 April 11, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants