This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 57ff037659f [fix](create tablet) fix disk usage may change when chose 
disks (#30508)
57ff037659f is described below

commit 57ff037659f8b33fb03e6145c5de9d5cd7855877
Author: yujun <yu.jun.re...@gmail.com>
AuthorDate: Tue Jan 30 09:50:41 2024 +0800

    [fix](create tablet) fix disk usage may change when chose disks (#30508)
---
 be/src/olap/storage_engine.cpp | 6 ++++--
 be/src/olap/storage_engine.h   | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp
index 069734d8acd..c02cb48f820 100644
--- a/be/src/olap/storage_engine.cpp
+++ b/be/src/olap/storage_engine.cpp
@@ -478,10 +478,12 @@ void 
StorageEngine::_get_candidate_stores(TStorageMedium::type storage_medium,
             if ((_available_storage_medium_type_count == 1 ||
                  data_dir->storage_medium() == storage_medium) &&
                 !data_dir->reach_capacity_limit(0)) {
+                double usage = data_dir->get_usage(0);
                 DirInfo dir_info;
                 dir_info.data_dir = data_dir;
+                dir_info.usage = usage;
                 dir_info.available_level = 0;
-                usages.push_back(data_dir->get_usage(0));
+                usages.push_back(usage);
                 dir_infos.push_back(dir_info);
             }
         }
@@ -512,7 +514,7 @@ void 
StorageEngine::_get_candidate_stores(TStorageMedium::type storage_medium,
         }
     }
     for (auto& dir_info : dir_infos) {
-        double usage = dir_info.data_dir->get_usage(0);
+        double usage = dir_info.usage;
         for (size_t i = 1; i < level_min_usages.size() && usage >= 
level_min_usages[i]; i++) {
             dir_info.available_level++;
         }
diff --git a/be/src/olap/storage_engine.h b/be/src/olap/storage_engine.h
index bc581aa329a..b8e778ae750 100644
--- a/be/src/olap/storage_engine.h
+++ b/be/src/olap/storage_engine.h
@@ -539,6 +539,7 @@ public:
 struct DirInfo {
     DataDir* data_dir;
 
+    double usage = 0;
     int available_level = 0;
 
     bool operator<(const DirInfo& other) const {


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

Reply via email to