mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Fixup
This commit is contained in:
parent
68f9fd3767
commit
6df282e813
@ -82,8 +82,8 @@ void FileChecker::repair()
|
||||
const String & name = name_size.first;
|
||||
size_t expected_size = name_size.second;
|
||||
String path = parentPath(files_info_path) + name;
|
||||
|
||||
auto real_size = disk->exists(path) ? disk->getFileSize(path) : 0; /// Race condition is Ok.
|
||||
bool exists = disk->exists(path);
|
||||
auto real_size = exists ? disk->getFileSize(path) : 0; /// No race condition assuming no one else is working with these files.
|
||||
|
||||
if (real_size < expected_size)
|
||||
throw Exception(ErrorCodes::UNEXPECTED_END_OF_FILE, "Size of {} is less than expected. Size is {} but should be {}.",
|
||||
|
@ -264,7 +264,7 @@ void DiskLocal::createHardLink(const String & src_path, const String & dst_path)
|
||||
|
||||
void DiskLocal::truncateFile(const String & path, size_t size)
|
||||
{
|
||||
int res = truncate(path.c_str(), size);
|
||||
int res = truncate((disk_path + path).c_str(), size);
|
||||
if (-1 == res)
|
||||
throwFromErrnoWithPath("Cannot truncate file " + path, path, ErrorCodes::CANNOT_TRUNCATE_FILE);
|
||||
}
|
||||
|
@ -118,15 +118,10 @@ public:
|
||||
{
|
||||
try
|
||||
{
|
||||
LOG_TRACE(storage.log, "Done: {}\n", done);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
/// Rollback partial writes.
|
||||
streams.clear();
|
||||
|
||||
LOG_TRACE(storage.log, "Repairing");
|
||||
|
||||
storage.file_checker.repair();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user