MCPcopy Create free account
hub / github.com/apple/foundationdb / listLogFiles

Method listLogFiles

fdbclient/BackupContainerFileSystem.actor.cpp:1226–1261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1224};
1225
1226Future<std::vector<LogFile>> BackupContainerFileSystem::listLogFiles(Version beginVersion,
1227 Version targetVersion,
1228 bool partitioned) {
1229 // The first relevant log file could have a begin version less than beginVersion based on the knobs which
1230 // determine log file range size, so start at an earlier version adjusted by how many versions a file could
1231 // contain.
1232 //
1233 // Get the cleaned (without slashes) first and last folders that could contain relevant results.
1234 std::string firstPath =
1235 BackupContainerFileSystemImpl::cleanFolderString(BackupContainerFileSystemImpl::logVersionFolderString(
1236 std::max<Version>(0,
1237 beginVersion - CLIENT_KNOBS->BACKUP_MAX_LOG_RANGES * CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE),
1238 partitioned));
1239 std::string lastPath = BackupContainerFileSystemImpl::cleanFolderString(
1240 BackupContainerFileSystemImpl::logVersionFolderString(targetVersion, partitioned));
1241
1242 std::function<bool(std::string const&)> pathFilter = [=](const std::string& folderPath) {
1243 // Remove slashes in the given folder path so that the '/' positions in the version folder string do not
1244 // matter
1245
1246 std::string cleaned = BackupContainerFileSystemImpl::cleanFolderString(folderPath);
1247 return StringRef(firstPath).startsWith(cleaned) || StringRef(lastPath).startsWith(cleaned) ||
1248 (cleaned > firstPath && cleaned < lastPath);
1249 };
1250
1251 return map(listFiles((partitioned ? "plogs/" : "logs/"), pathFilter), [=](const FilesAndSizesT& files) {
1252 std::vector<LogFile> results;
1253 LogFile lf;
1254 for (auto& f : files) {
1255 if (BackupContainerFileSystemImpl::pathToLogFile(lf, f.first, f.second) && lf.endVersion > beginVersion &&
1256 lf.beginVersion <= targetVersion)
1257 results.push_back(lf);
1258 }
1259 return results;
1260 });
1261}
1262
1263Future<std::vector<RangeFile>> BackupContainerFileSystem::old_listRangeFiles(Version beginVersion, Version endVersion) {
1264 // Get the cleaned (without slashes) first and last folders that could contain relevant results.

Callers 4

dumpFileListMethod · 0.80
describeBackupMethod · 0.80
expireDataMethod · 0.80
getRestoreSetMethod · 0.80

Calls 5

mapFunction · 0.85
listFilesFunction · 0.85
StringRefClass · 0.50
startsWithMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected