move deletion of sstables generated by interrupted compaction

This deletion should be handled by sstables::compact_sstables, which
is the responsible for creation of new sstables.
It also simplifies the code.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <541206be2e910ab4edb1500b098eb5ebf29c6509.1454110234.git.raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2016-01-29 21:35:31 -02:00
committed by Avi Kivity
parent 7214649b8a
commit ee84f310d9
2 changed files with 9 additions and 14 deletions

View File

@@ -777,19 +777,6 @@ column_family::compact_sstables(sstables::compaction_descriptor descriptor, bool
return sstables::compact_sstables(*sstables_to_compact, *this,
create_sstable, descriptor.max_sstable_bytes, descriptor.level, cleanup).then([this, new_tables, sstables_to_compact] {
this->rebuild_sstable_list(*new_tables, *sstables_to_compact);
}).then_wrapped([this, new_tables] (future<> f) {
try {
f.get();
} catch (...) {
// Delete either partially or fully written sstables of a compaction that
// was either stopped abruptly (e.g. out of disk space) or deliberately
// (e.g. nodetool stop COMPACTION).
for (auto& sst : *new_tables) {
dblog.debug("Deleting sstable {} of interrupted compaction for {}/{}", sst->get_filename(), _schema->ks_name(), _schema->cf_name());
sst->mark_for_deletion();
}
throw;
}
});
});
}