Skip to content

Commit

Permalink
[fix](create tablet) fix disk usage may change when chose disks (#30508)
Browse files Browse the repository at this point in the history
  • Loading branch information
yujun777 authored Jan 30, 2024
1 parent 6f30b96 commit 57ff037
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions be/src/olap/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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++;
}
Expand Down
1 change: 1 addition & 0 deletions be/src/olap/storage_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ class CreateTabletIdxCache : public LRUCachePolicy {
struct DirInfo {
DataDir* data_dir;

double usage = 0;
int available_level = 0;

bool operator<(const DirInfo& other) const {
Expand Down

0 comments on commit 57ff037

Please sign in to comment.