review fixes

This commit is contained in:
serxa 2023-02-09 20:17:46 +00:00
parent b0fc551c27
commit acabee8554
2 changed files with 11 additions and 2 deletions

View File

@ -356,7 +356,7 @@ void WriteBufferFromS3::processUploadRequest(UploadPartTask & task)
}
else
{
write_settings.resource_link.adjust(cost, 0); // We assume no resource was used in case of failure
write_settings.resource_link.accumulate(cost); // We assume no resource was used in case of failure
throw S3Exception(outcome.GetError().GetMessage(), outcome.GetError().GetErrorType());
}
}

View File

@ -99,7 +99,16 @@ struct ReadBufferFromHDFS::ReadBufferFromHDFSImpl : public BufferWithOwnMemory<S
}
ResourceGuard rlock(read_settings.resource_link, num_bytes_to_read);
int bytes_read = hdfsRead(fs.get(), fin, internal_buffer.begin(), safe_cast<int>(num_bytes_to_read));
int bytes_read;
try
{
bytes_read = hdfsRead(fs.get(), fin, internal_buffer.begin(), safe_cast<int>(num_bytes_to_read));
}
catch (...)
{
read_settings.resource_link.accumulate(num_bytes_to_read); // We assume no resource was used in case of failure
throw;
}
rlock.unlock();
if (bytes_read < 0)