mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #39216 from Algunenano/rotational_error
Don't report system.errors when the disk is not rotational
This commit is contained in:
commit
e37caa5bd6
@ -87,7 +87,10 @@ BlockDeviceType getBlockDeviceType([[maybe_unused]] const String & device_id)
|
||||
#if defined(OS_LINUX)
|
||||
try
|
||||
{
|
||||
ReadBufferFromFile in("/sys/dev/block/" + device_id + "/queue/rotational");
|
||||
const auto path{std::filesystem::path("/sys/dev/block/") / device_id / "queue/rotational"};
|
||||
if (!std::filesystem::exists(path))
|
||||
return BlockDeviceType::UNKNOWN;
|
||||
ReadBufferFromFile in(path);
|
||||
int rotational;
|
||||
readText(rotational, in);
|
||||
return rotational ? BlockDeviceType::ROT : BlockDeviceType::NONROT;
|
||||
@ -109,7 +112,8 @@ UInt64 getBlockDeviceReadAheadBytes([[maybe_unused]] const String & device_id)
|
||||
#if defined(OS_LINUX)
|
||||
try
|
||||
{
|
||||
ReadBufferFromFile in("/sys/dev/block/" + device_id + "/queue/read_ahead_kb");
|
||||
const auto path{std::filesystem::path("/sys/dev/block/") / device_id / "queue/read_ahead_kb"};
|
||||
ReadBufferFromFile in(path);
|
||||
int read_ahead_kb;
|
||||
readText(read_ahead_kb, in);
|
||||
return read_ahead_kb * 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user