Rename "files" log tag to "file_loader".
GitOrigin-RevId: 24fca707a99eeb32adabcca46131123d584f2c1d
This commit is contained in:
parent
b204ad4ee1
commit
8a607933a7
@ -48,11 +48,11 @@ static NullLog null_log;
|
||||
#define ADD_TAG(tag) \
|
||||
{ #tag, &VERBOSITY_NAME(tag) }
|
||||
static const std::map<Slice, int *> log_tags{
|
||||
ADD_TAG(td_init), ADD_TAG(update_file), ADD_TAG(connections), ADD_TAG(binlog),
|
||||
ADD_TAG(proxy), ADD_TAG(net_query), ADD_TAG(td_requests), ADD_TAG(dc),
|
||||
ADD_TAG(files), ADD_TAG(mtproto), ADD_TAG(raw_mtproto), ADD_TAG(fd),
|
||||
ADD_TAG(actor), ADD_TAG(sqlite), ADD_TAG(notifications), ADD_TAG(get_difference),
|
||||
ADD_TAG(file_gc), ADD_TAG(config_recoverer), ADD_TAG(dns_resolver), ADD_TAG(file_references)};
|
||||
ADD_TAG(td_init), ADD_TAG(update_file), ADD_TAG(connections), ADD_TAG(binlog),
|
||||
ADD_TAG(proxy), ADD_TAG(net_query), ADD_TAG(td_requests), ADD_TAG(dc),
|
||||
ADD_TAG(file_loader), ADD_TAG(mtproto), ADD_TAG(raw_mtproto), ADD_TAG(fd),
|
||||
ADD_TAG(actor), ADD_TAG(sqlite), ADD_TAG(notifications), ADD_TAG(get_difference),
|
||||
ADD_TAG(file_gc), ADD_TAG(config_recoverer), ADD_TAG(dns_resolver), ADD_TAG(file_references)};
|
||||
#undef ADD_TAG
|
||||
|
||||
Status Logging::set_current_stream(td_api::object_ptr<td_api::LogStream> stream) {
|
||||
|
@ -31,7 +31,7 @@ void FileLoader::update_priority(int8 priority) {
|
||||
}
|
||||
void FileLoader::update_resources(const ResourceState &other) {
|
||||
resource_state_.update_slave(other);
|
||||
VLOG(files) << "Update resources " << resource_state_;
|
||||
VLOG(file_loader) << "Update resources " << resource_state_;
|
||||
loop();
|
||||
}
|
||||
void FileLoader::set_ordered_flag(bool flag) {
|
||||
@ -79,10 +79,10 @@ void FileLoader::update_downloaded_part(int64 offset, int64 limit) {
|
||||
: static_cast<int32>((offset + limit - 1) / parts_manager_.get_part_size()) + 1;
|
||||
auto max_parts = static_cast<int32>(ResourceManager::MAX_RESOURCE_LIMIT / parts_manager_.get_part_size());
|
||||
auto end_part_id = begin_part_id + td::min(max_parts, new_end_part_id - begin_part_id);
|
||||
VLOG(files) << "Protect parts " << begin_part_id << " ... " << end_part_id - 1;
|
||||
VLOG(file_loader) << "Protect parts " << begin_part_id << " ... " << end_part_id - 1;
|
||||
for (auto &it : part_map_) {
|
||||
if (!it.second.second.empty() && !(begin_part_id <= it.second.first.id && it.second.first.id < end_part_id)) {
|
||||
VLOG(files) << "Cancel part " << it.second.first.id;
|
||||
VLOG(file_loader) << "Cancel part " << it.second.first.id;
|
||||
it.second.second.reset(); // cancel_query(it.second.second);
|
||||
}
|
||||
}
|
||||
@ -194,14 +194,14 @@ Status FileLoader::do_loop() {
|
||||
break;
|
||||
}
|
||||
if (resource_state_.unused() < static_cast<int64>(parts_manager_.get_part_size())) {
|
||||
VLOG(files) << "Got only " << resource_state_.unused() << " resource";
|
||||
VLOG(file_loader) << "Got only " << resource_state_.unused() << " resource";
|
||||
break;
|
||||
}
|
||||
TRY_RESULT(part, parts_manager_.start_part());
|
||||
if (part.size == 0) {
|
||||
break;
|
||||
}
|
||||
VLOG(files) << "Start part " << tag("id", part.id) << tag("size", part.size);
|
||||
VLOG(file_loader) << "Start part " << tag("id", part.id) << tag("size", part.size);
|
||||
resource_state_.start_use(static_cast<int64>(part.size));
|
||||
|
||||
TRY_RESULT(query_flag, start_part(part, parts_manager_.get_part_count(), parts_manager_.get_streaming_offset()));
|
||||
@ -245,7 +245,7 @@ void FileLoader::update_estimated_limit() {
|
||||
}
|
||||
auto estimated_extra = parts_manager_.get_estimated_extra();
|
||||
resource_state_.update_estimated_limit(estimated_extra);
|
||||
VLOG(files) << "Update estimated limit " << estimated_extra;
|
||||
VLOG(file_loader) << "Update estimated limit " << estimated_extra;
|
||||
if (!resource_manager_.empty()) {
|
||||
keep_fd_flag(narrow_cast<uint64>(resource_state_.active_limit()) >= parts_manager_.get_part_size());
|
||||
send_closure(resource_manager_, &ResourceManager::update_resources, resource_state_);
|
||||
@ -282,7 +282,7 @@ void FileLoader::on_result(NetQueryPtr query) {
|
||||
should_restart = true;
|
||||
}
|
||||
if (should_restart) {
|
||||
VLOG(files) << "Restart part " << tag("id", part.id) << tag("size", part.size);
|
||||
VLOG(file_loader) << "Restart part " << tag("id", part.id) << tag("size", part.size);
|
||||
resource_state_.stop_use(static_cast<int64>(part.size));
|
||||
parts_manager_.on_part_failed(part.id);
|
||||
} else {
|
||||
@ -331,7 +331,7 @@ void FileLoader::on_common_query(NetQueryPtr query) {
|
||||
|
||||
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);
|
||||
VLOG(file_loader) << "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_unchecked_ready_prefix_count();
|
||||
TRY_STATUS(parts_manager_.on_part_ok(part.id, part.size, size));
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(files) = VERBOSITY_NAME(DEBUG) + 2;
|
||||
int VERBOSITY_NAME(file_loader) = VERBOSITY_NAME(DEBUG) + 2;
|
||||
|
||||
namespace {
|
||||
Result<std::pair<FileFd, string>> try_create_new_file(Result<CSlice> result_name) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(files);
|
||||
extern int VERBOSITY_NAME(file_loader);
|
||||
|
||||
Result<std::pair<FileFd, string>> open_temp_file(FileType file_type) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
|
@ -943,11 +943,11 @@ Status FileManager::check_local_location(FullLocalFileLocation &location, int64
|
||||
size = stat.size_;
|
||||
}
|
||||
if (location.mtime_nsec_ == 0) {
|
||||
VLOG(files) << "Set file \"" << location.path_ << "\" modification time to " << stat.mtime_nsec_;
|
||||
VLOG(file_loader) << "Set file \"" << location.path_ << "\" modification time to " << stat.mtime_nsec_;
|
||||
location.mtime_nsec_ = stat.mtime_nsec_;
|
||||
} else if (!are_modification_times_equal(location.mtime_nsec_, stat.mtime_nsec_)) {
|
||||
VLOG(files) << "File \"" << location.path_ << "\" was modified: old mtime = " << location.mtime_nsec_
|
||||
<< ", new mtime = " << stat.mtime_nsec_;
|
||||
VLOG(file_loader) << "File \"" << location.path_ << "\" was modified: old mtime = " << location.mtime_nsec_
|
||||
<< ", new mtime = " << stat.mtime_nsec_;
|
||||
return Status::Error(PSLICE() << "File \"" << location.path_ << "\" was modified");
|
||||
}
|
||||
if (skip_file_size_checks) {
|
||||
|
@ -147,9 +147,9 @@ Status PartsManager::init(int64 size, int64 expected_size, bool is_size_final, s
|
||||
}
|
||||
|
||||
bool PartsManager::unchecked_ready() {
|
||||
VLOG(files) << "Check readiness. Ready size is " << ready_size_ << ", total size is " << size_
|
||||
<< ", unknown_size_flag = " << unknown_size_flag_ << ", need_check = " << need_check_
|
||||
<< ", checked_prefix_size = " << checked_prefix_size_;
|
||||
VLOG(file_loader) << "Check readiness. Ready size is " << ready_size_ << ", total size is " << size_
|
||||
<< ", unknown_size_flag = " << unknown_size_flag_ << ", need_check = " << need_check_
|
||||
<< ", checked_prefix_size = " << checked_prefix_size_;
|
||||
return !unknown_size_flag_ && ready_size_ == size_;
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ Status PartsManager::on_part_ok(int32 id, size_t part_size, size_t actual_size)
|
||||
streaming_ready_size_ += narrow_cast<int64>(actual_size);
|
||||
}
|
||||
|
||||
VLOG(files) << "Transferred part " << id << " of size " << part_size << ", total ready size = " << ready_size_;
|
||||
VLOG(file_loader) << "Transferred part " << id << " of size " << part_size << ", total ready size = " << ready_size_;
|
||||
|
||||
int64 offset = narrow_cast<int64>(part_size_) * id;
|
||||
int64 end_offset = offset + narrow_cast<int64>(actual_size);
|
||||
|
@ -53,13 +53,11 @@ void ResourceManager::update_resources(const ResourceState &resource_state) {
|
||||
}
|
||||
auto node = (*node_ptr).get();
|
||||
CHECK(node);
|
||||
VLOG(files) << "Before total: " << resource_state_;
|
||||
VLOG(files) << "Before " << tag("node_id", node_id) << ": " << node->resource_state_;
|
||||
VLOG(file_loader) << "Before total: " << resource_state_ << "; node " << node_id << ": " << node->resource_state_;
|
||||
resource_state_ -= node->resource_state_;
|
||||
node->resource_state_.update_master(resource_state);
|
||||
resource_state_ += node->resource_state_;
|
||||
VLOG(files) << "After total: " << resource_state_;
|
||||
VLOG(files) << "After " << tag("node_id", node_id) << ": " << node->resource_state_;
|
||||
VLOG(file_loader) << "After total: " << resource_state_ << "; node " << node_id << ": " << node->resource_state_;
|
||||
|
||||
if (mode_ == Mode::Greedy) {
|
||||
add_to_heap(node);
|
||||
@ -107,16 +105,16 @@ bool ResourceManager::satisfy_node(NodeId file_node_id) {
|
||||
CHECK(file_node);
|
||||
auto part_size = narrow_cast<int64>(file_node->resource_state_.unit_size());
|
||||
auto need = file_node->resource_state_.estimated_extra();
|
||||
VLOG(files) << tag("need", need) << tag("part_size", part_size);
|
||||
VLOG(file_loader) << tag("need", need) << tag("part_size", part_size);
|
||||
need = (need + part_size - 1) / part_size * part_size;
|
||||
VLOG(files) << tag("need", need);
|
||||
VLOG(file_loader) << tag("need", need);
|
||||
if (need == 0) {
|
||||
return true;
|
||||
}
|
||||
auto give = resource_state_.unused();
|
||||
give = min(need, give);
|
||||
give -= give % part_size;
|
||||
VLOG(files) << tag("give", give);
|
||||
VLOG(file_loader) << tag("give", give);
|
||||
if (give == 0) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user