FileUpload: restart automatically if part_size is too small

GitOrigin-RevId: bbfe3f0fca2f888f6bd4d2909935903d7c4e3b33
This commit is contained in:
Arseny Smirnov 2018-01-29 20:46:06 +03:00 committed by levlam
parent 674a99324b
commit c329826c5d
3 changed files with 9 additions and 2 deletions

View File

@ -2190,6 +2190,11 @@ void FileManager::on_error_impl(FileNode *node, FileManager::Query::Type type, b
}
}
if (status.message() == "FILE_UPLOAD_RESTART") {
run_upload(node, {});
return;
}
if (!was_active) {
return;
}

View File

@ -140,6 +140,9 @@ Result<FileLoader::PrefixInfo> FileUploader::on_update_local_location(const Loca
}
local_size_ = local_size;
if (expected_size_ < local_size_) {
expected_size_ = local_size_;
}
local_is_ready_ = local_is_ready;
file_type_ = file_type;

View File

@ -63,8 +63,7 @@ Status PartsManager::init(int64 size, bool is_size_final, size_t part_size, cons
if (part_size != 0) {
part_size_ = part_size;
if (use_part_count_limit_ && (size_ + part_size_ - 1) / part_size_ > MAX_PART_COUNT) {
return Status::Error(PSLICE() << "Should restart load with bigger part_size " << tag("part_size_", part_size_)
<< tag("size", size_));
return Status::Error("FILE_UPLOAD_RESTART");
}
} else {
// TODO choose part_size_ depending on size