Revert "Better check for exceptions in checkData of non replicated merge tree"

This reverts commit 363ee7cae5.
This commit is contained in:
alesapin 2023-09-19 13:45:34 +02:00
parent 363ee7cae5
commit 7b1cf9d912
3 changed files with 5 additions and 57 deletions

View File

@ -15,11 +15,6 @@
#include <IO/HashingReadBuffer.h>
#include <IO/S3Common.h>
#include <Common/CurrentMetrics.h>
#include <Poco/Net/NetException.h>
#if USE_AZURE_BLOB_STORAGE
# include <azure/core/http/http.hpp>
#endif
namespace CurrentMetrics
{
@ -73,47 +68,6 @@ bool isRetryableException(const Exception & e)
return false;
}
bool isRetryableException(const std::exception_ptr exception_ptr)
{
try
{
rethrow_exception(exception_ptr);
}
#if USE_AWS_S3
catch (const S3Exception & s3_exception)
{
if (s3_exception.isRetryableError())
return true;
}
#endif
#if USE_AZURE_BLOB_STORAGE
catch (const Azure::Core::RequestFailedException &)
{
return true;
}
#endif
catch (const Exception & e)
{
if (isNotEnoughMemoryErrorCode(e.code()))
return true;
if (e.code() == ErrorCodes::NETWORK_ERROR || e.code() == ErrorCodes::SOCKET_TIMEOUT)
return true;
}
catch (const Poco::Net::NetException &)
{
return true;
}
catch (const Poco::TimeoutException &)
{
return true;
}
/// In fact, there can be other similar situations.
/// But it is OK, because there is a safety guard against deleting too many parts.
return false;
}
static IMergeTreeDataPart::Checksums checkDataPart(
MergeTreeData::DataPartPtr data_part,

View File

@ -14,5 +14,5 @@ IMergeTreeDataPart::Checksums checkDataPart(
bool isNotEnoughMemoryErrorCode(int code);
bool isRetryableException(const Exception & e);
bool isRetryableException(const std::exception_ptr exception_ptr);
}

View File

@ -2222,13 +2222,10 @@ CheckResults StorageMergeTree::checkData(const ASTPtr & query, ContextPtr local_
results.emplace_back(part->name, true, "Checksums recounted and written to disk.");
}
catch (...)
catch (const Exception & ex)
{
if (isRetryableException(std::current_exception()))
throw;
tryLogCurrentException(log, __PRETTY_FUNCTION__);
results.emplace_back(part->name, false, "Check of part finished with error: '" + getCurrentExceptionMessage(false) + "'");
results.emplace_back(part->name, false, "Check of part finished with error: '" + ex.message() + "'");
}
}
else
@ -2238,12 +2235,9 @@ CheckResults StorageMergeTree::checkData(const ASTPtr & query, ContextPtr local_
checkDataPart(part, true);
results.emplace_back(part->name, true, "");
}
catch (...)
catch (const Exception & ex)
{
if (isRetryableException(std::current_exception()))
throw;
results.emplace_back(part->name, false, getCurrentExceptionMessage(false));
results.emplace_back(part->name, false, ex.message());
}
}
}