diff --git a/sstables/compaction.cc b/sstables/compaction.cc index 4176fd2312..2ac3b6fdd8 100644 --- a/sstables/compaction.cc +++ b/sstables/compaction.cc @@ -126,8 +126,8 @@ static std::vector get_uncompacting_sstables(column_family& cf, class compaction; struct compaction_writer { - sstable_writer writer; shared_sstable sst; + sstable_writer writer; }; class compacting_sstable_writer { @@ -786,7 +786,8 @@ public: cfg.max_sstable_size = _max_sstable_size; cfg.monitor = &_active_write_monitors.back(); cfg.run_identifier = _run_identifier; - return compaction_writer{sst->get_writer(*_schema, partitions_per_sstable(), cfg, get_encoding_stats(), priority), sst}; + auto writer = sst->get_writer(*_schema, partitions_per_sstable(), cfg, get_encoding_stats(), priority); + return compaction_writer{std::move(sst), std::move(writer)}; } virtual void stop_sstable_writer(compaction_writer* writer) override { @@ -1268,7 +1269,8 @@ public: // sstables generated for a given shard will share the same run identifier. cfg.run_identifier = _run_identifiers.at(shard); auto&& priority = service::get_local_compaction_priority(); - return compaction_writer{sst->get_writer(*_schema, partitions_per_sstable(shard), cfg, get_encoding_stats(), priority, shard), sst}; + auto writer = sst->get_writer(*_schema, partitions_per_sstable(shard), cfg, get_encoding_stats(), priority, shard); + return compaction_writer{std::move(sst), std::move(writer)}; } void on_new_partition() override {}