Previously we had such access (read/write/delete) checks only for S3 and
Azure disks (read/read-by-offset/write/delete), this patch adds check
for all disks.
Also I've added the disk name into IDisk interface, since it is required
for the error message in IDisk::checkAccess(), but I have to add
DiskEncrypted::encrypted_name due DiskEncrypted inherits from
DiskDecorator not from IDisk, and so does not have ability to set disk
name (DiskEncrypted could pass the disk name to the DiskDecorator, but
it is not used anywere, and besides this will require to duplicate the
name for each user of DiskDecorator).
Also from nwo on, skip_access_check will make sense for every disk, plus
now startup() called for each disk (before it was missed for some of
them).
And I've added skip_access_check as as a member for DiskRestartProxy,
since it calls startup() on restart().
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Otherwise, if you are lucky enough, race condition is possible, and you
can get some errors because one server already removed the file while
another was trying to read it.
But it was possible only for:
- batch deletes check for "s3" disk
- and all checks for "s3_plain" disk, since this disk does not uses
random names
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
After #40732 it became possible that getrusage() (from detachQuery(),
from buildPushingToViewsChain()) will be called for incorrect thread,
and so when the difference will be calculated it will be simply garbage.
But actually the root of this problem is #25714, after which it became
possible to have multiple ThreadStatus for one thread, and this is very
tricky (sigh).
Here are some other thoughts about it:
- Make ThreadStatus nested - decided that complexity does not worth it,
at least only for this case
- Move some members into ThreadGroupStatus - will break per-thread
statistics (and hence query_thread_log, BTW does somebody uses it?)
- Move some members into a separate structure
But decided to fix the issue w/o any refactoring, to make easy for
backport.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>