mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-28 10:41:12 +00:00
replica: Preparation for multiple compaction groups
Adjusts scylla_memtables gdb command to multiple groups, while keeping backward compatibility. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -409,9 +409,9 @@ private:
|
||||
|
||||
compaction_manager& _compaction_manager;
|
||||
sstables::compaction_strategy _compaction_strategy;
|
||||
// TODO: Still holds a single compaction group, meaning all sstables are eligible to be compacted with one another. Soon, a table
|
||||
// will be able to hold more than one group.
|
||||
std::unique_ptr<compaction_group> _compaction_group;
|
||||
std::vector<std::unique_ptr<compaction_group>> _compaction_groups;
|
||||
// FIXME: will be removed once the last ref to single compaction group is gone.
|
||||
compaction_group* _compaction_group;
|
||||
// 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
|
||||
@@ -526,6 +526,7 @@ public:
|
||||
const std::vector<sstables::shared_sstable>& old_sstables);
|
||||
};
|
||||
private:
|
||||
std::vector<std::unique_ptr<compaction_group>> 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.
|
||||
|
||||
@@ -472,6 +472,12 @@ 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;
|
||||
ret.emplace_back(std::make_unique<compaction_group>(*this));
|
||||
return ret;
|
||||
}
|
||||
|
||||
compaction_group* table::single_compaction_group_if_available() const noexcept {
|
||||
return &*_compaction_group;
|
||||
}
|
||||
@@ -1324,7 +1330,8 @@ table::table(schema_ptr schema, config config, db::commitlog* cl, compaction_man
|
||||
)
|
||||
, _compaction_manager(compaction_manager)
|
||||
, _compaction_strategy(make_compaction_strategy(_schema->compaction_strategy(), _schema->compaction_strategy_options()))
|
||||
, _compaction_group(std::make_unique<compaction_group>(*this))
|
||||
, _compaction_groups(make_compaction_groups())
|
||||
, _compaction_group(_compaction_groups.front().get())
|
||||
, _sstables(make_compound_sstable_set())
|
||||
, _cache(_schema, sstables_as_snapshot_source(), row_cache_tracker, is_continuous::yes)
|
||||
, _commitlog(cl)
|
||||
|
||||
@@ -4209,9 +4209,13 @@ class scylla_memtables(gdb.Command):
|
||||
for table in all_tables(db):
|
||||
gdb.write('table %s:\n' % schema_ptr(table['_schema']).table_name())
|
||||
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