PartsManager: restart upload when known_prefix_flag changes from outside

GitOrigin-RevId: a16192d1d73eea1337c590920ae425b7cd71f0e1
This commit is contained in:
Arseny Smirnov 2018-12-27 09:45:19 +03:00
parent 5c2c8a1844
commit f01329e8ed

View File

@ -200,14 +200,9 @@ Result<Part> PartsManager::start_part() {
}
Status PartsManager::set_known_prefix(size_t size, bool is_ready) {
CHECK(known_prefix_flag_) << unknown_size_flag_ << " " << size << " " << is_ready << " " << known_prefix_size_ << " "
<< expected_size_ << " " << part_count_ << " " << part_status_.size();
if (size < static_cast<size_t>(known_prefix_size_)) {
if (!known_prefix_flag_ || size < static_cast<size_t>(known_prefix_size_)) {
return Status::Error("FILE_UPLOAD_RESTART");
}
CHECK(size >= static_cast<size_t>(known_prefix_size_))
<< unknown_size_flag_ << " " << size << " " << is_ready << " " << known_prefix_size_ << " " << expected_size_
<< " " << part_count_ << " " << part_status_.size();
known_prefix_size_ = narrow_cast<int64>(size);
expected_size_ = max(known_prefix_size_, expected_size_);