mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
db/hints: Rename rebalance to rebalance_hints
The new name conveys the idea clearly.
This commit is contained in:
committed by
Dawid Medrek
parent
64f4b825d3
commit
aba85c9c98
@@ -260,16 +260,16 @@ future<> remove_irrelevant_shards_directories(const fs::path& hint_directory) {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
future<> rebalance(fs::path hints_directory) {
|
||||
future<> rebalance_hints(fs::path hint_directory) {
|
||||
// Scan currently present hint segments.
|
||||
hints_segments_map current_hints_segments = co_await get_current_hints_segments(hints_directory);
|
||||
hints_segments_map current_hints_segments = co_await get_current_hints_segments(hint_directory);
|
||||
|
||||
// Move segments to achieve an even distribution of files among all present shards.
|
||||
co_await rebalance_segments(hints_directory, current_hints_segments);
|
||||
co_await rebalance_segments(hint_directory, current_hints_segments);
|
||||
|
||||
// Remove the directories of shards that are not present anymore.
|
||||
// They should not have any segments by now.
|
||||
co_await remove_irrelevant_shards_directories(hints_directory);
|
||||
co_await remove_irrelevant_shards_directories(hint_directory);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
@@ -32,18 +32,19 @@ using hint_entry_reader = commitlog_entry_reader;
|
||||
|
||||
/// \brief Rebalance hints segments among all present shards.
|
||||
///
|
||||
/// The difference between the number of segments on every two shard will be not greater than 1 after the
|
||||
/// rebalancing.
|
||||
/// The difference between the number of segments on every two shard will not be
|
||||
/// greater than 1 after the rebalancing.
|
||||
///
|
||||
/// Removes the sub-directories of \ref hints_directory that correspond to shards that are not relevant any more
|
||||
/// (re-sharding to a lower shards number case).
|
||||
/// Removes the subdirectories of \ref hint_directory that correspond to shards that
|
||||
/// are not relevant anymore (in the case of re-sharding to a lower shard number).
|
||||
///
|
||||
/// Complexity: O(N+K), where N is a total number of present hints' segments and
|
||||
/// K = <number of shards during the previous boot> * <number of end points for which hints where ever created>
|
||||
/// Complexity: O(N+K), where N is a total number of present hint segments and
|
||||
/// K = <number of shards during the previous boot> * <number of endpoints
|
||||
/// for which hints where ever created>
|
||||
///
|
||||
/// \param hints_directory A hints directory to rebalance
|
||||
/// \param hint_directory A hint directory to rebalance
|
||||
/// \return A future that resolves when the operation is complete.
|
||||
future<> rebalance(std::filesystem::path hints_directory);
|
||||
future<> rebalance_hints(std::filesystem::path hint_directory);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace db::hints
|
||||
|
||||
@@ -452,7 +452,7 @@ public:
|
||||
|
||||
return with_semaphore(_lock, 1, [this] () {
|
||||
manager_logger.debug("Rebalancing hints in {}", _hints_directory);
|
||||
return rebalance(fs::path{_hints_directory}).then([this] {
|
||||
return rebalance_hints(fs::path{_hints_directory}).then([this] {
|
||||
_state = state::rebalanced;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user