diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index cefe4567b3..d4dcd8ba7b 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -882,7 +882,7 @@ db::commitlog::segment_manager::list_descriptors(sstring dirname) { return make_ready_future>(de.type); }; return entry_type(de).then([this, de](std::experimental::optional type) { - if (type == directory_entry_type::regular && de.name[0] != '.') { + if (type == directory_entry_type::regular && de.name[0] != '.' && !is_cassandra_segment(de.name)) { try { _result.emplace_back(de.name); } catch (std::domain_error& e) { @@ -896,6 +896,15 @@ db::commitlog::segment_manager::list_descriptors(sstring dirname) { future<> done() { return _list.done(); } + + static bool is_cassandra_segment(sstring name) { + // We want to ignore commitlog segments generated by Cassandra-derived tools (#1112) + auto c = sstring("Cassandra"); + if (name.size() < c.size()) { + return false; + } + return name.substr(0, c.size()) == c; + } }; return open_checked_directory(commit_error, dirname).then([this, dirname](file dir) {