table: Don't account for shared SSTables in compaction backlog tracker
We don't want to add shared sstables to table's backlog tracker because: 1) table's backlog tracker has only an influence on regular compaction 2) shared sstables are never regular compacted, they're worked by resharding which has its own backlog tracker. Such sstables belong to more than one shard, meaning that currently they're added to backlog tracker of all shards that own them. But the thing is that such sstables ends up being resharded in shard that may be completely random. So increasing backlog of all shards such sstables belong to, won't lead to faster resharding. Also, table's backlog tracker is supposed to deal only with regular compaction. Accounting for shared sstables in table's tracker may lead to incorrect speed up of regular compactions because the controller is not aware that some relevant part of the backlog is due to pending resharding. The fix is about ignoring sstables that will be resharded and let table's backlog tracker account only for sstables that can be worked on by regular compaction, and rely on resharding controlling itself with its own tracker. NOTE: this doesn't fix the resharding controlling issue completely, as described in #4952. We'll still need to throttle regular compaction on behalf of resharding. So subsequent work may be about: - move resharding to its own priority class, perhaps streaming. - make a resharding's backlog tracker accounts for sstables in all of its pending jobs, not only the ongoing ones (currently limited to 1 by shard). - limit compaction shares when resharding is in progress. THIS only fixes the issue in which controller for regular compaction shouldn't account sstables completely exclusive to resharding. Fixes #5077. Refs #4952. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com> Message-Id: <20190924022109.17400-1-raphaelsc@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
88611d41d0
commit
7f1a2156c7
@@ -534,6 +534,7 @@ private:
|
||||
// Doesn't trigger compaction.
|
||||
// Strong exception guarantees.
|
||||
void add_sstable(sstables::shared_sstable sstable, const std::vector<unsigned>& shards_for_the_sstable);
|
||||
static void add_sstable_to_backlog_tracker(compaction_backlog_tracker& tracker, sstables::shared_sstable sstable);
|
||||
// returns an empty pointer if sstable doesn't belong to current shard.
|
||||
future<sstables::shared_sstable> open_sstable(sstables::foreign_sstable_open_info info, sstring dir,
|
||||
int64_t generation, sstables::sstable_version_types v, sstables::sstable_format_types f);
|
||||
|
||||
12
table.cc
12
table.cc
@@ -677,6 +677,14 @@ void table::update_stats_for_new_sstable(uint64_t disk_space_used_by_sstable, co
|
||||
}
|
||||
}
|
||||
|
||||
inline void table::add_sstable_to_backlog_tracker(compaction_backlog_tracker& tracker, sstables::shared_sstable sstable) {
|
||||
// Don't add sstables that belong to more than one shard to the table's backlog tracker
|
||||
// given that such sstables are supposed to be tracked only by resharding's own tracker.
|
||||
if (!sstable->is_shared()) {
|
||||
tracker.add_sstable(sstable);
|
||||
}
|
||||
}
|
||||
|
||||
void table::add_sstable(sstables::shared_sstable sstable, const std::vector<unsigned>& shards_for_the_sstable) {
|
||||
// allow in-progress reads to continue using old list
|
||||
auto new_sstables = make_lw_shared(*_sstables);
|
||||
@@ -686,7 +694,7 @@ void table::add_sstable(sstables::shared_sstable sstable, const std::vector<unsi
|
||||
if (sstable->requires_view_building()) {
|
||||
_sstables_staging.emplace(sstable->generation(), sstable);
|
||||
} else {
|
||||
_compaction_strategy.get_backlog_tracker().add_sstable(sstable);
|
||||
add_sstable_to_backlog_tracker(_compaction_strategy.get_backlog_tracker(), sstable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1405,7 +1413,7 @@ void table::set_compaction_strategy(sstables::compaction_strategy_type strategy)
|
||||
|
||||
auto new_sstables = new_cs.make_sstable_set(_schema);
|
||||
for (auto&& s : *_sstables->all()) {
|
||||
new_cs.get_backlog_tracker().add_sstable(s);
|
||||
add_sstable_to_backlog_tracker(new_cs.get_backlog_tracker(), s);
|
||||
new_sstables.insert(s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user