adoroszlai commented on code in PR #8069:
URL: https://github.com/apache/ozone/pull/8069#discussion_r1995504187
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java:
##########
@@ -456,6 +456,27 @@ public long getEstimatedKeyCount() throws IOException {
return rawTable.getEstimatedKeyCount();
}
+ /**
+ * Returns the exact key count of column family.
+ *
+ * @return keyCount
+ * @throws IOException
+ */
+ @Override
+ public long getExactKeyCount() throws IOException {
+ if (cache.getCacheType() == CacheType.FULL_CACHE) {
+ return cache.size();
+ }
+ try (TableIterator<byte[], KeyValue<byte[], byte[]>> iterator
+ = rawTable.iterator()) {
+ int keyCount = 0;
+ for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) {
+ keyCount++;
+ }
+ return keyCount;
+ }
Review Comment:
Please move this to `RDBTable.getExactKeyCount()`, of course omitting
`rawTable`, and replace this code in `TypedTable` with:
```suggestion
return rawTable.getExactKeyCount();
```
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java:
##########
@@ -456,6 +456,27 @@ public long getEstimatedKeyCount() throws IOException {
return rawTable.getEstimatedKeyCount();
}
+ /**
+ * Returns the exact key count of column family.
+ *
+ * @return keyCount
+ * @throws IOException
+ */
Review Comment:
No need to duplicate doc in implementation.
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]