Commitlog: Handle full paths in descriptor file name parse.

This commit is contained in:
Calle Wilund
2015-08-19 13:34:20 +02:00
parent 02d2bef1f2
commit da9ea641e5

View File

@@ -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);