Fix debug bad parts.

GitOrigin-RevId: 867baaf16092b260f2695b94745fb9fe765b548a
This commit is contained in:
levlam 2018-05-20 00:56:40 +03:00
parent cb6456ce6d
commit 68dd5cece9
3 changed files with 10 additions and 5 deletions

View File

@ -274,9 +274,9 @@ Status FileLoader::try_on_part_query(Part part, NetQueryPtr query) {
TRY_RESULT(size, process_part(part, std::move(query)));
VLOG(files) << "Ok part " << tag("id", part.id) << tag("size", part.size);
resource_state_.stop_use(static_cast<int64>(part.size));
auto old_ready_prefix_count = parts_manager_.get_ready_prefix_count();
auto old_ready_prefix_count = parts_manager_.get_unchecked_ready_prefix_count();
TRY_STATUS(parts_manager_.on_part_ok(part.id, part.size, size));
auto new_ready_prefix_count = parts_manager_.get_ready_prefix_count();
auto new_ready_prefix_count = parts_manager_.get_unchecked_ready_prefix_count();
debug_total_parts_++;
if (old_ready_prefix_count == new_ready_prefix_count) {
debug_bad_parts_.push_back(part.id);

View File

@ -129,13 +129,17 @@ void PartsManager::update_first_not_ready_part() {
}
}
int32 PartsManager::get_ready_prefix_count() {
int32 PartsManager::get_unchecked_ready_prefix_count() {
update_first_not_ready_part();
auto res = first_not_ready_part_;
return first_not_ready_part_;
}
int32 PartsManager::get_ready_prefix_count() {
auto res = get_unchecked_ready_prefix_count();
if (need_check_) {
auto checked_parts = narrow_cast<int32>(checked_prefix_size_ / part_size_);
if (checked_parts < res) {
res = checked_parts;
return checked_parts;
}
}
return res;

View File

@ -42,6 +42,7 @@ class PartsManager {
int64 get_ready_size() const;
size_t get_part_size() const;
int32 get_part_count() const;
int32 get_unchecked_ready_prefix_count();
int32 get_ready_prefix_count();
private: