Don't check full local locations after loading file from database.

This commit is contained in:
levlam 2022-06-24 14:59:42 +03:00
parent c4690c9ed3
commit 7153a17bd7

View File

@ -1177,8 +1177,9 @@ Result<FileId> FileManager::register_file(FileData &&data, FileLocationSource fi
bool has_remote = data.remote_.type() == RemoteFileLocation::Type::Full;
bool has_generate = data.generate_ != nullptr;
if (data.local_.type() == LocalFileLocation::Type::Full && !force) {
if (file_location_source == FileLocationSource::FromBinlog ||
file_location_source == FileLocationSource::FromDatabase) {
bool is_from_database = file_location_source == FileLocationSource::FromBinlog ||
file_location_source == FileLocationSource::FromDatabase;
if (is_from_database) {
PathView path_view(data.local_.full().path_);
if (path_view.is_relative()) {
data.local_.full().path_ = PSTRING()
@ -1186,6 +1187,7 @@ Result<FileId> FileManager::register_file(FileData &&data, FileLocationSource fi
}
}
if (!is_from_database) {
auto status = check_local_location(data.local_.full(), data.size_, skip_file_size_checks);
if (status.is_error()) {
LOG(INFO) << "Invalid " << data.local_.full() << ": " << status << " from " << source;
@ -1199,6 +1201,7 @@ Result<FileId> FileManager::register_file(FileData &&data, FileLocationSource fi
}
}
}
}
bool has_local = data.local_.type() == LocalFileLocation::Type::Full;
bool has_location = has_local || has_remote || has_generate;
if (!has_location) {