Fix local_ready_size in om_partial_generate.

GitOrigin-RevId: 614351cac5508589bd86ddf6be2c34b7e6c98585
This commit is contained in:
levlam 2018-12-27 18:37:57 +03:00
parent 274e00175e
commit 894038a881
2 changed files with 12 additions and 5 deletions

View File

@ -409,6 +409,8 @@ int64 FileView::local_total_size() const {
case LocalFileLocation::Type::Full: case LocalFileLocation::Type::Full:
return node_->size_; return node_->size_;
case LocalFileLocation::Type::Partial: case LocalFileLocation::Type::Partial:
VLOG(update_file) << "Have local_ready_prefix_size = " << node_->local_ready_prefix_size_
<< " and local_ready_size = " << node_->local_ready_size_;
return max(node_->local_ready_prefix_size_, node_->local_ready_size_); return max(node_->local_ready_prefix_size_, node_->local_ready_size_);
default: default:
UNREACHABLE(); UNREACHABLE();
@ -425,9 +427,12 @@ int64 FileView::remote_size() const {
case RemoteFileLocation::Type::Full: case RemoteFileLocation::Type::Full:
return node_->size_; return node_->size_;
case RemoteFileLocation::Type::Partial: { case RemoteFileLocation::Type::Partial: {
auto res = auto part_size = static_cast<int64>(node_->remote_.partial().part_size_);
max(static_cast<int64>(node_->remote_.partial().part_size_) * node_->remote_.partial().ready_part_count_, auto ready_part_count = node_->remote_.partial().ready_part_count_;
node_->remote_ready_size_); auto remote_ready_size = node_->remote_ready_size_;
VLOG(update_file) << "Have part_size = " << part_size << ", remote_ready_part_count = " << ready_part_count
<< ", remote_ready_size = " << remote_ready_size << ", size = " << size();
auto res = max(part_size * ready_part_count, remote_ready_size);
if (size() != 0 && size() < res) { if (size() != 0 && size() < res) {
res = size(); res = size();
} }
@ -2478,7 +2483,9 @@ void FileManager::on_partial_generate(QueryId query_id, const PartialLocalFileLo
if (file_node->generate_id_ != query_id) { if (file_node->generate_id_ != query_id) {
return; return;
} }
file_node->set_local_location(LocalFileLocation(partial_local), 0, -1, -1 /* TODO */); auto ready_size = Bitmask(Bitmask::Decode{}, partial_local.ready_bitmask_)
.get_total_size(partial_local.part_size_, file_node->size_);
file_node->set_local_location(LocalFileLocation(partial_local), ready_size, -1, -1 /* TODO */);
// TODO check for size and local_size, abort generation if needed // TODO check for size and local_size, abort generation if needed
if (expected_size > 0) { if (expected_size > 0) {
file_node->set_expected_size(expected_size); file_node->set_expected_size(expected_size);

View File

@ -94,8 +94,8 @@ class FileNode {
LocalFileLocation local_; LocalFileLocation local_;
FileLoadManager::QueryId upload_id_ = 0; FileLoadManager::QueryId upload_id_ = 0;
int64 local_ready_size_ = 0;
int64 download_offset_ = 0; int64 download_offset_ = 0;
int64 local_ready_size_ = 0; // PartialLocal only
int64 local_ready_prefix_size_ = 0; // PartialLocal only int64 local_ready_prefix_size_ = 0; // PartialLocal only
RemoteFileLocation remote_; RemoteFileLocation remote_;