yangzhg commented on a change in pull request #6247:
URL: https://github.com/apache/incubator-doris/pull/6247#discussion_r670190756



##########
File path: be/src/olap/storage_engine.cpp
##########
@@ -377,6 +377,20 @@ OLAPStatus 
StorageEngine::get_all_data_dir_info(vector<DataDirInfo>* data_dir_in
     return res;
 }
 
+int64_t StorageEngine::get_file_or_directory_size(std::filesystem::path 
file_path) {
+    if (!std::filesystem::exists(file_path)) {
+        return 0;
+    }
+    if (!std::filesystem::is_directory(file_path)) {
+        return std::filesystem::file_size(file_path);
+    }
+    int64_t sum_size = 0;
+    for (auto& it : std::filesystem::directory_iterator(file_path)) {

Review comment:
       ```suggestion
       for (const auto& it : std::filesystem::directory_iterator(file_path)) {
   ```




-- 
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: commits-unsubscr...@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to