You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/12/22 12:48:14 UTC

[GitHub] [hbase] 2005hithlj commented on a diff in pull request #4891: HBASE-27483 Expose table and region storefiles accessed days and size to the metrics

2005hithlj commented on code in PR #4891:
URL: https://github.com/apache/hbase/pull/4891#discussion_r1055424594


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java:
##########
@@ -1780,6 +1781,29 @@ public OptionalDouble getAvgStoreFileAge() {
     return getStoreFileAgeStream().average();
   }
 
+  @Override
+  public Map<String, Pair<Long, Long>> getStoreFilesAccessTimeAndSize() {
+    Collection<HStoreFile> storeFiles = this.storeEngine.getStoreFileManager().getStorefiles();
+    Map<String, Pair<Long, Long>> sfAccessTimeAndSizeMap = new HashMap<>();
+    for (HStoreFile sf : storeFiles) {
+      if (sf.getReader() == null) {
+        continue;
+      }
+      FileStatus fileStatus;
+      try {
+        fileStatus = sf.getFileInfo().getFileStatus();

Review Comment:
   > If this FileStatus is cached, then the accessTime will not be updated?
   
   @Apache9 sir. Thanks for your review. 
   Yes, if FileStatus is cached, the accessTime will not be updated, but the current logic is got from the back-end file system in real time.



-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org