diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index a5767c799f..f504265ca6 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -90,7 +90,7 @@ db::commitlog::descriptor::descriptor(sstring filename) : descriptor([filename]() { std::smatch m; // match both legacy and new version of commitlogs Ex: CommitLog-12345.log and CommitLog-4-12345.log. - std::regex rx(FILENAME_PREFIX + "((\\d+)(" + SEPARATOR + "\\d+)?)" + FILENAME_EXTENSION); + std::regex rx("(?:.*/)?" + FILENAME_PREFIX + "((\\d+)(" + SEPARATOR + "\\d+)?)" + FILENAME_EXTENSION); std::string sfilename = filename; if (!std::regex_match(sfilename, m, rx)) { throw std::runtime_error("Cannot parse the version of the file: " + filename);