mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 19:21:01 +00:00
replica: Switch to chunked_vector for storing compaction groups
We aim for a large number of tablets, therefore let's switch to chunked_vector to avoid large contiguous allocs. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -322,6 +322,7 @@ using column_family_stats = table_stats;
|
||||
|
||||
class database_sstable_write_monitor;
|
||||
class compaction_group;
|
||||
using compaction_group_vector = utils::chunked_vector<std::unique_ptr<compaction_group>>;
|
||||
|
||||
using enable_backlog_tracker = bool_class<class enable_backlog_tracker_tag>;
|
||||
|
||||
@@ -424,7 +425,7 @@ private:
|
||||
|
||||
compaction_manager& _compaction_manager;
|
||||
sstables::compaction_strategy _compaction_strategy;
|
||||
std::vector<std::unique_ptr<compaction_group>> _compaction_groups;
|
||||
compaction_group_vector _compaction_groups;
|
||||
// Compound SSTable set for all the compaction groups, which is useful for operations spanning all of them.
|
||||
lw_shared_ptr<sstables::sstable_set> _sstables;
|
||||
// Control background fibers waiting for sstables to be deleted
|
||||
@@ -543,7 +544,7 @@ public:
|
||||
|
||||
private:
|
||||
using compaction_group_ptr = std::unique_ptr<compaction_group>;
|
||||
std::vector<std::unique_ptr<compaction_group>> make_compaction_groups();
|
||||
compaction_group_vector make_compaction_groups();
|
||||
// Return compaction group if table owns a single one. Otherwise, null is returned.
|
||||
compaction_group* single_compaction_group_if_available() const noexcept;
|
||||
// Select a compaction group from a given token.
|
||||
@@ -553,7 +554,7 @@ private:
|
||||
// Select a compaction group from a given sstable based on its token range.
|
||||
compaction_group& compaction_group_for_sstable(const sstables::shared_sstable& sst) const noexcept;
|
||||
// Returns a list of all compaction groups.
|
||||
const std::vector<std::unique_ptr<compaction_group>>& compaction_groups() const noexcept;
|
||||
const compaction_group_vector& compaction_groups() const noexcept;
|
||||
// Safely iterate through compaction groups, while performing async operations on them.
|
||||
future<> parallel_foreach_compaction_group(std::function<future<>(compaction_group&)> action);
|
||||
|
||||
|
||||
@@ -542,8 +542,8 @@ void table::enable_off_strategy_trigger() {
|
||||
do_update_off_strategy_trigger();
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<compaction_group>> table::make_compaction_groups() {
|
||||
std::vector<std::unique_ptr<compaction_group>> ret;
|
||||
compaction_group_vector table::make_compaction_groups() {
|
||||
compaction_group_vector ret;
|
||||
auto&& ranges = dht::split_token_range_msb(_x_log2_compaction_groups);
|
||||
ret.reserve(ranges.size());
|
||||
tlogger.debug("Created {} compaction groups for {}.{}", ranges.size(), _schema->ks_name(), _schema->cf_name());
|
||||
@@ -584,7 +584,7 @@ compaction_group& table::compaction_group_for_sstable(const sstables::shared_sst
|
||||
return compaction_group_for_token(sst->get_first_decorated_key().token());
|
||||
}
|
||||
|
||||
const std::vector<std::unique_ptr<compaction_group>>& table::compaction_groups() const noexcept {
|
||||
const compaction_group_vector& table::compaction_groups() const noexcept {
|
||||
return _compaction_groups;
|
||||
}
|
||||
|
||||
|
||||
@@ -4410,13 +4410,17 @@ class scylla_memtables(gdb.Command):
|
||||
for table in all_tables(db):
|
||||
gdb.write('table %s:\n' % schema_ptr(table['_schema']).table_name())
|
||||
try:
|
||||
for cg_ptr in std_vector(table["_compaction_groups"]):
|
||||
for cg_ptr in chunked_vector(table["_compaction_groups"]):
|
||||
scylla_memtables.dump_compaction_group_memtables(std_unique_ptr(cg_ptr).get())
|
||||
except gdb.error:
|
||||
try:
|
||||
scylla_memtables.dump_compaction_group_memtables(std_unique_ptr(table["_compaction_group"]).get())
|
||||
for cg_ptr in std_vector(table["_compaction_groups"]):
|
||||
scylla_memtables.dump_compaction_group_memtables(std_unique_ptr(cg_ptr).get())
|
||||
except gdb.error:
|
||||
scylla_memtables.dump_memtable_list(seastar_lw_shared_ptr(table['_memtables']).get()) # Scylla 5.1 compatibility
|
||||
try:
|
||||
scylla_memtables.dump_compaction_group_memtables(std_unique_ptr(table["_compaction_group"]).get())
|
||||
except gdb.error:
|
||||
scylla_memtables.dump_memtable_list(seastar_lw_shared_ptr(table['_memtables']).get()) # Scylla 5.1 compatibility
|
||||
|
||||
def escape_html(s):
|
||||
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
|
||||
Reference in New Issue
Block a user