What if we replace unique_lock with shared?

This commit is contained in:
BoloniniD 2021-07-20 19:22:41 +03:00
parent a9deeb6a78
commit 49ee24e824

View File

@ -302,6 +302,9 @@ public:
{ {
if (storage->use_table_fd) if (storage->use_table_fd)
{ {
shared_lock = std::shared_lock(storage->rwlock, getLockTimeout(context));
if (!shared_lock)
throw Exception("Lock timeout exceeded", ErrorCodes::TIMEOUT_EXCEEDED);
storage->table_fd_was_used = true; storage->table_fd_was_used = true;
} }
else else
@ -510,9 +513,10 @@ Pipe StorageFile::read(
{ {
throw Exception("File descriptor isn't seekable, inside " + this_ptr->getName(), ErrorCodes::CANNOT_SEEK_THROUGH_FILE); throw Exception("File descriptor isn't seekable, inside " + this_ptr->getName(), ErrorCodes::CANNOT_SEEK_THROUGH_FILE);
} }
ReadBufferFromFileDescriptorPRead table_fd_seek(this_ptr->table_fd); if (lseek(this_ptr->table_fd, this_ptr->table_fd_init_offset, SEEK_SET) < 0)
off_t new_pos = table_fd_seek.seek(this_ptr->table_fd_init_offset, SEEK_SET); {
lseek(this_ptr->table_fd, this_ptr->table_fd_init_offset, new_pos); throw Exception("File descriptor isn't seekable, inside " + this_ptr->getName(), ErrorCodes::CANNOT_SEEK_THROUGH_FILE);
}
} }
else else
{ {