mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
commitlog: ignore commitlog segments generated by Cassandra-derived tools
Cassandra-derived tools (such as sstable2json) may write commitlog segments, that Scylla cannot recognize. Since we now write them with a distinct name, we can recognize the name and ignore these segments, as we know the data they contain is not interesting. Fixes #1112. Message-Id: <1459356904-20699-1-git-send-email-avi@scylladb.com>
This commit is contained in:
@@ -882,7 +882,7 @@ db::commitlog::segment_manager::list_descriptors(sstring dirname) {
|
||||
return make_ready_future<std::experimental::optional<directory_entry_type>>(de.type);
|
||||
};
|
||||
return entry_type(de).then([this, de](std::experimental::optional<directory_entry_type> 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) {
|
||||
|
||||
Reference in New Issue
Block a user