streaming: keep sharded database reference on tablet_sstable_streamer

This commit is contained in:
Ernest Zaslavsky
2025-12-01 16:49:36 +02:00
parent 4ffa070715
commit 757e9d0f52

View File

@@ -178,11 +178,13 @@ private:
};
class tablet_sstable_streamer : public sstable_streamer {
[[maybe_unused]] sharded<replica::database>& _db;
const locator::tablet_map& _tablet_map;
public:
tablet_sstable_streamer(netw::messaging_service& ms, replica::database& db, ::table_id table_id, locator::effective_replication_map_ptr erm,
tablet_sstable_streamer(netw::messaging_service& ms, sharded<replica::database>& db, ::table_id table_id, locator::effective_replication_map_ptr erm,
std::vector<sstables::shared_sstable> sstables, primary_replica_only primary, unlink_sstables unlink, stream_scope scope)
: sstable_streamer(ms, db, table_id, std::move(erm), std::move(sstables), primary, unlink, scope)
: sstable_streamer(ms, db.local(), table_id, std::move(erm), std::move(sstables), primary, unlink, scope)
, _db(db)
, _tablet_map(_erm->get_token_metadata().tablets().get_tablet_map(table_id)) {
}
@@ -582,7 +584,7 @@ future<> sstables_loader::load_and_stream(sstring ks_name, sstring cf_name,
std::unique_ptr<sstable_streamer> streamer;
if (_db.local().find_column_family(table_id).uses_tablets()) {
streamer =
std::make_unique<tablet_sstable_streamer>(_messaging, _db.local(), table_id, std::move(erm), std::move(sstables), primary, unlink_sstables(unlink), scope);
std::make_unique<tablet_sstable_streamer>(_messaging, _db, table_id, std::move(erm), std::move(sstables), primary, unlink_sstables(unlink), scope);
} else {
streamer =
std::make_unique<sstable_streamer>(_messaging, _db.local(), table_id, std::move(erm), std::move(sstables), primary, unlink_sstables(unlink), scope);