Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't mark a part as broken on Poco::TimeoutException #50811

Merged
merged 4 commits into from Jun 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Storages/MergeTree/MergeTreeData.cpp
Expand Up @@ -99,6 +99,7 @@

#include <fmt/format.h>
#include <Poco/Logger.h>
#include <Poco/Net/NetException.h>

template <>
struct fmt::formatter<DB::DataPartPtr> : fmt::formatter<std::string>
Expand Down Expand Up @@ -1252,6 +1253,14 @@ MergeTreeData::LoadPartResult MergeTreeData::loadDataPart(
mark_broken();
return res;
}
catch (const Poco::Net::NetException &)
{
throw;
}
catch (const Poco::TimeoutException &)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. What about NetException?

{
throw;
}
catch (...)
{
mark_broken();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks dangerous - why don't explicitly list the exceptions leading to broken parts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, what about the "memory limit exceeded" exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks dangerous

Yes, but it always worked this way. It's not that dangerous because it's easy to attach broken parts back

why don't explicitly list the exceptions leading to broken parts?

I guess because we don't really know what exceptions lead to broken parts. Just like we don't know what exceptions are retriable.

what about the "memory limit exceeded" exception?

catch (const Exception & e)
{
/// Don't count the part as broken if there was a retryalbe error
/// during loading, such as "not enough memory" or network error.
if (isRetryableException(e))
throw;
mark_broken();

static bool isRetryableException(const Exception & e)
{
if (isNotEnoughMemoryErrorCode(e.code()))
return true;

Expand Down