Change DiskLocal::setup() signature (it always return true)

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-11-20 16:31:10 +01:00
parent 38c009214a
commit cb60576221
2 changed files with 8 additions and 8 deletions

View File

@ -637,7 +637,7 @@ void DiskLocal::checkAccessImpl(const String & path)
IDisk::checkAccessImpl(path);
}
bool DiskLocal::setup()
void DiskLocal::setup()
{
try
{
@ -652,7 +652,7 @@ bool DiskLocal::setup()
/// If disk checker is disabled, just assume RW by default.
if (!disk_checker)
return true;
return;
try
{
@ -676,6 +676,7 @@ bool DiskLocal::setup()
/// Try to create a new checker file. The disk status can be either broken or readonly.
if (disk_checker_magic_number == -1)
{
try
{
pcg32_fast rng(randomSeed());
@ -695,12 +696,12 @@ bool DiskLocal::setup()
disk_checker_path,
name);
disk_checker_can_check_read = false;
return true;
return;
}
}
if (disk_checker_magic_number == -1)
throw Exception("disk_checker_magic_number is not initialized. It's a bug", ErrorCodes::LOGICAL_ERROR);
return true;
}
void DiskLocal::startupImpl(ContextPtr)
@ -711,8 +712,7 @@ void DiskLocal::startupImpl(ContextPtr)
try
{
if (!setup())
readonly = true;
setup();
}
catch (...)
{

View File

@ -137,9 +137,9 @@ protected:
private:
std::optional<UInt64> tryReserve(UInt64 bytes);
/// Setup disk for healthy check. Returns true if it's read-write, false if read-only.
/// Setup disk for healthy check.
/// Throw exception if it's not possible to setup necessary files and directories.
bool setup();
void setup();
/// Read magic number from disk checker file. Return std::nullopt if exception happens.
std::optional<UInt32> readDiskCheckerMagicNumber() const noexcept;