Minor logging improvements.

This commit is contained in:
levlam 2021-08-26 21:44:29 +03:00
parent 209dd8b41b
commit b1eb6db7b5
3 changed files with 10 additions and 7 deletions

View File

@ -110,21 +110,21 @@ void FileLoader::start_up() {
bool is_upload = file_info.is_upload;
// Two cases when FILE_UPLOAD_RESTART will happen
// 1. File is ready, size is final. But there are more uploaded parts, than size of a file
//pm.init(1, 100000, true, 10, {0, 1, 2}, false, true).ensure_error();
// This error is definitely ok, because we are using actual size of file on disk (mtime is checked by somebody
// else). And actual size could change arbitrarily.
// 1. File is ready, size is final. But there are more uploaded parts than size of the file
// pm.init(1, 100000, true, 10, {0, 1, 2}, false, true).ensure_error();
// This error is definitely ok, because we are using actual size of the file on disk (mtime is checked by
// somebody else). And actual size could change arbitrarily.
//
// 2. size is unknown/zero, size is not final, some parts of file are already uploaded
// pm.init(0, 100000, false, 10, {0, 1, 2}, false, true).ensure_error();
// This case is more complicated
// It means that at some point we got inconsistent state. Like deleted local location, but left partial remote
// locaiton untouched. This is completely possible at this point, but probably should be fixed.
// location untouched. This is completely possible at this point, but probably should be fixed.
auto status =
parts_manager_.init(size, expected_size, is_size_final, part_size, ready_parts, use_part_count_limit, is_upload);
LOG(DEBUG) << "Start " << (is_upload ? "up" : "down") << "load of a file of size " << size << " with expected "
<< (is_size_final ? "exact" : "approximate") << " size " << expected_size << ", part size " << part_size
<< " and " << ready_parts << " ready parts: " << status;
<< " and " << ready_parts.size() << " ready parts: " << status;
if (status.is_error()) {
on_error(std::move(status));
stop_flag_ = true;

View File

@ -3442,7 +3442,8 @@ void FileManager::on_partial_upload(QueryId query_id, const PartialRemoteFileLoc
auto file_id = query->file_id_;
auto file_node = get_file_node(file_id);
LOG(DEBUG) << "Receive on_partial_upload for file " << file_id << " with " << partial_remote;
LOG(DEBUG) << "Receive on_partial_upload for file " << file_id << " with " << partial_remote << " and ready size "
<< ready_size;
if (!file_node) {
return;
}

View File

@ -245,6 +245,7 @@ Status FileUploader::before_start_parts() {
}
return status;
}
void FileUploader::after_start_parts() {
try_release_fd();
}
@ -320,6 +321,7 @@ void FileUploader::on_progress(Progress progress) {
local_size_);
}
}
FileLoader::Callback *FileUploader::get_callback() {
return static_cast<FileLoader::Callback *>(callback_.get());
}