Skip to content

Conversation

priyeshkaratha
Copy link
Contributor

@priyeshkaratha priyeshkaratha commented Sep 17, 2025

What changes were proposed in this pull request?

As part of this change, the use of the RocksDB estimateCount API for displaying estimated counts has been removed. Instead iterating over either openKeyTable or openFileTable based on the prefix given and calculate the total count.

What is the link to the Apache JIRA

HDDS-10298

How was this patch tested?

Tested locally using command line.

  sh-5.1$ ozone admin om lof --service-host=om --prefix="vol1/test"
  117 total open files. Showing 100 open files (limit 100) under path prefix:
    vol1/test
  
  Client ID                       Creation time           Hsync'ed        Open File Path
  115218345801613389      2025-09-17T07:00:34.717Z        No              /vol1/test/-9223372036854775296/key_10330
  115218337397080067      2025-09-17T06:58:26.473Z        No              /vol1/test/-9223372036854775296/key_10735
  115218321707171858      2025-09-17T06:54:27.065Z        No              /vol1/test/-9223372036854775296/key_1095

@priyeshkaratha priyeshkaratha marked this pull request as ready for review September 17, 2025 09:31
@priyeshkaratha
Copy link
Contributor Author

@smengcl can you please review the code changes?

@sumitagrawl sumitagrawl self-requested a review September 23, 2025 06:08
Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

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

@priyeshkaratha given some comment

@priyeshkaratha
Copy link
Contributor Author

Thanks @sumitagrawl for the review. Addressed your review comments.

@priyeshkaratha priyeshkaratha changed the title HDDS-10298. Remove estimated count and add option to display real count in opekeys listing. HDDS-10298. Replace estimated count with actual count while listing openkeys. Sep 23, 2025
@smengcl smengcl requested review from smengcl and Copilot October 1, 2025 01:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the estimated count from RocksDB's estimateCount API with an actual count by iterating through the relevant open key tables. The change improves accuracy when listing open files by providing exact counts instead of estimates.

  • Replaced estimated count with actual count calculation for open files listing
  • Refactored the count method to accept bucket layout and prefix parameters for targeted counting
  • Updated CLI output to remove "(est.)" annotation since counts are now accurate

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
OmMetadataManagerImpl.java Replaced estimated count method with actual iteration-based counting
OMMetadataManager.java Removed the public interface for estimated count method
ListOpenFilesSubCommand.java Updated CLI output formatting to reflect accurate counts

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1333 to +1339
try (TableIterator<String, String>
keyValueTableIterator = getOpenKeyTable(bucketLayout).keyIterator(prefix)) {
while (keyValueTableIterator.hasNext()) {
count += 1;
keyValueTableIterator.next();
}
} catch (UncheckedIOException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we measure how fast it can iterate over 10 million open keys?

Copy link
Contributor

@smengcl smengcl left a comment

Choose a reason for hiding this comment

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

lgtm

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.

3 participants