diff --git a/replica/database.hh b/replica/database.hh index 7c46a8ac31..88751ffc25 100644 --- a/replica/database.hh +++ b/replica/database.hh @@ -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>; using enable_backlog_tracker = bool_class; @@ -424,7 +425,7 @@ private: compaction_manager& _compaction_manager; sstables::compaction_strategy _compaction_strategy; - std::vector> _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; // Control background fibers waiting for sstables to be deleted @@ -543,7 +544,7 @@ public: private: using compaction_group_ptr = std::unique_ptr; - std::vector> 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>& 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(compaction_group&)> action); diff --git a/replica/table.cc b/replica/table.cc index ae1f901a91..8b6df81bb6 100644 --- a/replica/table.cc +++ b/replica/table.cc @@ -542,8 +542,8 @@ void table::enable_off_strategy_trigger() { do_update_off_strategy_trigger(); } -std::vector> table::make_compaction_groups() { - std::vector> 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>& table::compaction_groups() const noexcept { +const compaction_group_vector& table::compaction_groups() const noexcept { return _compaction_groups; } diff --git a/scylla-gdb.py b/scylla-gdb.py index 45c227f286..0852a8521e 100755 --- a/scylla-gdb.py +++ b/scylla-gdb.py @@ -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('>', '>')