Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Jan 1, 2024
1 parent c3ff5dd commit 82a970a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions be/src/olap/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,17 +463,18 @@ std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
}
}
}

std::sort(stores.begin(), stores.end(),
[](DataDir* a, DataDir* b) { return a->get_usage(0) < b->get_usage(0); });

size_t seventy_percent_index = stores.size() - 1;
size_t eighty_five_percent_index = stores.size() - 1;
size_t seventy_percent_index = stores.size();
size_t eighty_five_percent_index = stores.size();
for (size_t index = 0; index < stores.size(); index++) {
// If the usage of the store is less than 70%, we choose disk randomly.
if (stores[index]->get_usage(0) > 0.7 && seventy_percent_index == stores.size() - 1) {
if (stores[index]->get_usage(0) > 0.7 && seventy_percent_index == stores.size()) {
seventy_percent_index = index;
}
if (stores[index]->get_usage(0) > 0.85 && eighty_five_percent_index == stores.size() - 1) {
if (stores[index]->get_usage(0) > 0.85 && eighty_five_percent_index == stores.size()) {
eighty_five_percent_index = index;
break;
}
Expand Down

0 comments on commit 82a970a

Please sign in to comment.